dEdq_nb | R Documentation |
This internal function computes the partial derivatives of expected values for a one-inflated zero-truncated negative binomial regression model with respect to covariates. It also accounts for marginal effects of dummy variables.
dEdq_nb(b, g, a, X, Z, dummies, formula)
b |
Numeric vector of coefficients for the rate parameter. |
g |
Numeric vector of coefficients for the inflation process. |
a |
Numeric scalar, the overdispersion parameter of the negative binomial distribution. |
X |
Matrix of predictors for the main model, where rows correspond to observations and columns to covariates. |
Z |
Matrix of predictors for the inflation process, structured similarly to |
dummies |
Character vector of column names from |
This function performs the following tasks:
Computes partial derivatives of expected values with respect to covariates in X
and Z
.
Handles marginal effects for dummy variables by comparing expected values when the dummy variable is set to 0 versus 1.
The function is designed for internal use in the package and assumes that all input matrices and vectors are correctly specified. Any unexpected input structure may result in errors.
A matrix of partial derivatives (or marginal effects) with rows corresponding to observations and columns to covariates. For dummy variables, marginal effects are calculated directly.
E_negbin
for expected values in the negative binomial model.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.