[英]p-values of linear combination of coefficients in linear mixed model
I fitted a linear mixed model using lme function of nlme package in R. My goal is to find a p-value of a linear combination of coefficients of fixed effects part. 我在R中使用nlme包的lme函数拟合了线性混合模型。我的目标是找到固定效果部分系数的线性组合的p值。
Value Std.Error DF t-value p-value
(Intercept) -1.5897634 0.019578359 41547 -81.20004 0.0000
group_k 0.0866493 0.027662455 594 3.13238 0.0018
x1 0.1621744 0.006963385 41547 23.28960 0.0000
For example, p-value of the hypothesis $ \\beta_1 = 0 $ is provided in this result (0.0018). 例如,在此结果中提供了假设$ \\ beta_1 = 0 $的p值(0.0018)。 But if I want to find a p-value of a hypothesis such as $ \\beta_1 + 3 * \\beta_2 = $, what should I do?
但是,如果我想找到一个假设的p值,例如$ \\ beta_1 + 3 * \\ beta_2 = $,我该怎么办? Is there any ready-made command to do this calculation?
是否有现成的命令可以进行此计算?
It would be nice to have a reproducible example. 有一个可重现的例子会很好。 It's not very hard to set up your own test for this:
为此,设置您自己的测试不是很困难:
ct <- c(0,1,3) ## set up contrast (linear comb. of coefficients)
m <- fixef(m) %*% ct ## mean of contrast
v <- c(t(ct) %*% vcov(m) %*% ct) ## variance of contrast
stder <- sqrt(v) ## standard error
tstat <- m/stder ## t statistic
2*pt(abs(tstat),df=594,lower.tail=FALSE)
I'm not sure about the degrees of freedom calculation, but all of the df are so large that it won't make any practical difference; 我不确定自由度的计算,但是所有df太大,以至于不会产生任何实际的变化。 you can use
pnorm()
instead of pt
. 您可以使用
pnorm()
代替pt
。
If you want the theory, take a look at eg the section on Wald tests of contrasts in Dobson and Barnett Generalized Linear Models . 如果需要理论,请查看例如Dobson和Barnett 广义线性模型中的对比Wald检验一节。
You might also take a look at the effects
, lsmeans
, and/or multcomp
packages. 您还可以查看
effects
, lsmeans
和/或multcomp
软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.