cp_validation_fit {gspcr} | R Documentation |
Compute fit measure(s) on the validation data set
Description
Given a training and validation data set, it computes a target fit measure on the validation data set.
Usage
cp_validation_fit(y_train, y_valid, X_train, X_valid, fam, fit_measure)
Arguments
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 |
Details
The validation data set can be specified to be the same as the training data set if desired.
Value
numeric vector of length 1 storing the requested fit measure
Author(s)
Edoardo Costantini, 2023
Examples
# 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)