dEdq_pois: Compute Partial Derivatives of Expected Values for a...

View source: R/dEdq_pois.R

dEdq_poisR Documentation

Compute Partial Derivatives of Expected Values for a One-Inflated Positive Poisson Model

Description

This internal function calculates the partial derivatives of expected values for a one-inflated Poisson regression model with respect to covariates. It also computes marginal effects for specified dummy variables.

Usage

dEdq_pois(b, g, X, Z, dummies, formula)

Arguments

b

Numeric vector of coefficients for the main Poisson model.

g

Numeric vector of coefficients for the one-inflation process.

X

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

Z

Matrix of predictors for the one-inflation process, structured similarly to X.

dummies

Character vector of column names from X and Z that are treated as dummy variables for which marginal effects are computed.

Details

This function:

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

  • Handles marginal effects for dummy variables by modifying their values in the design matrices 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. For dummy variables, marginal effects are calculated by contrasting expected values when the dummy is set to 0 versus 1.

See Also

E_pois for computing expected values in the one-inflated Poisson model.


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