[R-sig-ME] Significance of fixed effects. Kinship package (Marc Moragues)
Pelle Ingvarsson
pelle at wallace.emg.umu.se
Tue Feb 10 07:30:25 CET 2009
Hi,
When I use the kinship package I fit two models, with and without the
fixed effect you want to test. The compare the log-likelihoods of the
two models, twice the difference in log-likelihood between models should
be apprixmately chi-square with df equal to the difference in number of
parameters in the two models.
So using your example:
aa<-lmekin(dta1[,j] ~ dta1[,k] + g1:g2:g3:g4,data = dta1, random =
~1|geno, varlist = list(K), subset = Year==i)
aa2<-lmekin(dta1[,j] ~ g1:g2:g3:g4,data = dta1, random = ~1|geno,
varlist = list(K), subset = Year==i)
X2<-2*(logLik(aa)-logLik(aa2))
df<-aa$df-aa2$df
p<-1-pchisq(X2,df)
would give you a chi-square value and the associated degrees of freedom.
The p-value of the effect can then be calculated using pchisq.
-Pelle
> Message: 1
> Date: Mon, 9 Feb 2009 14:02:33 -0700
> From: Marc Moragues <marc.moragues at gmail.com>
> Subject: [R-sig-ME] Significance of fixed effects. Kinship package
> To: R Mixed Models <R-sig-mixed-models at r-project.org>
> Message-ID: <200902091402.33547.moragues at lamar.colostate.edu>
> Content-Type: text/plain
>
> Hi,
>
> Some time ago, I was pointed to use the kinship package to include the
> variance/co-variance in a mixed model. My code is as follows and works well
> (it does not give any error).
>
>> aa <- lmekin(dta1[,j] ~ dta1[,k] + g1:g2:g3:g4,data = dta1, random = ~
> 1|geno, varlist = list(K), subset = Year==i)
>> aa
> Linear mixed-effects kinship model fit by maximum likelihood
> Data: dta1
> Subset: Year == i
> Log-likelihood = -581.048
> n= 192
>
> Fixed effects: dta1[, j] ~ dta1[, k] + g1:g2:g3:g4
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) 80.5622757 1.468117 54.8745492 1.185858e-117
> dta1[, k]1 -0.5091199 1.448478 -0.3514860 7.256174e-01
> dta1[, k]na -7.8414997 2.202464 -3.5603297 4.691413e-04
> g1:g2:g3:g4 -657.2792180 1337.706920 -0.4913477 6.237537e-01
>
> Wald test of fixed effects = 18.29943 df = 3 p = 0.0003815272
>
> Random effects: ~1 | geno
> Variance list: list(K)
> geno resid
> Standard Dev: 3.2863076 3.8496073
> % Variance: 0.4215502 0.5784498
>
>
> Now I would like to calculate the significance of dta[,k]. The anova function
> does not work on objects of class lmekin. Any help will be very much
> appreciated.
>
> Marc.
>
> [[alternative HTML version deleted]]
>
>
--
Pär K. Ingvarsson
Senior Researcher, Swedish Research Council
Associate Professor
Umeå Plant Science Centre
Department of Ecology and Environmental Science
Linneaus väg 6
Umeå University, SE-901 87 Umeå
tel. +46-(0)90-786-7414, fax. +46-(0)90-786-6705
More information about the R-sig-mixed-models
mailing list