Cross validation on fold i
Cross validation on fold i
fit_pred_fold(i, x, y, folds, fit_method, family, non_pen_vars = NULL, ...)
i |
target partition |
x |
matrix of predictors |
y |
vector of responses |
folds |
defines how data is seperated into folds for cross validation |
fit_method |
model being used to fit the data |
family |
family used to fit the data |
non_pen_vars |
index of variables that will not be penalized if glmnet is used |
... |
additional commmands to glm or cv.glmnet |
returns predictions for partition i
Ben Sherwood <ben.sherwood@ku.edu>
folds_10 <- randomly_assign(100,10) x <- matrix(rnorm(800),ncol=8) y <- runif(100) < exp(1 + x[,1] + x[,5])/(1+exp(1 + x[,1] + x[,5])) fold_1_results <- fit_pred_fold(1,x,y,folds_10,"glm","binomial") fold_2_results <- fit_pred_fold(2,x,y,folds_10,"glm","binomial")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.