Title: | Endogenous Switching Regression Models |
---|---|
Description: | Maximum likelihood estimation of endogenous switching regression models from Heckman (1979) <doi:10.2307/1912352> and estimation of treatment effects. |
Authors: | Bowen Chen [aut, cre], Seong Yun [ctb], Benjamin Gramig [ctb] |
Maintainer: | Bowen Chen <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.0 |
Built: | 2025-01-10 03:00:05 UTC |
Source: | https://github.com/cbw1243/endoswitch |
This R function provides estimates of original distribution parameters (sigma and rho) from the estimates of transformed distribution parameters using the delta method.
calcPar(Results)
calcPar(Results)
Results |
A maxLik object that is estimated by the |
A matrix that reports the estimates of original distribution parameters. sigma is standard deviation, and rho is correlation coefficient.
This is the main interface for the endoSwitch package to estimate the endogenous switching regression models (Heckman, 1979).
endoSwitch( data, OutcomeDep, SelectDep, OutcomeCov, SelectCov, Weight = NA, treatEffect = TRUE, method = "BFGS", start = NULL, verbose = FALSE, ... )
endoSwitch( data, OutcomeDep, SelectDep, OutcomeCov, SelectCov, Weight = NA, treatEffect = TRUE, method = "BFGS", start = NULL, verbose = FALSE, ... )
data |
a data frame. Data for running the regression analysis. |
OutcomeDep |
character. Dependent variable in the outcome equation. |
SelectDep |
character. Dependent variable in the Selection model. The variable must be binary (0 or 1). |
OutcomeCov |
character vector. Covariates in the outcome equation. |
SelectCov |
character vector. Covariates in the selection equation. |
Weight |
optional character. Name of the weight variable in the dataset, or NA (equal weight). |
treatEffect |
|
method |
character. Maximization method to be used. The default is "BFGS" (for Broyden-Fletcher-Goldfarb-Shanno).
Other methods can also be used. See |
start |
optional numeric vector. Used as initial values of parameters for maximization purpose. If NULL, the coefficient estimates from the two-stage estimation will be used. |
verbose |
TRUE/FALSE. Choose to show the status of optimization or not. |
... |
Other parameters to be passed to the selected maximization routine. See |
This function estimates the endogenous switching regression model using the full maximum likelihood estimation method. In this model, a selection equation sorts observation units over two different regimes (e.g., treated and not-treated, or adopter and non-adopter), and two outcome equations that determine the outcome. Estimation of the model relies on joint normality of the error terms in the three-equation system (the selection equation plus two outcome equations). The model is estimated by maximizing the joint likelihood function that is provided in Lokshin and Sajaia (2004).
The endoSwitch
uses the maxLik
function in the maxLik package to do the optimization. The function automatically
searches for starting values for maximization using the results from two-stage estimation following Maddala (1986, chapter 8).
Though not recommended, users may provide starting values manually. Assume that you have M variables (including the constant) in
the selection equation, and N variables (including the constant) in each outcome equation.
Then you need (M + 2*N + 4) starting values. The first M values are for the variables in the
selection equation (last value for the constant), followed by N values for the outcome equation for the non-treated individuals
(SelectDep = 0), and another N values for the outcome equation for the treated individuals (SelectDep = 1).
The last four values are: sigma in outcome equation for the non-treated, sigma in outcome equation for the treated,
rho in outcome equation for the non-treated, rho in outcome equation for the treated.
If treatEffect
= TRUE
, the endoSwitch
function will report average treatment effects (for the treated or untreated) as well as heterogeneity effects.
A detailed description of these effects is provided in Di Falco, Veronesi, and Yesuf (2011, p.837). If treatEffect
= FALSE
,
the endoSwitch
function will report expected outcome values in a list of two dataframes:
dataframe EYA1 reports actual (column EY1.A1) and counterfactual (column EY0.A1) expected outcome values for the treated;
dataframe EYA0 reports actual (column EY0.A0) and counterfactual (column EY1.A0) expected outcome values for the untreated.
A list containing three elements. The first element is an object of class "maxLik", which includes parameters
in the selection equation, parameters in the outcome equations, and the transformed distributional parameters (parameters are
transformed to faciliate maximization, as recommended by Lokshin and Sajaia (2004)). The second element contains the estimates of
original distributional parameters (transformed back via the delta method). The third element contains a table reporting
average treatment effects or a list of expected outcome values, depending on users' choice of treatEffect
.
Lokshin, Michael, and Roger B. Newson. “Impact of Interventions on Discrete Outcomes: Maximum Likelihood Estimation of the Binary Choice Models with Binary Endogenous Regressors.” Stata Journal 11, no. 3 (2011): 368–85.
Heckman, James J. “Sample Selection Bias as a Specification Error.” Econometrica 47, no. 1 (1979): 153–61. https://doi.org/10.2307/1912352.
Maddala, G. S. “Limited-Dependent and Qualitative Variables in Econometrics.” Cambridge Books. Cambridge University Press, 1986.
Di Falco, Salvatore, Marcella Veronesi, and Mahmud Yesuf. “Does Adaptation to Climate Change Provide Food Security? A Micro-Perspective from Ethiopia.” American Journal of Agricultural Economics 93, no. 3 (2011): 829–46. https://doi.org/10.1093/ajae/aar006.
Abdulai, Abdul Nafeo. “Impact of Conservation Agriculture Technology on Household Welfare in Zambia.” Agricultural Economics 47, no. 6 (2016): 729–41. https://doi.org/10.1111/agec.12269.
data(ImpactData) # Data are from Abdulai (2016) OutcomeDep <- 'Output' SelectDep <- 'CA' OutcomeCov <- c('Age') SelectCov <- c('Age', 'Perception') endoReg <- endoSwitch(ImpactData, OutcomeDep, SelectDep, OutcomeCov, SelectCov) summary(endoReg) # Summarize the regression results
data(ImpactData) # Data are from Abdulai (2016) OutcomeDep <- 'Output' SelectDep <- 'CA' OutcomeCov <- c('Age') SelectCov <- c('Age', 'Perception') endoReg <- endoSwitch(ImpactData, OutcomeDep, SelectDep, OutcomeCov, SelectCov) summary(endoReg) # Summarize the regression results
This function estimates the endogenous switching regression model via two-stage estimations (Maddala, 1986)
endoSwitch2Stage(data, OutcomeDep, SelectDep, OutcomeCov, SelectCov)
endoSwitch2Stage(data, OutcomeDep, SelectDep, OutcomeCov, SelectCov)
data |
a data frame. Data for running the regression analysis. |
OutcomeDep |
character. Dependent variable in the outcome equation. |
SelectDep |
character. Dependent variable in the Selection model. The variable must be binary (0 or 1). |
OutcomeCov |
character vector. Covariates in the outcome equation. |
SelectCov |
character vector. Covariates in the selection equation. |
The first stage uses a probit model to estimate the selection equation. The second stage uses ordinary least squares including the inverse mills ratios computed from the first stage estimation results to estimate the outcome equations.
A list containing regression results.
Maddala, G. S. “Limited-Dependent and Qualitative Variables in Econometrics.” Cambridge Books. Cambridge University Press, 1986.
data(ImpactData) OutcomeDep <- 'Output' SelectDep <- 'CA' OutcomeCov <- c('Age') SelectCov <- c('Age', 'Perception') Results <- endoSwitch2Stage(ImpactData, OutcomeDep, SelectDep, OutcomeCov, SelectCov) # First stage regression results summary(Results$FirstStageReg) # Second stage regression results -- non-adopter summary(Results$SecondStageReg.0) # Second stage regression results -- adopter summary(Results$SecondStageReg.1)
data(ImpactData) OutcomeDep <- 'Output' SelectDep <- 'CA' OutcomeCov <- c('Age') SelectCov <- c('Age', 'Perception') Results <- endoSwitch2Stage(ImpactData, OutcomeDep, SelectDep, OutcomeCov, SelectCov) # First stage regression results summary(Results$FirstStageReg) # Second stage regression results -- non-adopter summary(Results$SecondStageReg.0) # Second stage regression results -- adopter summary(Results$SecondStageReg.1)
A dataset on adoption of conservation agriculture in Zambia
data(ImpactData)
data(ImpactData)
An object of class data.table
(inherits from data.frame
) with 408 rows and 31 columns.
Abdulai, Abdul Nafeo. “Impact of Conservation Agriculture Technology on Household Welfare in Zambia.” Agricultural Economics 47, no. 6 (2016): 729–41. https://doi.org/10.1111/agec.12269.
Abdulai, Abdul Nafeo. “Impact of Conservation Agriculture Technology on Household Welfare in Zambia.” Agricultural Economics 47, no. 6 (2016): 729–41. https://doi.org/10.1111/agec.12269.
data(ImpactData) summary(ImpactData)
data(ImpactData) summary(ImpactData)
Summarize the endogenous switching regression results.
## S3 method for class 'endoSwitch' summary(object, ...)
## S3 method for class 'endoSwitch' summary(object, ...)
object |
Estimated endogenous switching regression model. |
... |
Other elements. |
A list containing the key regression results.
This function calculates average treatment effects and heterogeneity effects from an estimated endogenous switching regression model.
treatmentEffect( Results, data, OutcomeDep, SelectDep, OutcomeCov, SelectCov, treatEffect )
treatmentEffect( Results, data, OutcomeDep, SelectDep, OutcomeCov, SelectCov, treatEffect )
Results |
Estimated endogenous switching regression model. |
data |
a data frame. Data for running the regression analysis. |
OutcomeDep |
character. Dependent variable in the outcome equation. |
SelectDep |
character. Dependent variable in the Selection model. The variable must be binary (0 or 1). |
OutcomeCov |
character vector. Covariates in the outcome equation. |
SelectCov |
character vector. Covariates in the selection equation. |
treatEffect |
TRUE/FALSE. Show average treatment effects or expected outcome values. |
A table that reports the average treatment effects or a list of two tables reporting expected outcome values.