Given a list of model formulas, this function will train such models and return the a single(ensemble) prediction from the list of formulas on a test data set. It may also provides a k-nearest neighbors (KNN) prediction using the features listed in such models.
ensemblePredict(formulaList,
trainData,
testData = NULL,
predictType = c("prob", "linear"),
type = c("LOGIT", "LM", "COX","SVM"),
Outcome = NULL,
nk = 0
)
A list made of objects of class formula
, each representing a model formula to be fitted and predicted with
A data frame with the data to train the model, where all variables are stored in different columns
A data frame similar to trainData
, but with the data set to be predicted. If NULL
, trainData
will be used
Prediction type: Probability ("prob") or linear predictor ("linear")
Fit type: Logistic ("LOGIT"), linear ("LM"), or Cox proportional hazards ("COX")
The name of the column in data
that stores the variable to be predicted by the model
The number of neighbors used to generate the KNN classification. If zero, k is set to the square root of the number of cases. If less than zero, it will not perform the KNN classification
A vector with the median prediction for the testData
data set, using the models from formulaList
A vector with the median prediction for the testData
data set, using the KNN models
A matrix, where each column represents the predictions made with each model from formulaList
A matrix, where each column represents the predictions made with a different KNN model
A vector with the weighted mean ensemble