Use cross-validation to evaluate model performance.
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)
It returns the mean squared error of continuous outcomes. AUC, accuracy, recall and precision for binary outcomes of predictions using cross-validation.
Predictor matrix, each row is an observation vector
Responses matrix. Quantitative for family = "gaussian" and a factor of two levels for family = "binomial"
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
Integer, number of folds for Cross-Validation to evaluate the performance of stacking algorithms.
Logical, indicate if use Cross-Validation Stacking algorithm
Logical, indicate if use Residual Stacking algorithm
Integer, number of folds for Cross-Validation Stacking algorithm. The default value is 5
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()
Base Learners for fitting models in Step 2 of Stacking Algorithm. (see above)
The residual type for Residual Stacking
Logical, whether or not use standardized residual
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