secondDiff {DAMisc}R Documentation

Calculate Cross-Derivative and its Variability

Description

Calculates the cross-derivative required to evaluate interactions in logistic/probit regression models.

Usage

secondDiff(
  obj,
  vars,
  data,
  method = c("AME", "MER"),
  vals = NULL,
  typical = NULL
)

Arguments

obj

An object of class glm that will be used to find the cross-derivative.

vars

A vector of two variables to be used in calculating the derivative.

data

A data frame.

method

Indicate whether you want to use average marginal effects (AME) or marginal effects at representative values (MER).

vals

A named list of length 2 where each element gives the minimum and maximum values used in the calculation.

typical

A named vector of values at which to hold variables constant.

Details

The function calculates the second difference as (Pr(Y=1|x1=max, x2=max) - Pr(Y=1|x1=min, x2=max)) - (Pr(Y=1|x1=max, x2=min) - Pr(Y=1|x1=min, x2=min)). The function uses a parametric bootstrap to calculate the sampling distribution of the second difference.

Value

A list with two elements:

ave

The average second difference in each iteration of the bootstrap.

ind

If type == 'AME', ind is returned with the second difference and measures of uncertainty for each individual observation in the original dataset

probs

If type == 'MER', probs is returned with the full matrix of simulated predicted probabilities for the four conditions.

Author(s)

Dave Armstrong


[Package DAMisc version 1.7.2 Index]