Description Usage Arguments Value Examples
It fits all subset regression, allowing interaction and categorical covariates, and cross validates them.
The code borrows heavily from package meifly
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | cvAll(x, ...)
## Default S3 method:
cvAll(x, data, k, lossfn = .calcMSE, ind, finalfit = TRUE)
## S3 method for class 'lm'
cvAll(x, data, k = 5, ind = NULL, ...)
## S3 method for class 'lme'
cvAll(x, data, k = 5, ind = NULL, ...)
## S3 method for class 'merMod'
cvAll(x, data, k = 5, ind = NULL, ...)
validateAll(x, data, method, valid_prob, ...)
|
x |
Either an |
data |
Data. |
k |
Postive integer. k-fold cross validation is carried out. Defaults to 5. |
lossfn |
A function with 2 arguments. The first takes an array of predicted value, the second takes a vector of observed value. Then it calculates the loss. It defaults to a function which calculates the mean sqaured error (MSE). |
finalfit |
if |
valid_prob |
Positive number between 0 and 1. It is the proportion of data used in the validation set. |
An maxtrix of predictions on the validation set, with the following attributes:
loss
The loss calculated by lossfn
.
data
The data used.
models
The fitted models or just formulae of models, depending on finalfit
.
1 2 3 4 5 6 7 8 9 10 11 12 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.