[R] Fwd: Can't get CVlm from DAAG package to work on my data - R 3.1.3, DAAG 1.20

deltaquattro at gmail.com deltaquattro at gmail.com
Tue Apr 14 11:51:52 CEST 2015


Hi,

I'm trying to get cross validation error for a simple linear regression
model, using function CVlm from package DAAG. I would need also the MSE
errors for each fold, because I want to test the one standard error rule.
My code is

a=c(0.0056, 0.0088, 0.0148, 0.0247, 0.0392, 0.0556, 0.0632, 0.0686, 0.0786,
0.0855, 0.0937)
b=c(6.0813, 9.5011, 15.5194, 23.9409, 32.8492, 40.8399, 43.8760, 45.5270,
46.7668, 46.1587, 43.4524)
dataset=data.frame(x=a,y=b)
CV.list=CVlm(df=dataset,form.lm = formula(y ~ poly(x,2)), m=5)

The error I get is

Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' and 'y' lengths differ

which must refer to internally created x, y, variables, since the variables
x and y inside my dataframe have the same length.

Thanks

Sergio

	[[alternative HTML version deleted]]



More information about the R-help mailing list