I'm trying to use R caret to perform cross-validation of my linear regression models. In some cases I want to force the intercept through 0. I have tried the following, using the standard lm syntax:
regressControl  <- trainControl(method="repeatedcv",
                        number = 4,
                        repeats = 5
                        )                      
regress         <- train(y ~ 0 + x,
               data = myData,
               method  = "lm",
               trControl = regressControl)
Call:
lm(formula = .outcome ~ ., data = dat)
Coefficients:
(Intercept)     x 
-0.0009585    0.0033794  `
This syntax seems to work with the standard 'lm' function but not within the caret package. Any suggestions?
test <- lm(y ~ 0 + x,
       data = myData)
Call:
lm(formula = y ~ 0 + x, data = myData)
Coefficients:
x 
0.003079