LL_newdata {gspcr}R Documentation

Log-Likelihood for new data

Description

Given training and validation datasets, this function returns the log-likelihood of unobserved data under the model trained on the training data.

Usage

LL_newdata(y_train, y_valid, X_train = NULL, X_valid = NULL, fam)

Arguments

y_train

Vector of DV values in the training dataset.

y_valid

Vector of DV values in the validation dataset.

X_train

Matrix of IV values in the training dataset. Can also be set to 1 to obtain the log-likelihood of the new data under the null model.

X_valid

Matrix of IV values in the validation dataset. If X_train is set to 1 to obtain the log-likelihood of the new data under the null model, X_valid is ignored.

fam

character vector of length 1 storing the description of the error distribution and link function to be used in the model (see cv_gspcr() for the list of possible options)

Details

This function trains a GLM regressing y_train on X_train using as link function what is specified in fam. Then, it computes the predictions for the validation data based on the trained model on the scale of the linear predictors (e.g., logit). The likelihood of the validation under the model is returned.

Value

A list of objects.

Author(s)

Edoardo Costantini, 2023


[Package gspcr version 0.9.5 Index]