Hello,

 

I have a GLMM object fit using the glmer() function in R and want to perform
k-fold cross validation.  For simple GLMs I have used the CVbinary function
from the DAAG pkg as seen below.

 

> SimpleGLM <- glm(Res ~ Var1 + Var2, data = Data, family=binomial)

> CVbinary(SimpleGLM,  nfolds=10, print.details=TRUE)

 

Fold:  3 2 4 1 7 10 6 9 5 8

Internal estimate of accuracy = 0.828

Cross-validation estimate of accuracy = 0.827

 

However, when a random term for IndID is added to the model an error (below)
results from the S4 class of a model fit with glmer().  

 

GLMMod <- glmer(Res ~ Var1 + Var2 + (1|IndID), data = Data, family=binomial)

> CVbinary(GLMMod ,  nfolds=10, print.details=TRUE)

 

Error in obj$data : $ operator not defined for this S4 class

 

I have been looking online and have been unable to find a function similar
to CVbinary() that works with S4 objects, but wanted to double check here
before I code it manually.  

 

In short, (assuming I am correctly interpreting the R error) is there a
function that performs k-fold cross validation on S4 objects?

 

Thanks in advance for any suggestions,

 

Blake


	[[alternative HTML version deleted]]

