I would like to compare different models and in order to save time I though about whether it is possible to feed in a list of values for a single argument in a function, and possibly plot the results.
My concrete example - I am interested in smoothing splines so the model is:
fit <- smooth.splines( x=train_x, y=train_y, df=seq(2, 20, by=0.5) )
which is all fine, but how do i select the different fits with via the "df"s?
Ugly but you could do a loop
fits_out <- list()
for(i in 1:50){
fits[[i]] <- smooth.splines( x=train_x, y=train_y, df=i )
}
Then you can access each model fit from within the list object