[R] cv.glm and "longer object length is not a multiple of shorter object length" error

askantik codysjordan at gmail.com
Fri Jul 22 02:29:58 CEST 2011


Hi,

I've done some searching where others have had trouble with this error (or
"warning" actually), but I'm unable to solve my problem.  I have a data
sheet with 13 columns and 36 rows.  Each column has exactly the same number
of rows.  I've created glms and now want to do cross-validation on 2 of
them.  Please be gentle-- I'm new to R (and statistics, too, for that
matter).  Any help is greatly appreciated.  Here's my code:

/library(boot)
n<-length(total_species)
cv13.err<- cv.glm(nests,glm13)
cv13.err.5<- cv.glm(nests,glm13,K=5)
cv18.err<- cv.glm(nests,glm18)
cv18.err.5<- cv.glm(nests,glm18,K=5)/


I get errors starting with the glm18 part.  glm13 is
*total_species~RH+elev+RH*elev* and glm18 is *total_species~per_cover+RH*

Does it have something to do with the two glms having different numbers of
parameters?  I'm not sure why it seems okay with what I've done for glm13,
but not glm18.  Thanks again for any help.

*Warning messages:
1: In y - yhat :
  longer object length is not a multiple of shorter object length*

--
View this message in context: http://r.789695.n4.nabble.com/cv-glm-and-longer-object-length-is-not-a-multiple-of-shorter-object-length-error-tp3685622p3685622.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list