[R] Error message from CV.GLM

Max Kuhn mxkuhn at gmail.com
Tue Jan 20 17:25:32 CET 2009


> I have problems with the usage of cv.glm from the boot package. Here are some parts of the script I wanted to use:
>
> data <- read.table("selected_2D.csv", header=TRUE, sep=",")
>> glm.fitted <- glm("ydata$ y  ~ 1 + density + vsurf_ID6 + vsurf_S ", data=data)
> error <- cv.glm(data=data, glm.fitted, K=6)
>
> ydata$y is a separate data set, where I take my independent data from. I build an equation with some of the columns in data. Then I generate the generalized linear model, which works. But when I try to run the last line – the cv.glm function, I get the following error message:

You are going to have to merge that variable into "data". The formula
interface can't really cope with it otherwise.

As an alternative, the train function in caret can do the same thing
as cv.glm (with a few more options). See

   http://www.jstatsoft.org/v28/i05

for more information.

Max




More information about the R-help mailing list