dEdq_nb_noinfl: Compute Partial Derivatives of Expected Values for...

View source: R/dEdq_nb_noinfl.R

dEdq_nb_noinflR Documentation

Compute Partial Derivatives of Expected Values for Zero-truncated Negative Binomial Model

Description

This internal function calculates the partial derivatives of expected values for a regular truncated negative binomial regression model with respect to covariates. It also adjusts for marginal effects of dummy variables when specified.

Usage

dEdq_nb_noinfl(b, a, X, dummies, formula)

Arguments

b

Numeric vector of coefficients for the regression model.

a

Numeric scalar, the overdispersion parameter of the negative binomial distribution.

X

Matrix of predictors for the model, where rows correspond to observations and columns to covariates.

dummies

Character vector of column names from X that are considered dummy variables for which marginal effects need to be computed.

Details

This function performs the following tasks:

  • Computes partial derivatives of expected values with respect to covariates in X.

  • Adjusts for marginal effects of dummy variables by altering their values in the design matrix and computing the difference in expected values.

It is designed for internal use and assumes correct input structure. Improper inputs may result in errors or unexpected behavior.

Value

A matrix of partial derivatives (or marginal effects) with rows corresponding to observations and columns to covariates. Marginal effects for dummy variables are calculated by contrasting expected values when the dummy variable is set to 0 versus 1.

See Also

E_negbin_noinfl for computing expected values in the regular truncated negative binomial model.


oneinfl documentation built on April 4, 2025, 12:05 a.m.