This function calculates the log density of the response variable given a generalized linear model (GLM) based on the specified family. The log density is computed differently for binomial and gaussian families.
get_glm_log_density(family_string, X, Y, coefs, weights = 1)
Numeric. The computed log density of the response variable based on the specified family.
Character. The GLM family to use. Options are "binomial"
or "gaussian"
.
Matrix. The design matrix (predictors) for the GLM.
Vector or data frame. The response variable for the GLM. If a data frame, it is converted to a numeric vector.
Numeric vector. The coefficients for the GLM.
Numeric vector. Weights for the observations. Default is 1
(no weighting).