get_glm_log_density_grad: Compute Gradient of Log Density for GLM Families

View source: R/misc.R

get_glm_log_density_gradR Documentation

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)

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.

Value

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


catalytic documentation built on April 4, 2025, 5:51 a.m.