Learn R Programming

catalytic (version 0.1.0)

get_glm_log_density_grad: Compute Gradient of Log Density for GLM Families

Description

This function calculates the gradient of the log density with respect to the coefficients for a given GLM family based on the provided predictors, response variable, and weights.

Usage

get_glm_log_density_grad(family_string, X, Y, coefs, weights = 1)

Value

Numeric vector. The gradient of the log density with respect to the coefficients

Arguments

family_string

Character. The GLM family to use. Options are "binomial" or "gaussian".

X

Matrix. The design matrix (predictors) for the GLM.

Y

Vector. The response variable.

coefs

Numeric vector. The coefficients for the GLM.

weights

Numeric vector. The weights for the GLM. Default is 1.