Learn R Programming

MTPS (version 1.0.2)

cv.MTPS: Evaluation using Cross-Validation

Description

Use cross-validation to evaluate model performance.

Usage

cv.MTPS(xmat, ymat, family, nfolds = 5,
                   cv = FALSE, residual = TRUE,
                   cv.stacking.nfold = 5, method.step1, method.step2,
                   resid.type=c("deviance", "pearson", "raw"),
                   resid.std=FALSE)

Value

It returns the mean squared error of continuous outcomes. AUC, accuracy, recall and precision for binary outcomes of predictions using cross-validation.

Arguments

xmat

Predictor matrix, each row is an observation vector

ymat

Responses matrix. Quantitative for family = "gaussian" and a factor of two levels for family = "binomial"

family

Response type for each response. If all response variable are within the same family it can be "gaussian" or "binomial", otherwise it is a vector with elements "gaussian" and "binomial" to indicate each response family

nfolds

Integer, number of folds for Cross-Validation to evaluate the performance of stacking algorithms.

cv

Logical, indicate if use Cross-Validation Stacking algorithm

residual

Logical, indicate if use Residual Stacking algorithm

cv.stacking.nfold

Integer, number of folds for Cross-Validation Stacking algorithm. The default value is 5

method.step1

Base Learners for fitting models in Step 1 of Stacking Algorithm. It can be one base learner function for all outcomes or a list of base learner functions for each outcome. The list of all base learners can be obtained by list.learners()

method.step2

Base Learners for fitting models in Step 2 of Stacking Algorithm. (see above)

resid.type

The residual type for Residual Stacking

resid.std

Logical, whether or not use standardized residual

Examples

Run this code
data("HIV")
cv.MTPS(xmat=XX, ymat=YY, family="gaussian", nfolds=2,
        method.step1=rpart1, method.step2=lm1)

Run the code above in your browser using DataLab