I’m analyzing count data (insect density in maize crop) and performing negative binomial regression analysis using 30 predictors (remotely-sensed variables) to predict number of insects. I was trying to execute a leave one-out cross-validation method to test the performance of the models using R software (the cv.glm function in boot package). Seemingly, the cross-validation method does not work for my data and I got an error message says “Error in model.frame.default(formula = data$Density ~ ., data = list(Density = c(6L, :
variable lengths differ (found for 'B1')”
· Density is the insect numbers
· B1 is predictor number 1.
In fact, the data for the predictor (B1) and Density are of the same size.
I appreciate any suggestions.