# D_discrete.margins: Calculate derivatives of marginal effects for binary... In oglmx: Estimation of Ordered Generalized Linear Models

## Description

Calculates derivatives of marginal effects with respect to the estimated parameters for binary variables. Required to calculate standard errors of marginal effects.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```D_discrete.margin_meanonly.mean(whichVars, whichXest, X, fouretas, link, std.dev) D_discrete.margin_mean.var(whichZest, Z, fouretas, link, std.dev, gstd.dev) D_discrete.margin_mean.alpha(estThresh, outcomematrix, fouretas, std.dev, link) D_discrete.margin_var.mean(whichXest, X, fouretas, link, StdDevs) D_discrete.margin_varonly.var(whichVars, whichZest, Z,fouretas, ZDinputs, link, StdDevs, gsdmodel) D_discrete.margin_var.alpha(estThresh, outcomematrix, fouretas, StdDevs, link) D_discrete.margin_meanvar.mean(whichXest, X, BothEqLocs, fouretas, StdDevs, link) D_discrete.margin_meanvar.var(whichZest, Z, BothEqLocs, fouretas, ZDinputs, link, StdDevs,gsdmodel) ```

## Arguments

 `whichVars` Numeric vector stating indexes of variables that are binary and marginal effects are desired. `whichXest` Logical vector indicating the variables in X for which the relevant parameters were estimated. `X` Data matrix containing variables in mean equation. `fouretas` Inputs to link functions. `link` specifies the link function for the estimated model. `std.dev` The calculated standard deviation of the error terms. `Z` Data matrix containing variables in variance equation. `whichZest` Logical vector indicating the variables in Z for which the relevant parameters were estimated. `gstd.dev` The calculated derivative of the standard deviation of the error terms. `estThresh` Logical vector indicating which threshold parameters were estimated. `outcomematrix` A matrix that indicates the outcome variable. `ZDinputs` Values of inputs to function that gives standard deviation when binary variable is equal to 0 and 1. `StdDevs` Values of standard deviation when binary variable is equal to 0 and 1. `gsdmodel` Expression used to calculate derivative of standard deviation. `BothEqLocs` Dataframe describing locations of binary variables that are in both the mean and variance equations.

## Value

Numeric matrix of derivatives of marginal effects with respect to estimated parameters.

## Author(s)

Nathan Carroll, nathan.carroll@ur.de

`margins.oglmx`