Package 'ssmrob'

Title: Robust Estimation and Inference in Sample Selection Models
Description: Package provides a set of tools for robust estimation and inference for models with sample selectivity and endogenous treatment model. For details, see Zhelonkin and Ronchetti (2021) <doi:10.18637/jss.v099.i04>.
Authors: Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti
Maintainer: Mikhail Zhelonkin <[email protected]>
License: GPL-2
Version: 1.0
Built: 2024-12-17 06:55:18 UTC
Source: CRAN

Help Index


Robust Estimation and Inference in Sample Selection Models

Description

Package provides a set of tools for robust estimation and inference for models with sample selectivity and endogenous treatment model.

Details

Package: ssmrob
Type: Package
Version: 1.0
Date: 2021-08-18
License: GPL-2

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

Maintainer: Mikhail Zhelonkin <[email protected]>

References

Heckman, J.J. (1979) Sample Selection Bias as a Specification Error. Econometrica, 47, p. 153-161.

Zhelonkin, M., Genton M.G., and Ronchetti, E. (2016) Robust Inference in Sample Selection Models. Journal of the Royal Statistical Society, Series B, 78, p. 805-827. doi:10.1111/rssb.12136

Zhelonkin, M., Ronchetti, E. (2021) Robust Analysis of Sample Selection Models through the R Package ssmrob. Journal of Statistical Software, 99, 4, p. 1-35. doi:10.18637/jss.v099.i04

See Also

ssmrob, etregrob, heckitrob, heckit5rob, selection

Examples

# Zhelonkin, Genton, Ronchetti (2016): page 823
data(MEPS2001)
selectEq <- dambexp ~ age + female + educ + blhisp + totchr + ins
outcomeEq <- lnambx ~ age + female + educ + blhisp + totchr + ins
meps.fit <- ssmrob(selectEq, outcomeEq, data = MEPS2001, control = heckitrob.control(tcc = 3.2))
summary(meps.fit)

Extract Coefficients from Robust Endogenous Treatment Model Fit

Description

Returns the coefficients of the robust two-stage estimator for endogentous treatment model.

Usage

## S3 method for class 'etregrob'
coef(object, ...)

Arguments

object

object of class "etregrob"

...

currently not used

Value

Returns a list of two vectors of parameters of two stages.

S

coefficients of the selection equation.

O

coefficients of the outcome equation.

Author(s)

Mikhail Zhelonkin


Extract Coefficients from Robust Sample Selection Model Fit

Description

Returns the coefficients of the robust two-stage estimator for simple Heckman's selection model or switching regression model.

Usage

## S3 method for class 'heckit5rob'
coef(object, ...)

Arguments

object

object of class "heckitrob" or "heckit5rob"

...

currently not used

Value

Returns a list of two (censored) or three (switching) vectors of parameters of two stages.

S

coefficients of the selection equation.

O

coefficients of the outcome equation(s).

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Extract Coefficients from Robust Sample Selection Model Fit

Description

Returns the coefficients of the robust two-stage estimator for simple Heckman's selection model or switching regression model.

Usage

## S3 method for class 'heckitrob'
coef(object, ...)

Arguments

object

object of class "heckitrob" or "heckit5rob"

...

currently not used

Value

Returns a list of two (censored) or three (switching) vectors of parameters of two stages.

S

coefficients of the selection equation.

O

coefficients of the outcome equation(s).

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Inverse Mills Ratio Derivative

Description

Computes a derivative of the inverse Mills ratio with respect to the parameter vector.

Usage

dLambdadSM(x, beta)

Arguments

x

vector of exogenous variables

beta

vector of parameters

Details

This function is necessary for computation of the asymptotic variance. In case of switching regressions the inverse Mills ratio term is different, and its derivative is computed in function dLambdadSM5. It can be also used to compute the influence function of the two-stage estimator.

Value

The gradient of the inverse Mills ratio is returned as a vector

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Zhelonkin, M., Genton M.G., and Ronchetti, E. (2016) Robust Inference in Sample Selection Models. Journal of the Royal Statistical Society, Series B, 78, p. 805-827.


Inverse Mills Ratio Derivative

Description

Computes a derivative of the inverse Mills ratio with respect to the parameter vector.

Usage

dLambdadSM5(x, beta)

Arguments

x

vector of exogenous variables

beta

vector of parameters

Details

This function is necessary for computation of the asymptotic variance. In case of switching regressions the inverse Mills ratio term is different, and its derivative is computed in function dLambdadSM5. It can also be used to compute the influence function of the two-stage estimator.

Value

The gradient of the inverse Mills ratio is returned as a vector

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Zhelonkin, M., Genton M.G., and Ronchetti, E. (2016) Robust Inference in Sample Selection Models. Journal of the Royal Statistical Society, Series B, 78, p. 805-827.


Variance Covariance Matrix

Description

Computation of the asymptotic variance matrix of the robust Heckman's two-stage estimator for endogenous treatment model.

Usage

etreg2steprobVcov(y1vec, y2vec, x1Matr, x2Matr, eststage1, eststage2, eststage2sigma, 
				  weights = rep(1, nrow(y1vec)), t.c = 1.345)

Arguments

y1vec

vector of endogenous variables of the selection stage

y2vec

vector of endogenous variables of the outcome stage

x1Matr

matrix of exogenous variables of the selection stage

x2Matr

matrix of exogenous variables of the outcome stage

eststage1

object of class "glmrob", corresponding to the robust probit fit

eststage2

vector of the coefficients of the outcome stage

eststage2sigma

the robust scale estimate of the second stage regression

weights

robustness weights

t.c

tuning constant of the second stage

Details

The computation is made using the Huber (1967) - White (1980) sandwich estimator. In the computation of leverage weights the lambda's are assumed to be fixed.

Value

Variance covariance matrix of the second stage estimator

Author(s)

Mikhail Zhelonkin

References

Huber, P.J. (1967) The Behavior of Maximum Likelihood Estimates under Nonstandard Conditions. Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability; L.M. LeCam, J. Neyman (Eds.), Berkeley: University of California Press, p. 221-233.

White, H.J. (1980) A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity. Econometrica, 48, p. 817-838.


Robust Fit of Endogenous Treatment Model

Description

Fits the endogenous treatment model using a robust two-stage estimator

Usage

etregrob(selection, outcome, data, control = heckitrob.control())

Arguments

selection

formula, the selection equation

outcome

formula, the outcome equation

data

an optional data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which etregrob is called.

control

a list of parameters for controlling the fitting process. The same list as for sample selection model

Details

Compute robust two-step estimates of the Endogenous Treatment Model. The robust probit is fitted in the first stage. In the second stage the Mallows type M-estimator is used instead of traditional OLS. The correction for endogeneity is made by means of control function, which is the inverse Mills ratio for a complete sample (see Maddala, 1983, p. 120-122). The values of the tuning constants and the robustness weights can be modified in heckitrob.control.

Value

Object of class "etregrob".

coefficients

a named vector of coefficients

stage1

object of class glmrob that contains robust probit fit

stage2

object of class rlm that contains second stage robust fit. Note that the standard errors in this object are biased, since they are not corrected for the uncertainty in the first estimation step. Use vcov below

vcov

variance matrix of the second stage

sigma

the standard error of the error term of the outcome equation

CIMR

inverse Mills ratio for the complete sample

call

the matched call

method

method of estimation, currently only "robust two-stage" is implemented

converged

logical. Did all the estimators converge?

iterations

list containing the numbers of iterations

Note

The treatment variable is automatically included in the formula for the second estimation step, i.e. one should not add the dependent variable from the selection equation in the formula of the outcome equation.

Author(s)

Mikhail Zhelonkin

References

Maddala G.S. (1983) Limited-Dependent and Qualitative Variables in Econometrics. Cambridge: Cambridge University Press.

Zhelonkin, M., Ronchetti, E. (2021) Robust Analysis of Sample Selection Models through the R Package ssmrob. Journal of Statistical Software, 99, 4, p. 1-35. doi:10.18637/jss.v099.i04

See Also

glmrob, rlm, ssmrob, heckitrob.control

Examples

library(mvtnorm)
set.seed(2)
N <- 3000
beta1 <- c(1.0, 1.0, 0.75)
beta2 <- c(1.5, 1.0, 0.5)
alpha <- 1.25
x1 <- rmvnorm(N, mean = c(0, -1, 1), sigma = diag(c(1, 0.5, 1)))
x2 <- x1 
x2[, 3] <- rnorm(N, 1, 1)
eps <- rmvnorm(N, mean = rep(0, 2), sigma = matrix(c(1, -0.7, -0.7, 1), 2, 2))
x1beta1 <- x1[, 1]*beta1[1] + x1[, 2]*beta1[2] + x1[, 3]*beta1[3]
x2beta2 <- x2[, 1]*beta2[1] + x2[, 2]*beta2[2] + x2[, 3]*beta2[3]
y1 <- ifelse(x1beta1 + eps[, 1] > 0, 1, 0)
y2 <- x2beta2 + alpha*y1 + eps[,2]
etm.ctrl <- heckitrob.control(weights.x1 = "hat", weights.x2 = "covMcd")
etmsim.fit <- etregrob(y1 ~ x1, y2 ~ x2, control = etm.ctrl)
summary(etmsim.fit)

Fitted values of endogenous treatment model

Description

Calculate the fitted values of the endogenous treatment model using robust fit.

Usage

## S3 method for class 'etregrob'
fitted(object, ...)

Arguments

object

object of class "etregrob"

...

currently not used

Value

vector of fitted values

Author(s)

Mikhail Zhelonkin


Fitted values of robust sample selection model

Description

Calculate the fitted values of the sample selection model using robust fit.

Usage

## S3 method for class 'heckit5rob'
fitted(object, ...)

Arguments

object

object of class "heckitrob" or object of class "heckit5rob"

...

currently not used

Details

In case of truncated selection model one vector of fitted values is returned. In case of switching regression model a list, that contains two vectors corresponding to two regimes, is returned.

Value

vector of fitted values or a list that contains two vectors of fitted values

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Fitted values of robust sample selection model

Description

Calculate the fitted values of the sample selection model using robust fit.

Usage

## S3 method for class 'heckitrob'
fitted(object, ...)

Arguments

object

object of class "heckitrob" or object of class "heckit5rob"

...

currently not used

Details

In case of truncated selection model one vector of fitted values is returned. In case of switching regression model a list, that contains two vectors corresponding to two regimes, is returned.

Value

vector of fitted values or a list that contains two vectors of fitted values

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Variance Covariance Matrix

Description

Computation of the asymptotic variance matrix of the robust Heckman's two-stage estimator for truncated selection model.

Usage

heck2steprobVcov(y1vec, y2vec, x1Matr, x2Matr, eststage1, eststage2, 
                 eststage2sigma, weights = rep(1,nrow(y1vec)), t.c = 1.345)

Arguments

y1vec

vector of endogenous variables of the selection stage

y2vec

vector of endogenous variables of the outcome stage

x1Matr

matrix of exogenous variables of the selection stage

x2Matr

matrix of exogenous variables of the outcome stage

eststage1

object of class "glmrob", corresponding to the robust probit fit

eststage2

vector of the coefficients of the outcome stage

eststage2sigma

the robust scale estimate of the second stage regression

weights

vector of robustness weights

t.c

tuning constant of the second stage

Details

The computation is made using the Huber (1967) - White (1980) sandwich estimator with Heckman (1979) correction. In the computation of leverage weights the lambda's are assumed to be fixed.

Value

Variance covariance matrix of the second stage estimator

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Heckman, J.J. (1979) Sample Selection Bias as a Specification Error. Econometrica, 47, p. 153-161.

Huber, P.J. (1967) The Behavior of Maximum Likelihood Estimates under Nonstandard Conditions. Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability; L.M. LeCam, J. Neyman (Eds.), Berkeley: University of California Press, p. 221-233.

White, H.J. (1980) A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity. Econometrica, 48, p. 817-838.

See Also

glmrob


Variance Covariance Matrix

Description

Computation of the asymptotic variance matrix of the robust Heckman's two-stage estimator for the second regime of switching regression model, i.e. when y1=0y_1=0.

Usage

heck5twosteprobVcov(y1vec, y2vec, x1Matr, x2Matr, eststage1, eststage2, 
                    eststage2sigma, weights = rep(1,nrow(y1vec)), t.c = 1.345)

Arguments

y1vec

vector of endogenous variables of the selection stage

y2vec

vector of endogenous variables of the outcome stage

x1Matr

matrix of exogenous variables of the selection stage

x2Matr

matrix of exogenous variables of the outcome stage

eststage1

object of class "glmrob", corresponding to the robust probit fit

eststage2

vector of the coefficients of the outcome stage

eststage2sigma

the robust scale estimate of the second stage regression

weights

vector of robustness weights

t.c

tuning constant of the second stage

Details

The computation is made using the Huber (1967) - White (1980) sandwich estimator with Heckman (1979) correction. In the computation of leverage weights the λ\lambda's are assumed to be fixed.

Value

Variance covariance matrix of the second stage estimator

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Amemiya, T. (1984) Tobit Models: a Survey. Journal of Econometrics, 24, p. 3-61.

Heckman, J.J. (1979) Sample Selection Bias as a Specification Error. Econometrica, 47, p. 153-161.

Huber, P.J. (1967) The Behavior of Maximum Likelihood Estimates under Nonstandard Conditions. Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability; L.M. LeCam, J. Neyman (Eds.), Berkeley: University of California Press, p. 221-233.

White, H.J. (1980) A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity. Econometrica, 48, p. 817-838.


Robust Heckit Fit: Switching Regressions

Description

Fits the switching regression model with probit selection using a robust two-stage estimator

Usage

heckit5rob(selection, outcome1, outcome2, data, control = heckitrob.control())

Arguments

selection

formula, the selection equation

outcome1

formula, first outcome equation

outcome2

formula, second outcome equation

data

an optional data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which heckit5rob is called.

control

a list of parameters for controlling the fitting process

Details

Compute robust two-stage extimates of the switching regression model with probit selection. The robust probit is fitted in the first stage. In the second stage the Mallows type M-estimators are used. The values of the tuning constants and the robustness weights can be modified in heckitrob.control.

Value

Object of class "heckit5rob".

coefficients

a named vector of coefficients

stage1

object of class glmrob that contains (first stage) robust probit fit

stage21

object of class rlm that contains second stage first regime robust fit. Note that the standard errors in this object are biased, since they are not corrected for the uncertainty in the first estimation step. Use vcov1 below

stage22

object of class rlm that contains second stage second regime robust fit. Note that the standard errors in this object are biased, since they are not corrected for the uncertainty in the first estimation step. Use vcov2 below

vcov1

variance matrix of the second stage first regime

vcov2

variance matrix of the second stage second regime

sigma1

the standard error of the error term of the outcome equation when y_1=1

sigma2

the standard error of the error term of the outcome equation when y_1=0

IMR1

inverse Mills ratio for the case when y_1=1

IMR2

inverse Mills ratio for the case when y_1=0

call

the matched call

method

method of estimation, currently only "robust two-stage" is implemented

converged

logical. Did all the estimators converge?

iterations

list containing the numbers of iterations

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Heckman, J.J. (1979) Sample Selection Bias as a Specification Error. Econometrica, 47, p. 153-161.

Zhelonkin, M., Genton M.G., and Ronchetti, E. (2016) Robust Inference in Sample Selection Models. Journal of the Royal Statistical Society, Series B, 78, p. 805-827. doi:10.1111/rssb.12136

Zhelonkin, M., Ronchetti, E. (2021) Robust Analysis of Sample Selection Models through the R Package ssmrob. Journal of Statistical Software, 99, 4, p. 1-35. doi:10.18637/jss.v099.i04

See Also

glmrob, rlm, ssmrob, heckitrob, heckitrob.control

Examples

## Not run: 
library(mvtnorm)
set.seed(2)
N <- 5000
beta1 <- c(0, 1.0, 1.0, 0.75)
beta21 <- c(0, 1.5, 1.0, 0.5)
beta22 <- c(1, -1.5, 1.0, 0.5)
covm <- diag(3)
covm[lower.tri(covm)] <- c(0.75, 0.5, 0.25)
covm[upper.tri(covm)] <- covm[lower.tri(covm)]
eps <- rmvnorm(N, rep(0, 3), covm)
x1 <- rmvnorm(N, mean=c(0, -1, 1), sigma=diag(c(1, 0.5, 1)))
x21 <- x1 
x22 <- x1
x21[, 3] <- rnorm(N, 1, 1)
x22[, 3] <- rnorm(N, 1, 1)
x1beta1 <- beta1[1] + x1[, 1]*beta1[2] + x1[, 2]*beta1[3] + x1[, 3]*beta1[4]
x21beta21 <- beta21[1] + x21[, 1]*beta21[2] + x21[, 2]*beta21[3] + x21[, 3]*beta21[4]
x22beta22 <- beta22[1] + x22[, 1]*beta22[2] + x22[, 2]*beta22[3] + x22[, 3]*beta22[4]
y1 <- ifelse(x1beta1 + eps[, 1] > 0, 1, 0)
y2 <- ifelse(y1 > 0.5, x21beta21 + eps[, 2],
x22beta22 + eps[, 3])
srsim.fit <- ssmrob(y1 ~ x1, list(y2 ~ x21, y2 ~ x22), 
control = heckitrob.control(weights.x1 = "hat", weights.x2 = "covMcd"))
summary(srsim.fit)

## End(Not run)

Robust Heckit Fit

Description

Fits the sample selection model using a robust two-stage estimator

Usage

heckitrob(selection, outcome, data, control = heckitrob.control())

Arguments

selection

formula, the selection equation

outcome

formula, the outcome equation

data

an optional data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which heckitrob is called.

control

a list of parameters for controlling the fitting process

Details

Compute robust two-stage estimates of the Heckman's selection model. The robust probit is fitted in the first stage. In the second stage the Mallows type M-estimator is used. The values of the tuning constants and the robustness weights can be modified in heckitrob.control.

Value

Object of class "heckitrob".

coefficients

a named vector of coefficients

stage1

object of class glmrob that contains robust probit fit

stage2

object of class rlm that contains second stage robust fit. Note that the standard errors in this object are biased, since they are not corrected for the uncertainty in the first estimation step. Use vcov below

vcov

variance matrix of the second stage

sigma

the standard error of the error term of the outcome equation

IMR1

inverse Mills ratio for the case when y_1=1

call

the matched call

method

method of estimation, currently only "robust two-stage" is implemented

converged

logical. Did all the estimators converge?

iterations

list containing the numbers of iterations

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Cameron, C.A., Trivedi, P.K. (2009) Microeconometrics Using Stata. College Station, TX: Stata Press.

Heckman, J.J. (1979) Sample Selection Bias as a Specification Error. Econometrica, 47, p. 153-161.

Zhelonkin, M., Genton M.G., and Ronchetti, E. (2016) Robust Inference in Sample Selection Models. Journal of the Royal Statistical Society, Series B, 78, p. 805-827. doi:10.1111/rssb.12136

Zhelonkin, M., Ronchetti, E. (2021) Robust Analysis of Sample Selection Models through the R Package ssmrob. Journal of Statistical Software, 99, 4, p. 1-35. doi:10.18637/jss.v099.i04

See Also

glmrob, rlm, ssmrob, heckitrob.control, heckit5rob, etregrob

Examples

# Zhelonkin, Genton, Ronchetti (2016): page 823
data(MEPS2001)
selectEq <- dambexp ~ age + female + educ + blhisp + totchr + ins
outcomeEq <- lnambx ~ age + female + educ + blhisp + totchr + ins
meps.fit <- ssmrob(selectEq, outcomeEq, data = MEPS2001, control = heckitrob.control(tcc = 3.2))
summary(meps.fit)

Auxiliary for Controlling Robust Fitting

Description

Auxiliary function used for fitting the sample selection models. Contains control sequences, tuning constants and robustness weight functions.

Usage

heckitrob.control(acc = 1e-04, test.acc = "coef", maxit = 50, maxitO = 50, 
                               weights.x1 = c("none", "hat", "robCov", "covMcd"), 
                               weights.x2 = c("none", "hat", "robCov", "covMcd"),
                               tcc = 1.345, t.c = 1.345)

Arguments

acc

positive convergence level

test.acc

only "coef" is currently implemented

maxit

integer giving the maximum number of iterations: selection equation

maxitO

integer giving the maximum number of iterations: outcome equation

weights.x1

vector of robustness weights controlling for the leverage effect in the selection equation

weights.x2

vector of robustness weights controlling for the leverage effect in the outcome equation

tcc

tuning constant c for Huber's psi-function for the selection stage

t.c

tuning constant c for Huber's psi-function for the outcome stage

Value

A list with the arguments as components.

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Ambulatory Expenditures Data

Description

The dataset is an extract from the Medical Expenditures Panel Survey. Sample of 3328 observations, with 526 zero expenditures. It was used for illustrative examples by Cameron and Trivedi (2009, Chapter 16).

Usage

data(MEPS2001)

Format

A data frame with 3328 observations on the following 12 variables.

educ

Educational attainment, in years.

age

Age.

income

Income.

female

Logical, TRUE if female.

totchr

Number of chronic diseases.

age2

Age squared

ambexp

Ambulatory expenditures.

lambexp

Log ambulatory expenditures.

blhisp

Ethnicity. Logical, TRUE if black or hispanic.

dambexp

Logical, TRUE if the ambulatory expenditures are greater than zero.

lnambx

Log ambulatory expenditures, with zeros replacing NA's.

ins

Insurance status. Logical, TRUE if insured.

Source

2001 Medical Expenditure Panel Survey by the Agency for Healthcare Research and Quality.

References

Cameron, C.A. and Trivedi, P.K. (2009) Microeconometrics Using Stata, College Station, TX: Stata Press.

Examples

data(MEPS2001)
summary(MEPS2001)

M Matrix

Description

M matrix of a linear regression M-estimator of Mallows type.

Usage

MmatrM(x, y, beta, sigma, t.c = 1.345, weights = 1)

Arguments

x

matrix of explanatory variables

y

vector of dependent variables

beta

vector of parameters

sigma

robust scale estimate

t.c

tuning constant c for Huber's psi-function

weights

vector of robustness weights controlling for the leverage effects

Details

Computes the M matrix of the M-estimator of Mallows type. In current implementation only the Huber score function is available.

Value

M matrix for the sandwich formula.

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Design Matrix of Endogenous Treatment Model

Description

Create design matrix of endogenous treatment model

Usage

## S3 method for class 'etregrob'
model.matrix(object, part = "outcome", ...)

Arguments

object

object of class etregrob

part

character string indicating which matrix to extract: "outcome" for the outcome equation, "selection" for the selection equation.

...

currently not used

Value

If argument part is "outcome", the design matrix of the outcome equation is returned.

If argument part is "selection", the design matrix of the selection equation is returned.

Author(s)

Mikhail Zhelonkin


Design Matrix of Switching Regression Model

Description

Create design matrix of switching regression model

Usage

## S3 method for class 'heckit5rob'
model.matrix(object, part = "outcome", ...)

Arguments

object

object of class heckit5rob

part

character string indicating which matrix to extract: "outcome" for the outcome equations, "selection" for the selection equation.

...

currently not used

Value

If argument part is "outcome", the list containing design matrices of the outcome equations is returned.

stage21

design matrix for the first regime

stage22

design matrix for the second regime

If argument part is "selection", the design matrix of the selection equation is returned.

Author(s)

Mikhail Zhelonkin


Design Matrix of Sample Selection Model

Description

Create design matrix of sample selection model

Usage

## S3 method for class 'heckitrob'
model.matrix(object, part = "outcome", ...)

Arguments

object

object of class heckitrob

part

character string indicating which matrix to extract: "outcome" for the outcome equation, "selection" for the selection equation.

...

currently not used

Value

If argument part is "outcome", the design matrix of the outcome equation is returned.

If argument part is "selection", the design matrix of the selection equation is returned.

Author(s)

Mikhail Zhelonkin


Wage Offer Data

Description

Sample of 753 observations, with 325 truncated observations.

Usage

data(MROZ.RAW)

Format

A data frame with 753 observations on the following 22 variables.

inlf

Logical, TRUE if in labor force.

hours

Hours worked by wife in 1975.

kidslt6

Number of young children, 5 year or younger.

kidsge6

Number of children greater than 6 years of age.

age

Wife's age.

educ

Education level in years.

wage

Average hourly earnings in 1975.

repwage

Wife's wage reported at the time of the 1976 interview.

hushrs

Husband's hours worked in 1975.

husage

Husband's age.

huseduc

Husband's education in years.

huswage

Husband's wage in 1975.

faminc

Family income in 1975.

mtr

Marginal tax rate facing the wife.

motheduc

Wife's mother's education in years.

fatheduc

Wife's father's education in years.

unem

Unemployment rate in county of residence.

city

Logical, TRUE if live in large city.

exper

Wife's labor market experience in years.

nwifeinc

Non-wife income, households's total money minus wife's labor income.

lwage

Wife's log-wage.

expersq

Wife's squared experience.

References

Mroz , T.A. (1987) The Sensitivity of an Empirical Model of Married Women's Hours of Work to Economic and Statistical Assumptions. Econometrica, 55, p. 765-799.

Wooldridge, J.M. (2002) Econometric Analysis of Cross Section and Panel Data, Cambridge MA: MIT Press.

Examples

data(MROZ.RAW)
summary(MROZ.RAW)

Number of Observations

Description

Number of observations

Usage

## S3 method for class 'heckitrob'
nobs(object, ...)

Arguments

object

object of class heckitrob, or heckit5rob or etregrob

...

currently not used

Author(s)

Mikhail Zhelonkin


Print a etregrob Object

Description

Print an object generated by etregrob

Usage

## S3 method for class 'etregrob'
print(x, digits = 4, ...)

Arguments

x

object of etregrob class

digits

number of significant digits to be printed

...

currently not used

Author(s)

Mikhail Zhelonkin

See Also

etregrob


Print a heckit5rob Object

Description

Print an object generated by ssmrob

Usage

## S3 method for class 'heckit5rob'
print(x, digits = 4, ...)

Arguments

x

object returned from the heckit5rob representing the fit of the model

digits

number of significant digits to be printed

...

currently not used

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

ssmrob


Print a heckitrob Object

Description

Print an object generated by ssmrob

Usage

## S3 method for class 'heckitrob'
print(x, digits = 4, ...)

Arguments

x

object returned from the heckitrob representing the fit of the model

digits

number of significant digits to be printed

...

currently not used

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

ssmrob


Print Function for summary.etregrob

Description

Print a summary.etregrob object

Usage

## S3 method for class 'summary.etregrob'
print(x, digits = 4, ...)

Arguments

x

Object of class summary.etregrob returned by a summary function

digits

number of nonzero digits after comma

...

currently not used

Author(s)

Mikhail Zhelonkin


Print Function for summary.heckit5rob

Description

Print a summary.heckit5rob object

Usage

## S3 method for class 'summary.heckit5rob'
print(x, digits = 4, ...)

Arguments

x

Object of class summary.heckit5rob returned by a summary function

digits

number of nonzero digits after comma

...

currently not used

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Print Function for summary.heckitrob

Description

Print a summary.heckitrob object

Usage

## S3 method for class 'summary.heckitrob'
print(x, digits = 4, ...)

Arguments

x

Object of class summary.heckitrob returned by a summary function

digits

number of nonzero digits after comma

...

currently not used

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti


Score Function of the Mallows M-Estimator

Description

Score function of the Mallows-type M-estimator.

Usage

PsiMest(x, y, beta, sigma, t.c, weight)

Arguments

x

vector of exogenous variables

y

scalar endogenous variable

beta

parameter vector

sigma

std.error

t.c

tuning constant of Huber Psi-function

weight

scalar weight on the exogenous variables

Details

Can be used to compute the influence function of the estimator. Also can be used to approximate the bias of the estimator.

Value

score of the Psi-function

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Hampel, Ronchetti, Rousseeuw, Stahel (1986). Robust Statistics: The Approach Based on Influence Functions. New York: Wiley.


Residuals of Robust Endogenous Treatment Model Fit

Description

Calculate the residuals of theendogenous treatment model using robust fit.

Usage

## S3 method for class 'etregrob'
residuals(object, ...)

Arguments

object

object of class "etregrob"

...

currently not used

Value

numeric vector of residuals.

Author(s)

Mikhail Zhelonkin

See Also

etregrob


Residuals of Robust Sample Selection Model Fit

Description

Calculate the residuals of the sample selection model using robust fit.

Usage

## S3 method for class 'heckit5rob'
residuals(object, ...)

Arguments

object

object of class "heckitrob" or object of class "heckit5rob"

...

currently not used

Details

In case of truncated selection model one vector of residuals is returned. In case of switching regression model a list containing two vectors corresponding to two regimes is returned.

Value

The numeric vector(s) of the residuals.

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

heckitrob; heckit5rob


Residuals of Robust Sample Selection Model Fit

Description

Calculate the residuals of the sample selection model using robust fit.

Usage

## S3 method for class 'heckitrob'
residuals(object, ...)

Arguments

object

object of class "heckitrob" or object of class "heckit5rob"

...

currently not used

Details

In case of truncated selection model one vector of residuals is returned. In case of switching regression model a list containing two vectors corresponding to two regimes is returned.

Value

vector(s) of residuals.

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

heckitrob; heckit5rob


Robust Sample Selection Model

Description

Compute robust two-stage estimates of truncated selection model (Tobit-2) and switching regression model (Tobit-5).

Usage

ssmrob(selection, outcome, data, control = heckitrob.control())

Arguments

selection

formula, the selection equation

outcome

formula(s), the outcome equation(s)

data

an optional data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which ssmrob is called.

control

a list of parameters for controlling the fitting process

Details

Outcome equation may be a simple formula for the case of Heckman selection model, or a list of two formulas for the case of switching regressions.

Value

Object of class "heckitrob" or object of class "heckit5rob".

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

References

Amemiya, T. (1984) Tobit Models: a Survey. Journal of Econometrics, 24, p. 3-61.

Heckman, J.J. (1979) Sample Selection Bias as a Specification Error. Econometrica, 47, p. 153-161.

Zhelonkin, M., Genton M.G., and Ronchetti, E. (2016) Robust Inference in Sample Selection Models. Journal of the Royal Statistical Society, Series B, 78, p. 805-827. doi:10.1111/rssb.12136

Zhelonkin, M., Ronchetti, E. (2021) Robust Analysis of Sample Selection Models through the R Package ssmrob. Journal of Statistical Software, 99, 4, p. 1-35. doi:10.18637/jss.v099.i04

See Also

heckitrob, heckit5rob

Examples

# sample selection model (Tobit-2)
# Zhelonkin, Genton, Ronchetti (2016): page 823
data(MEPS2001)
selectEq <- dambexp ~ age + female + educ + blhisp + totchr + ins
outcomeEq <- lnambx ~ age + female + educ + blhisp + totchr + ins
meps.fit <- ssmrob(selectEq, outcomeEq, data = MEPS2001, control = heckitrob.control(tcc = 3.2))
summary(meps.fit)

# switching regressions example (Tobit-5)
## Not run: 
library(mvtnorm)
set.seed(2)
N <- 5000
beta1 <- c(0, 1.0, 1.0, 0.75)
beta21 <- c(0, 1.5, 1.0, 0.5)
beta22 <- c(1, -1.5, 1.0, 0.5)
covm <- diag(3)
covm[lower.tri(covm)] <- c(0.75, 0.5, 0.25)
covm[upper.tri(covm)] <- covm[lower.tri(covm)]
eps <- rmvnorm(N, rep(0, 3), covm)
x1 <- rmvnorm(N, mean=c(0, -1, 1), sigma=diag(c(1, 0.5, 1)))
x21 <- x1 
x22 <- x1
x21[, 3] <- rnorm(N, 1, 1)
x22[, 3] <- rnorm(N, 1, 1)
x1beta1 <- beta1[1] + x1[, 1]*beta1[2] + x1[, 2]*beta1[3] + x1[, 3]*beta1[4]
x21beta21 <- beta21[1] + x21[, 1]*beta21[2] + x21[, 2]*beta21[3] + x21[, 3]*beta21[4]
x22beta22 <- beta22[1] + x22[, 1]*beta22[2] + x22[, 2]*beta22[3] + x22[, 3]*beta22[4]
y1 <- ifelse(x1beta1 + eps[, 1] > 0, 1, 0)
y2 <- ifelse(y1 > 0.5, x21beta21 + eps[, 2],
x22beta22 + eps[, 3])
srsim.fit <- ssmrob(y1 ~ x1, list(y2 ~ x21, y2 ~ x22), 
control = heckitrob.control(weights.x1 = "hat", weights.x2 = "covMcd"))
summary(srsim.fit)

## End(Not run)

Summarizing Robust Fits of Endogenous Treatment Models

Description

Summarizes robust fit of endogenous treatment models.

Usage

## S3 method for class 'etregrob'
summary(object, ...)

Arguments

object

object of class "etregrob"

...

currently not used

Value

object of class "summary.etregrob"

Author(s)

Mikhail Zhelonkin

See Also

etregrob


Summarizing Robust Fits of Sample Selection Models

Description

Summarize robust fit of Heckman selection model.

Usage

## S3 method for class 'heckit5rob'
summary(object, ...)

Arguments

object

object of class "heckitrob" or "heckit5rob"

...

currently not used

Value

object of class "summary.heckitrob" or object of class "summary.heckit5rob"

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

heckitrob; heckit5rob; heck2steprobVcov; heck5twosteprobVcov


Summarizing Robust Fits of Sample Selection Models

Description

Summarize robust fit of Heckman selection model.

Usage

## S3 method for class 'heckitrob'
summary(object, ...)

Arguments

object

object of class "heckitrob" or "heckit5rob"

...

currently not used

Value

object of class "summary.heckitrob" or object of class "summary.heckit5rob"

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

heckitrob; heckit5rob; heck2steprobVcov; heck5twosteprobVcov


Extract Asymptotic Variance Covariance Matrix

Description

Extracts the variance covariance matrix of the robust endogenous treatment model fit

Usage

## S3 method for class 'etregrob'
vcov(object, ...)

Arguments

object

object of class "etregrob"

...

currently not used

Value

Variance covariance matrix of the second stage. Variance covariance matrix of the selection stage can be extracted using the vcov function for the probit estimator, e.g. vcov(etregrob.object$stage1).

Author(s)

Mikhail Zhelonkin

See Also

etreg2steprobVcov


Extract Asymptotic Variance Covariance Matrix

Description

Extract the variance covariance matrix of the robust sample selection model fit

Usage

## S3 method for class 'heckit5rob'
vcov(object, ...)

Arguments

object

object of class "heckitrob" or object of class "heckit5rob"

...

currently not used

Value

Variance covariance matrix of the second stage. Variance covariance matrix of the selection stage can be extracted using the vcov function for the probit estimator, e.g. vcov(heckitrob.object$stage1).

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

heck2steprobVcov


Extract Asymptotic Variance Covariance Matrix

Description

Extract the variance covariance matrix of the robust sample selection model fit

Usage

## S3 method for class 'heckitrob'
vcov(object, ...)

Arguments

object

object of class "heckitrob" or object of class "heckit5rob"

...

currently not used

Value

Variance covariance matrix of the second stage. Variance covariance matrix of the selection stage can be extracted using the vcov function for the probit estimator, e.g. vcov(heckitrob.object$stage1).

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

heck2steprobVcov


Robustness Weights

Description

Auxiliary function. Computation of the leverage weights based on robust Mahalanobis distance. For computation of location and scatter the MCD method is used.

Usage

x2weight.covMcd(xMat)

Arguments

xMat

matrix of explanatory variables

Value

vector of weights

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

cov.rob


Robustness Weights

Description

Auxiliary function. Computation of the leverage weights based on robust Mahalanobis distance. For computation of location and scatter the MVE method is used.

Usage

x2weight.robCov(xMat)

Arguments

xMat

matrix of explanatory variables

Value

vector of weights

Author(s)

Mikhail Zhelonkin, Marc G. Genton, Elvezio Ronchetti

See Also

cov.rob