附加关键词:最佳线性无偏估计(蓝色)、调整均值、混合模型、固定效应、线性组合、对比度、R
在用mmer() of 套餐进行模型拟合之后,是否可以从mmer对象中获得) / 最小二乘法(LS-均值)?也许类似于函数与ASReml v3
实际上,我想要多个东西,也许分开问比较清楚:
predict(..., vcov=T))emmeans(mod, pairwise ~ effect, adjust="Tukey") )。predict(..., sed=T))因此,基本上,predict()和emmeans()的结合才是这里的目标。
提前感谢!
发布于 2018-11-14 19:07:25
在sommer >= 3.7中,已经实现了预测函数,以获得对固定或随机效应的预测,就像asreml那样。它需要一个模型和分类参数来知道用于聚合超表的参数,并提出正确的标准错误。例如:
data(DT_cpdata)
#### create the variance-covariance matrix
A <- A.mat(GT) # additive relationship matrix
#### look at the data and fit the model
head(DT)
mix1 <- mmer(Yield~1,
random=~vs(id,Gu=A)
+ Rowf + Colf,
rcov=~units,
data=DT)
summary(mix1)
preds <- predict(mix1,classify = "id")
> head(preds$predictions)
id predicted.value.Yield standard.errors.Yield
1 P003 111.15400 28.16363
2 P004 135.21958 29.81544
3 P005 109.72743 29.68574
4 P006 144.98582 27.99627
preds <- predict(mix1,classify = "Rowf")
> head(preds$predictions)
Rowf predicted.value.Yield standard.errors.Yield
1 1 81.71645 23.22997
2 2 96.79625 22.92514
3 3 128.89043 22.64216
4 4 132.65795 22.73903等等..。RtermsToForce和FtermsToForce参数可以用于强制在预测中使用特定的、固定的或随机的项。定制对比,我想下一个版本。
发布于 2018-10-30 22:07:23
这似乎是可能的。下面是该包的一个示例:
library(sommer) # Version 4.1.2
data(DT_cornhybrids)
DT <- DT_cornhybrids
DTi <- DTi_cornhybrids
GT <- GT_cornhybrids
hybrid2 <- DT
A <- GT
K1 <- A[levels(hybrid2$GCA1), levels(hybrid2$GCA1)]
K2 <- A[levels(hybrid2$GCA2), levels(hybrid2$GCA2)]
S <- kronecker(K1, K2, make.dimnames=TRUE)
ans <- mmer(Yield ~ Location,
random = ~ vs(GCA1,Gu=K1) + vs(GCA2,Gu=K2) + vs(SCA,Gu=S),
rcov=~units,
data=hybrid2)
summary(ans)
## ...
## Fixed effects:
## Trait Effect Estimate Std.Error t.value
## 1 Yield (Intercept) 1.379e+02 1.962 7.031e+01
## 2 Yield Location2 1.776e-14 2.099 8.461e-15
## 3 Yield Location3 7.835e+00 2.099 3.732e+00
## 4 Yield Location4 -9.097e+00 2.099 -4.333e+00
## ...返回的对象具有元素$Beta和$VarBeta,它们返回固定的效果及其协方差。我们可以使用emmeans::qdrg()创建一个参考网格
rg <- qdrg(~ Location, data = hybrid2, coef = ans$Beta$Estimate,
vcov = ans$VarBeta)
rg
## 'emmGrid' object with variables:
## Location = 1, 2, 3, 4
emmeans(rg, trt.vs.ctrl1 ~ Location)
## $emmeans
## Location emmean SE df asymp.LCL asymp.UCL
## 1 138 1.96 Inf 134 142
## 2 138 1.96 Inf 134 142
## 3 146 1.96 Inf 142 150
## 4 129 1.96 Inf 125 133
## Confidence level used: 0.95
## $contrasts
## contrast estimate SE df z.ratio p.value
## 2 - 1 0.00 2.1 Inf 0.000 1.0000
## 3 - 1 7.84 2.1 Inf 3.732 0.0006
## 4 - 1 -9.10 2.1 Inf -4.333 <.0001
## P value adjustment: dunnettx method for 3 tests 位置1的EMM及其SE匹配summary()截距,其余的回归系数和SE匹配对比结果,这一事实令人放心。
有关详细信息,请参阅qdrg文档。
https://stackoverflow.com/questions/53042452
复制相似问题