effects.fmlogit: Average Partial Effects of the Covariates

View source: R/marginals.R

effects.fmlogitR Documentation

Average Partial Effects of the Covariates

Description

Calculate average partial effects (APE) of independent variable from a fractional multinomial logit model.

Usage

## S3 method for class 'fmlogit'
effects(object, effect = c("marginal", "discrete"),
  marg.type = "atmean", se = F, varlist = NULL, at = NULL,
  R = 1000)

Arguments

object

An "fmlogit" object.

effect

Can be "marginal", for marginal effect; or "discrete", for discrete changes from the min to the max.

marg.type

Type of marginal or discrete effects to be computed. Default to "atmean", the effect at the mean of all covariates. Also take "aveacr", the averaged effects across all observations. See details.

se

Whether to calculate standard errors for those margins. See details.

varlist

A string vector which provides the name of variables to calculate the marginal effect. If missing, all variables except the constant will be calculated. Use "constant" if wish to compute the marginal effect of constant.

at

Specify values of the X-matrix at which the partial effect will be retrieved. Expect a vector input of length K-1. Only supported for marg.type="atmean". See predict.fmlogit(newdata).

R

Number of times to sample for the Krinsky-Robb standard error. Default to 1000.

marg.list

A list of matrices storing the marginal effect matrix for each observation. Exists only if marg.type="aveacr".

Details

This module calculates the average partial effects (APEs) from a fractional multinomial logit model. Partial effects are the counterpart of the marginal effects in a linear model setting. In linear models, usually the parameter estimate itself represents marginal effect (if the variable in question is continuous). In logit models, however, the parameter estimates at hand is the effect on log-ratio between the choice variable and the baseline variable. This function is intended to extract APEs from the coefficient estimates completed from the fractional multinomial logit models.

This function allows for two types of partial effects: marginal effect, and discrete effect. Marginal effect represents how a unit change in one continuous variable x may influence the choice variable y. The estimate of marginal effect is very straighforward. However, special care is needed when averaging the marginal effect across observations to acquire APE. One approach is to use the estimate of the marginal effect while setting other explanatory variables at the mean. We call this marginal effect at the mean (MEM), which corresponds to the option marg.type=atmean. Another approach is to take the average of marginal effects for each individual. We call this average marginal effect (AME), which corresponds to the option marg.type= aveacr.

The discrete effect represents how a discrete change in one specific x, discrete or continuous, influence the choice variable y. This is more useful for categorical variables, as calculating the "marginal effect" makes little sense for them. In this function, we calculate the discrete effect by changing the explanatory variable from its minimum to its maximum. For a binary variable, this is just the difference between 0 and 1. Similar to the marginal effect case, we also have discrete effect at the mean (DEM), corresponding to marg.type= atmean and average dscrete effect (ADE), corresponding to marg.type=aveacr.

Standard error is provided for the effects by using Krinsky-Robb(KR) method. Krinsky-Robb is a simulation-based method that calculates the empirical value of a function given a known distribution of its variables. Here we provide Krinsky-Robb standard error for MEM and DEM, and the user can specify how many times of simulation R should the Krinsky-Robb algorithm run.

The user can also specify a subset of explanatory variables when calculating effects. This is done through specifying string vectors containing the column names of the explanatory variables to varlist. As the KR standard error can be time-consuming, it is advised to calculate only the variables in need.

Value

The function returns an object of class "fmlogit.margins". It contains the following component:

effects A matrix of calculated effects.

se A matrix of standard errors corresponding to the effects. Shows up if se=T for the input parameter.

ztable A list of matrices containing effects, standard errors, z-stats and p-values.

R Number of simulation times for Krinsky-Robb standard error calculation. Null if se=F.

expl String message explaining the effects calculated.

Examples

#results1 = fmlogit(y,X)
effects(results1,effect="marginal")
effects(results1,effect="discrete",varlist = colnames(object$X)[c(1,3)])

f1kidd/fmlogit documentation built on June 26, 2022, 4:33 p.m.