heckmanGE: A Package for Fitting Sample Selection Models
Source:R/data.R
, R/heckmanGE.R
heckmanGE.Rd
This package provides functions for fitting sample selection models, specifically the Heckman-Ge model. It includes functionality for specifying selection and outcome equations, as well as adjusting parameters for dispersion and correlation.
Estimates the parameters of the Generalized Heckman model
Usage
heckmanGE(
selection,
outcome,
dispersion,
correlation,
data = sys.frame(sys.parent()),
weights = NULL,
cluster = NULL,
start = NULL
)
Arguments
- selection
A formula. Selection equation.
- outcome
A formula. Outcome Equation.
- dispersion
A right-handed formula. The equation for fitting of the Dispersion Parameter.
- correlation
A right-handed formula. The equation for fitting of the Correlation Parameter.
- data
A data.frame.
- weights
an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector.
- cluster
a variable indicating the clustering of observations, a list (or data.frame) thereof, or a formula specifying which variables from the fitted model should be used. See documentation for sandwich::vcovCL. A formula or list specifying the clusters for robust standard errors. Clustering adjusts the standard errors by accounting for correlations within clusters.
- start
Optional. A numeric vector with the initial values for the parameters.
Value
A list of results from the fitted model, including parameter estimates, the Hessian matrix, number of observations, and other relevant statistics. If initial values are not provided, the function estimates them using the Heckman two-step method.
A list containing:
- call
The matched function call.
- coefficients
Estimated coefficients for the selection, outcome, dispersion, and correlation equations.
- vcov
The covariance matrix of the estimated coefficients.
- logLik
The log-likelihood of the fitted model.
- model.frames
List of model frames for each equation (selection, outcome, dispersion, and correlation).
- fitted.values
Fitted values of the outcome equation.
Details
Optimized Function for fitting the Generalized Heckman Model
(original version: package ssmodels. Modified by Rogerio Barbosa)
The heckmanGE() function fits a generalization of the Heckman sample
selection model, allowing sample selection bias and dispersion parameters
to depend on covariates.
The heckmanGE()
function fits a generalization of the Heckman sample
selection model, and is compatible with robust variance-covariance estimation
using packages such as sandwich. In particular, the
vcovCL
function can be used for clustering, which
adjusts the standard errors by accounting for intra-cluster correlations in the data.
See also
vcovCL
for computing robust standard errors with clustering.
The function is compatible with the sandwich package for estimating
heteroskedasticity-consistent and cluster-robust standard errors.
This can be useful for adjusting the standard errors when dealing with grouped
or clustered data. For more details, see the documentation for
vcovCL
.
Examples
data(MEPS2001)
selectEq <- dambexp ~ age + female + educ + blhisp + totchr + ins + income
outcomeEq <- lnambx ~ age + female + educ + blhisp + totchr + ins
dispersion <- ~ age + female + totchr + ins
correlation <- ~ age
fit <- heckmanGE(selection = selectEq,
outcome = outcomeEq,
dispersion = dispersion,
correlation = correlation,
data = MEPS2001)
#> Error in eval(mfS): object 'selectEq' not found
summary(fit)
#> Error: object 'fit' not found