View source: R/cp_validation_fit.R
cp_validation_fit | R Documentation |
Given a training and validation data set, it computes a target fit measure on the validation data set.
cp_validation_fit(y_train, y_valid, X_train, X_valid, fam, fit_measure)
y_train |
numeric vector or factor of dependent variable values from the training set |
y_valid |
numeric vector or factor of dependent variable values from the validation set |
X_train |
|
X_valid |
|
fam |
character vector of length 1 storing the description of the error distribution and link function to be used in the model (see |
fit_measure |
character vector indicating which fit measure should be computed (see |
The validation data set can be specified to be the same as the training data set if desired.
numeric vector of length 1 storing the requested fit measure
Edoardo Costantini, 2023
# Example inputs
y_train = mtcars[1:20, 1]
y_valid = mtcars[-c(1:20), 1]
X_train = mtcars[1:20, -1]
X_valid = mtcars[-c(1:20), -1]
fam = "gaussian"
fit_measure = "BIC"
# Use the function
cp_validation_fit(y_train, y_valid, X_train, X_valid, fam, fit_measure)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.