I ran a mixed model logistic regression adjusting my model with genetic relationship matrix using an R package known as GMMAT
(function: glmmkin()
).
My output from the model includes (taken from the user manual):
theta
: the dispersion parameter estimate [1] and the variance component parameter estimate [2]coefficients
: fixed effects parameter estimates (including the intercept).linear.predictors
: the linear predictors.fitted.values
: fitted mean values on the original scale.Y
: a vector of length equal to the sample size for the final working vector.P
: the projection matrix with dimensions equal to the sample size.residuals
: residuals on the original scale. NOT rescaled by the dispersion parameter.cov
: covariance matrix for the fixed effects (including the intercept).converged
: a logical indicator for convergence.
I am trying to obtain the log-likelihood in order to compute variance explained. My first instinct was to pull apart the logLik.glm
function in order to compute this "by hand" and I got stuck at trying to compute AIC. I used the answer from here.
I did a sanity check with a logistic regression run with stats::glm()
where the model1$aic
is 4013.232 but using the Stack Overflow answer I found, I obtained 30613.03.
My question is -- does anyone know how to compute log likelihood from a logistic regression by hand using the output that I have listed above in R?