[R] degrees of freedom for contrast
Qian Liu
littleduck24 at gmail.com
Thu Jun 7 22:12:51 CEST 2012
Hi, I need some help to figure out the df I should use in t test for
my contrast.
I have 5 treatments and 5 phenotypes, I would like to compute the
difference of treatment means for each phenotype and do t test, such
as treatment1 vs treatment2 on phenotype1
How should I calculate the pooled degrees of freedom for the t tests
of all the contrasts? Thank you very much.
Qian
>mylong.lme <- lme(dscore~Trt.Pheno-1, data=mylong, random=~1 | ID, method="ML")
> summary(mylong.lme)
Linear mixed-effects model fit by maximum likelihood
Data: mylong
AIC BIC logLik
14789.14 14949.83 -7367.571
Random effects:
Formula: ~1 | ID
(Intercept) Residual
StdDev: 1.40765 3.039555
Fixed effects: dscore~ Trt.Pheno - 1
Value Std.Error DF t-value p-value
TrtPheno1_1 : -2.516975 0.2788703 2412 -9.025613 0.0000
Trt.Pheno2_1 : -1.172767 0.3781179 2412 -3.101590 0.0019
Trt.Pheno3_1 : -0.810177 0.2869447 2412 -2.823459 0.0048
Trt.Pheno4_1 : -1.518063 0.2791157 2412 -5.438830 0.0000
Trt.Pheno5_1 : -0.367947 0.3564081 2412 -1.032377 0.3020
..............
.............
coef <- fixed.effects(mylong.lme)
covmat <- mylong.lme$varFix
> c # my contrast matrix
>mycontr.est <- c %*% coef
>mycontr.var <- c %*% covmat %*% t(c)
>t2 <- t(mycontr.est) %*% solve(mycontr.var) %*% mycontr.est
>P<- 2*pt(sqrt(abs(t2)), df=????)
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 14.0
year 2011
month 10
day 31
svn rev 57496
language R
version.string R version 2.14.0 (2011-10-31)
More information about the R-help
mailing list