maBina: Marginal Effect for Binary Probit and Logit Model

View source: R/maBina.r

maBinaR Documentation

Marginal Effect for Binary Probit and Logit Model

Description

This function calculates marginal effects for a binary probit or logit model and their standard errors.

Usage

maBina(w, x.mean = TRUE, rev.dum = TRUE, digits = 3, 
  subset.name = NULL, subset.value)

Arguments

w

a binary probit or logit model object estimated from glm().

x.mean

a logical value (default of TRUE) of whether to calculate marginal effects at the means of independent variables. If FALSE, marginal effects are calculated for each observation and then averaged.

rev.dum

a logical value (default of TRUE) of whether to revise the estimates and standard erros for binary independant variables. If FALSE, derivatives are taken on binary independant variables as continuous variables.

digits

number of digits for output.

subset.name

a variable name for subsetting the data (e.g., a dummy variable).

subset.value

if subset.name is not NULL, this value is used to subset the data set for the variable specified in subset.name.

Details

Marginal effects from a binary probit or logit model is calculated. The two choices are the method of averaging effects and revising estimates for dummy variables. Marginal effects can be calculated at the mean of the independent variables (i.e., x.mean = TRUE), or as the average of individual marginal effects at each observation (i.e., x.mean = FALSE). rev.dum = TRUE allows marginal effects for dummy variables are calculated differently, instead of treating them as continuous variables.

In addition, the data set used for calculating the marginal effect can be the whole data set, or a subsect of the whole data set. In subsetting the data, a variable name and its value should be supplied. This is generally applied on a dummy variable, as shown in the example.

Value

Return a list object of class "maBina" with the following components:

link

link function used in the binary model;

f.xb

scale factor of marginal effects, calculated as the density function evaluated at the means of the variables when x.mean = TRUE is specified or the average density value for all individual observations when x.mean = FALSE is specified;

w

a binary probit or logit model object estimated from glm();

x

the data set used in computing marginal effects.

out

a data frame object of marginal effects, t-value, and p-value.

Methods

One method is defined as follows:

print:

print the key output of marginal effects.

Author(s)

Changyou Sun (edwinsun258@gmail.com)

References

Greene, W.H. 2003. Econometric Analysis (5th ed.). Prentice Hall, New York. 1026 P.

See Also

maTrend; plot.maTrend.

Examples

data(daPe)
ma <- glm(grade ~ gpa + tuce + psi, x = TRUE, 
    data = daPe, family = binomial(link = "probit"))
    
ea <- maBina(w = ma, x.mean = TRUE, rev.dum = TRUE)
eb <- maBina(w = ma, x.mean = TRUE, rev.dum = TRUE, 
  subset.name = "psi", subset.value = 0) 
ec <- maBina(w = ma, x.mean = TRUE, rev.dum = TRUE,
  subset.name = "psi", subset.value = 1)
ea; eb; ec
eb$x; ec$x

erer documentation built on Sept. 26, 2024, 5:06 p.m.