Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fit_pred_fold

Cross validation on fold i


Description

Cross validation on fold i

Usage

fit_pred_fold(i, x, y, folds, fit_method, family, non_pen_vars = NULL, ...)

Arguments

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

Value

returns predictions for partition i

Author(s)

Ben Sherwood <ben.sherwood@ku.edu>

Examples

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")

roccv

ROC for Cross Validation Results

v1.2
MIT + file LICENSE
Authors
Ben Sherwood [aut, cre]
Initial release
2019-05-10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.