Skip to content
Prev 1928 / 20628 Next

Significance of fixed effects. Kinship package (Marc Moragues)

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