Learn R Programming

marginaleffects (version 0.1.0)

get_dydx_and_se: Get marginal effects and standard errors (internal function)

Description

Get marginal effects and standard errors (internal function)

Usage

get_dydx_and_se(model, ...)

# S3 method for default get_dydx_and_se( model, variables, fitfram = insight::get_data(model), vcov = stats::vcov(model), group_name = NULL, type = "response", numDeriv_method = "simple", ... )

Arguments

model

Model object

...

Additional arguments are pushed forward to predict().

variables

Variables to consider (character vector). NULL calculates marginal effects for all terms in the model object.

fitfram

A data.frame over which to compute marginal effects.

vcov

Matrix or boolean

  • FALSE: does not compute unit-level standard errors.

  • TRUE: computes unit-level standard errors using the default vcov(model) variance-covariance matrix.

  • Named square matrix: computes standard errors with a user-supplied variance-covariance matrix. This matrix must be square and have dimensions equal to the number of coefficients in get_coef(model).

group_name

String to identify the "group" or "level" of the terms to estimate. Groups are often used in models like multinomial logit where each level of the response variable is associated to its own set of coefficients.

type

Type(s) of prediction as string or vector This can differ based on the model type, but will typically be a string such as: "response", "link", "probs", or "zero".

variable

A string to identify the variable whose marginal effect to compute.

Value

A data.frame with term names, group names, marginal effects, and standard errors.