I have fitted a model using the GMMAT package in R. This model includes several variables and a Genetic Relatedness Matrix to control for the relatedness of the sample.
See this example:
require(GMMAT)
data(example)
attach(example)
model0 <- glmmkin(disease ~ age + sex, data = pheno, kins = GRM, id = "id",
family = binomial(link = "logit"))
model0$theta
model0$coefficients
model0$cov
model1 <- glmmkin(disease ~ age , data = pheno, kins = GRM, id = "id",
family = binomial(link = "logit"))
model1$theta
model1$coefficients
model1$cov
I would like to fit a full model and then compare restricted models. However, I do not have how to get fit statistics (AIC, R2 and if possible P values) from these models.
The only information I get using summary(model0) is:
> summary(model0)
Length Class Mode
theta 2 -none- numeric
n.pheno 1 -none- numeric
n.groups 1 -none- numeric
coefficients 3 -none- numeric
linear.predictors 400 -none- numeric
fitted.values 400 -none- numeric
Y 400 -none- numeric
X 1200 -none- numeric
P 160000 -none- numeric
residuals 400 -none- numeric
scaled.residuals 400 -none- numeric
cov 9 -none- numeric
Sigma_i 0 -none- NULL
Sigma_iX 0 -none- NULL
converged 1 -none- logical
call 6 -none- call
id_include 400 -none- numeric
I have tried using:
anova(model0, model1)
but it says:
Error in UseMethod("anova") :
no applicable method for 'anova' applied to an object of class "glmmkin"
How can I get fit statistics when using the glmmkin function and compare models? is it possible?
I do not know if I could calculate AIC manually with something like this:
nrow(example$pheno)*(log((sum(model0$residuals^2)/nrow(example$pheno))))+(length(model0$coefficients)*2)
Thank you so much in advance. With all good wishes.