crossvalidate.bigKRLS: crossvalidate.bigKRLS

Description Usage Arguments Value Examples

View source: R/bigKRLS.R

Description

crossvalidate.bigKRLS

Usage

1
2
crossvalidate.bigKRLS(y, X, seed, Kfolds = NULL, ptesting = NULL,
  estimates_subfolder = NULL, ...)

Arguments

y

A vector of numeric observations on the dependent variable. Missing values not allowed.

X

A matrix of numeric observations of the independent variables. Factors, missing values, and constant vectors not allowed.

seed

Randomization seed to be used when partitioning data.

Kfolds

Number of folds for cross validation. Requires ptesting == NULL. Note KRLS assumes variation in each column; rare events or rarely observed factor levels may violate this assumption if Kfolds is too large given the data.

ptesting

Percentage of data to be used for testing (e.g., ptesting = 20 means 80% training, 20% testing). Requires Kfolds == NULL. Note KRLS assumes variation in each column; rare events or rarely observed factor levels may violate this assumptions if ptesting is too small given the data.

estimates_subfolder

If non-null, saves all model estimates in current working directory.

...

Additional arguments to be passed to bigKRLS() or predict(). E.g., crossvalidate.bigKRLS(y, X, derivative = FALSE) will run faster but compute fewer test stats comparing in and out of sample performance (because the marginal effects will not be estimated).

Value

bigKRLS_CV (list) Object of estimates and summary stats; summary() is defined. For train/test, contains a bigKRLS regression object and a predict object. For Kfolds, contains a nested series of training and testing models.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# y <- as.matrix(ChickWeight$weight)
# X <- matrix(cbind(ChickWeight$Time, ChickWeight$Diet == 1), ncol = 2)

# cv.out <- crossvalidate.bigKRLS(y, X, seed = 123, ptesting = 20)
# cv.out$pseudoR2_oos
# cv <- summary(cv.out)

# cv$training.ttests

# kcv.out <- crossvalidate.bigKRLS(y, X, seed = 123, Kfolds = 3)
# kcv <- summary(kcv.out, digits = 3) 

# kcv$overview
# kcv$training2.ttests

# save.bigKRLS(kcv.out, "myKfolds")
# load.bigKRLS("/path/to/myKfolds")     

bigKRLS documentation built on Aug. 3, 2019, 1:02 a.m.