| validate | R Documentation | 
validate is a generic function for cross-validating predictions from
the results of various model fitting functions. The function invokes
particular methods which depend on the
class of the first argument.
validate(object, ...)
## S3 method for class 'lm'
validate(
  object,
  data = NULL,
  n_folds = 10,
  n_reps = 10,
  seed = 42,
  silent = FALSE,
  ...
)
## S3 method for class 'glm'
validate(
  object,
  data = NULL,
  n_folds = 10,
  n_reps = 10,
  seed = 42,
  silent = FALSE,
  ...
)
## S3 method for class 'zeroinfl'
validate(object, n_folds = 10, n_reps = 10, seed = 42, silent = FALSE, ...)
## S3 method for class 'glmnet'
validate(
  object,
  x = NULL,
  y = NULL,
  lambda = NULL,
  offset = NULL,
  weights = NULL,
  n_folds = 10,
  n_reps = 10,
  seed = 42,
  envir = .GlobalEnv,
  silent = FALSE,
  ...
)
## S3 method for class 'beset'
validate(object, ...)
## S3 method for class 'nested'
validate(object, metric = "auto", oneSE = TRUE, ...)
## S3 method for class 'randomForest'
validate(
  object,
  data = NULL,
  x = NULL,
  n_folds = 10,
  n_reps = 10,
  seed = 42,
  ...,
  parallel_type = NULL,
  n_cores = NULL,
  cl = NULL,
  silent = FALSE
)
object | 
 A model object for which a cross-validated R-squared is desired.  | 
... | 
 Additional arguments passed to model summary methods.  | 
data | 
 Data frame that was used to train the model. Only needed if
the training data is not contained in the model   | 
n_folds | 
 
  | 
n_reps | 
 
  | 
seed | 
 
  | 
silent | 
 
 object call  | 
x | 
 Model matrix that was used to train elastic net.  | 
y | 
 Response variable that was used to train elastic net.  | 
lambda | 
 
  | 
offset | 
 
  | 
weights | 
 =   | 
envir | 
 
  | 
metric | 
 
  | 
oneSE | 
 
  | 
parallel_type | 
 (Optional) character string indicating the type of
parallel operation to be used, either   | 
n_cores | 
 Integer value indicating the number of workers to run in
parallel during subset search and cross-validation. By default, this will
be set to one fewer than the maximum number of physical cores you have
available, as indicated by   | 
cl | 
 (Optional)   | 
To obtain cross-validation statistics, first fit a model as you
normally would and then pass the model object to validate.
a "cross_valid" object consisting of a list with the
following elements:
a list of cross-validated prediction metrics, each containing the mean, between-fold standard error ("btwn_fold_se"), and between-repetition min-max range ("btwn_rep_range") of each metric.
a data frame containing the hold-out predictions for each row in the training data, with a separate column for each repetition of the k-fold cross-validation
a data frame of equal
dimensions to predictions giving the number of the hold-out fold
of the corresponding element in predictions
a list documenting how many folds and repetitions were used for cross-validation, and the seed passed to the random number generator, which will be needed to reproduce the random fold assignments
validate(lm): Cross-validation of linear models
validate(glm): Cross-validation of GLMs
validate(zeroinfl): Cross-validation of GLMs
validate(glmnet): Cross-validation of GLM nets
validate(beset): Cross-validation of beset objects
validate(nested): Extract test error estimates from "nested beset"
objects with nested cross-validation
validate(randomForest): Cross-validation of random forests
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.