LL_baseline {gspcr} | R Documentation |
Baseline category logistic regression log-likelihood
Description
Computes the baseline category logistic regression log-likelihood given a nominal categorical variable and the corresponding GLM linear predictor values.
Usage
LL_baseline(y, x, mod)
Arguments
y |
factor or disjunctive table representation recording a nominal variable with 3 or more categories. |
x |
data.frame (or matrix) containing predictor values. |
mod |
|
Details
If x
and y
are equal to the data on which mod
has been trained, this function returns the same result as the default logLink
function. If x
and y
are new, the function returns the log-likelihood of the new data under the trained model.
A disjunctive table is a matrix representation of a multi-categorical variable. The dimensionality of the matrix is i times j, with i = number of observations, and j = number of categories. y_{ij}
is equal to 1 if observation i responded with category j, and it is equal to 0 otherwise.
The log-likelihood equation is based on Agresti (2002, p. 192).
Value
A list containing:
-
ll
atomic vector of length 1 containing the log-likelihood value. -
sc
numeric matrix containing the systematic component for the inputx
andmod
.
Author(s)
Edoardo Costantini, 2023
References
Agresti, A. (2012). Categorical data analysis (Vol. 792). John Wiley & Sons.