effect: Get average marginal effects for heterokedastic binary models...

View source: R/effects.R

effectR Documentation

Get average marginal effects for heterokedastic binary models and IV probit models

Description

Obtain the average marginal effects from hetprob or ivpml class models.

Usage

effect(object, ...)

Arguments

object

an object of class hetprob or ivpml.

...

Additional arguments to be passed.

Value

Estimates of the average marginal effects computed as the average for each individual.

Examples


# Data
library("AER")
data("PSID1976")
PSID1976$lfp  <- as.numeric(PSID1976$participation == "yes")
PSID1976$kids <- with(PSID1976, factor((youngkids + oldkids) > 0,
                                      levels = c(FALSE, TRUE), 
                                      labels = c("no", "yes")))
PSID1976$finc <-  PSID1976$fincome / 10000
                                 
# Average marginal effects for heteroskedastic Probit model
labor_het <- hetprob(lfp ~  age + I(age^2) + finc + education + factor(kids) | 
                            factor(kids) + finc,              
                     data = PSID1976,                        
                     link = "probit")
eff_labor_het <- effect(labor_het)
summary(eff_labor_het)

# Average marginal effects for IV probit model 
# (nwincome is endogenous and heducation is the additional instrument)
PSID1976$nwincome <- with(PSID1976, (fincome - hours * wage)/1000)
fiml.probit <- ivpml(lfp ~  education + experience + I(experience^2) + age + 
                            youngkids + oldkids + nwincome |
                            education + experience + I(experience^2) + age + 
                            youngkids + oldkids + heducation, 
                     data = PSID1976)
summary(effect(fiml.probit))
summary(effect(fiml.probit, asf = FALSE))


Rchoice documentation built on March 31, 2023, 11:13 p.m.