fit_pred_fold: Cross validation on fold i

Description Usage Arguments Value Author(s) Examples

Description

Cross validation on fold i

Usage

1
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

1
2
3
4
5
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") 

Example output

Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16

Loading required package: parallel
Loading required package: pROC
Type 'citation("pROC")' for a citation.

Attaching package: 'pROC'

The following object is masked from 'package:glmnet':

    auc

The following objects are masked from 'package:stats':

    cov, smooth, var

roccv documentation built on May 10, 2019, 5:03 p.m.

Related to fit_pred_fold in roccv...