Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.
Rendered from LaTeX for readability, not typeset faithfully. Citation keys are highlighted; maths is left as source; figures, tables and equation environments are summarised rather than reproduced; unrecognised commands are greyed out so nothing is silently dropped. Email addresses are removed.
Quantile Regression under Limited Dependent Variable
abstractA new Stata command, ldvqreg, is developed to estimate quantile regression models for the cases of censored (with lower and/or upper censoring) and binary dependent variables. The estimators are implemented using a smoothed version of the quantile regression objective function. Simulation exercises show that it correctly estimates the parameters and it should be implemented instead of the available quantile regression methods when censoring is present. An empirical application to women's labor supply in Uruguay is considered.
Keywords: censoring, binary model, quantile regression.
JEL: C14, C24.
\onehalfspacing
Introduction
Quantile regression (QR) is an important method for modeling heterogeneous effects. It allows to study generalized regression models by focusing on the quantiles of the conditional distribution of an outcome variable, controlling for observable covariates.
Censoring is an important feature in applied models. Mean-based regression models are analyzed in many ways with respect to censoring and truncation of the dependent variable. Typical examples are the Tobit-type models (see e.g. tobit) and binary regression models (see e.g. logit and probit).
This paper provides an integrated command that allows to estimate censored quantile regression models. First, it considers lower and upper censoring by developing the counterpart of a mean-based Tobit model for QR. Censored QR has been studied in several papers, including to cite a few Powell84,Powell86, Buchinsky91, ChernozhukovHong02.
Second, it provides a model for semi-parametric binary regression. This has been studied in the seminal papers of Manski85,Manski91 and Kordas06 among others. These two options allow to apply QR models in a wide variety of frameworks where the dependent variable is affected.
The key characteristic of these estimators is that quantile models are invariant to monotone non-decreasing transformations. Thus the conditional effects of covariates can be recovered from the transformed model. Moreover, one important common feature is that the usual algorithm for QR involves linear programming (see for instance the qreg command and the related packages). Recent applications of QR emphasize that the estimators are improved in both asymptotics and numerical accuracy if the objective function is replaced by a smooth counterpart, see e.g. Horowitz92, Kordas06, Kaplan17 and dCGKL19. The proposed estimator follows this strategy.
Alternative procedures have been developed to accommodate for censoring in QR. sg153 (clad command) uses Buchinsky91 and BuchinskyHahn98 algorithm to compute QR with censoring. Baker13 uses Monte Carlo integration techniques to accomplish the same. Our command contributes to this list.
The remainder of the paper is organized as follows. Section (ref) presents the censored and binary QR models. Section (ref) summarizes the STATA command features. Section (ref) present numerical simulations and an empirical application to women's labor supply in Uruguay. Section (ref) concludes.
Limited dependent variable models in quantile regression
Consider the following conditional $\tau$-quantile model,
$$Q_{\tau}(y_{i}^{*}|\boldsymbol x_{i}) = \boldsymbol x_{i}'\boldsymbol\beta(\tau),$$
where $y_{i}^{*}$ is a latent unobservable variable and $x_{i}$ corresponds to observable covariates. Assume that we have another observable variable $y_{i} = h(y_{i}^{*})$, where $h(.)$ is a non-decreasing monotone transformation, which is defined as a censored variable. The main feature in these models is that we observe $y_i$ but not $y_i^*$. However, by a common characteristic in quantile models, the so-called the quantile invariance property implies that $Q_{\tau}[h(y^{*})|\boldsymbol x]=h[Q_{\tau}(y^{*}|\boldsymbol x)]$, then $Q_{\tau}[y|\boldsymbol x]=h[Q_{\tau}(y^{*}|\boldsymbol x)]=h[\boldsymbol x'\boldsymbol\beta(\tau)]$. That is, the observable variable quantile is a transformed version of the original linear model.
This model includes as particular cases the censored quantile regression and the binary dependent variable regression models. We study these two cases in the following sections.
Censored Quantile Regression
Consider the case where there is an upper censoring (at value $c_H$) and lower censoring (at value $c_L$, for $c_H>c_L$) of the dependent variable such that
equation[equation omitted — 183 chars of source]
For this case $y=h(y^{*}) = min[max(y^{*},c_L),c_H]$, which is a non-decreasing monotone transformation. This model supports the case of no or partial censoring if we consider $c_L=-\infty$ and /or $c_H=+\infty$.
Powell84,Powell86 proposes to estimate $\boldsymbol \beta(\tau)$ by
equation[equation omitted — 216 chars of source]
where $\rho_{\tau}(u)$ is the check function as in KoenkerBassett78. This is defined as the censored quantile regression (CQR) model.
Binary Quantile Regression
Consider now the case of a binary dependent variable model with
equation[equation omitted — 115 chars of source]
Note that this is also a non-decreasing monotone transformation of the dependent variable, $y=h(y^{*}) = 1(y^{*}>0)$. With this idea Manski75,Manski85 proposes a maximum score estimator based on:
equation[equation omitted — 216 chars of source]
which can be written as
equation[equation omitted — 213 chars of source]
This is defined as the binary quantile regression (BQR) model.
Smoothed Quantile Regression
Both, the censored and the binary cases, share a common feature. The theoretical formulation provides estimators with a proper characterization, identification and which are consistent and asymptotically normal (see the corresponding cited papers above). However, its numerical performance in applied cases is very poor. In particular, the maximization problem does not provide satisfactory numerical solutions in general. This is a common feature in some variants of QR models, and the consensus in the literature is to provide smooth objective functions alternatives.
For our purposes, Horowitz92 and Kordas06 propose to smooth the objective function by using
equation*[equation* omitted — 60 chars of source]
the integral of a kernel function with $h_n$ bandwidth instead of $I\{\boldsymbol{x}_{i}'\boldsymbol{b}\geq0\}$. This provides remarkable improvements in applied cases. Our proposed estimator follows this strategy. The smoothing function we use is the cumulative distribution of a Gaussian kernel.
Both in the case of censored and binary regression models we use the same heuristic rule for the choice of bandwidth: the same formula used by STATA to estimate densities with kernel functions. This is,
equation*[equation* omitted — 61 chars of source]
where $\hat{\sigma}_u$ is an estimate of the standard deviation of the latent variable conditional distribution.
In the case of censored data we use the $\hat{\sigma}_u$ estimated by the Tobit model, while in the case of the binary data we set $\hat{\sigma}_u=1$ (the usual normalization of this parameter in the Probit model).
Prediction of Censored Quantiles and Probabilities
An important issue in censored models is the appropriate prediction exercise.
Following Kordas06, for the BQR model, we consider the probability of $y=1$, which corresponds to $y^{*}>0$. This can be estimated by computing $\boldsymbol{x}'\boldsymbol{\beta}(U)>0$ where $U \sim U(0,1)$. Given that for the binary case $P(y=1|\boldsymbol{x})=E(y|\boldsymbol{x})$, then $P(y=1|\boldsymbol{x})=E[1(\boldsymbol{x}'\boldsymbol{\beta}(U)>0)|x]$. Therefore,
equation[equation omitted — 102 chars of source]
Then, this can be estimated by a grid of quantile indexes $\{\tau_{1},\tau_{2},...,\tau_{m}\}$ by computing
equation[equation omitted — 163 chars of source]
where $\boldsymbol{\hat{\beta}}(\tau)$ is the corresponding BQR estimator.
An smoothed version of (ref) replaces the indicator function by the integral of the kernel $K(.)$:
equation[equation omitted — 167 chars of source]
Equations (ref) and (ref) are used to compute the probability of censoring for the CQR model with $c_L \leq y \leq c_H$. Similar to the previous example we get
equation[equation omitted — 195 chars of source]
and
equation[equation omitted — 196 chars of source]
where $\boldsymbol{\hat{\beta}}(\tau)$ is the CQR coefficient estimate. The smoothed versions replace $I(.)$ by $K(.)$.
Finally, for the CQR model we can compute the prediction for a given censured quantile $\tau$ as
equation[equation omitted — 127 chars of source]
where $\boldsymbol{\hat{\beta}}(\tau)$ are the CQR estimates.
The ldvqreg syntax
In this section we present the syntax of the ldvqreg command.
Sintaxis
The command syntax is:
stsyntaxldvqreg
\depvar\
\optindepvars\
\optif\
\optin\
\optional{,
quantile(\num[\num[\num ...]])
ll(real)
ul(real)
reps(string)
qcen(string)
pcen(string)
p1(string)
bwidth(real)
pbwidth(real)
}
Options
ldvqreg supports the following options:
General:
quantile(\num) estimates \num quantile; default is quantile(50)
reps(\num) performs \num bootstrap replications; default is reps(50)
Censoring:
ll(\num) left-censoring limit
ul(\num) right-censoring limit
qcen(newvar) stores predicted censored quantiles in newvar q\num
pcen(newvar) stores censorship probability in newvar and newvar s (smoothed)
Binary data:
p1(newvar) stores probability of $depvar=1$ in newvar and newvar s (smoothed)
Smoothing:
bwidth(real) specifies the bandwidth to smooth the target function
pbwidth(real) specifies the bandwidth to smooth the predicted probabilities
If ll(\num) and ul(\num) are not specified and the dependent variable is a dummy variable (which is automatically checked), then the command runs a binary QR. If ll(\num) and ul(\num) are not specified but the dependent variable is not a dummy, then the command runs a smoothed QR model.
Saved results
ldvqreg stores the following results in \stcmd{e()}:
stresults\stresultsgroup{Scalars} \\
\stcmd{e(N)} & number of observations.\\
\stcmd{e(reps)} & number of replications.\\
\stcmd{e(bwidth)} & bandwidth.\\
\stresultsgroup{Macros} \\
\stcmd{e(title)} & Censored or Binary model.\\
\stcmd{e(vcetype)} & title used to label Std. Err.\\
\stcmd{e(properties)} & b V.\\
\stcmd{e(depvar)} & name of dependent variable.\\
\stresultsgroup{Matrices} \\
\stcmd{e(b)} & coefficients' vector.\\
\stcmd{e(V)} & bootstrap variance matrix.\\
\stresultsgroup{Functions} \\
\stcmd{e(sample)} & marks estimation sample.\\
Examples
Example 1: Simulations
Censoring
We start with a simple simulation to show that the Tobit model can be biased if the homogeneity of the conditional distribution is not satisfied. This can be achieved by a location-scale model, which is a typical model in QR to generate heterogeneity in the regression coefficients. In turn, this motivates the necessity of using CQR models rather than the mean-based Tobit.
stlog. set seed 321
. set obs 1000
number of observations (_N) was 0, now 1,000
.
. gen x = runiform()
. gen y = -1/3 + x + x*rnormal()/3
. gen y_c = max(y,0)
In this example the error term is standard Gaussian, but its interaction with x determines that it has conditional heteroscedasticity. Figure (ref) shows a scatter plot with the latent (unobserved variable) y (using points with an x) and the censored variable y c (with grey circles). The graph also has the OLS estimation of the relation between y and x (which is not feasible as we cannot observe the latent variable), the Tobit estimation that controls for lower censoring at $0$, which assumes homoscedasticity, and the median regression estimate using the CQR estimate with \texttt{ldvqreg} of \texttt{y\underlinec} on \texttt{x}, which is distribution free (i.e. it does not require to assume homoscedastic Gaussian errors as in the Tobit model).
figure[figure omitted — 162 chars of source]
Note that the Tobit estimator is clearly different from the true OLS estimate. Nevertheless, the line that corresponds to the CQR estimation is indeed close to the true line. Then, the CQR appears as a useful alternative to the Tobit model when the distributional requirements are not satisfied.
Consider now the following data generating process (DGP). We consider two cases, one with a homoscedastic error structure (heter==0) and another with heteroscedastic error structure (heter==1). The former model has that all the QR coefficients are the same across quantiles, i.e. $\beta(\tau)=\beta,\ \forall \tau$, while the second allows for heterogeneity across quantiles. The generated variable y has no censoring, and y c has lower (0) and upper (1) censoring.
stlog. drop _all
. set seed 321
. set obs 4000
number of observations (_N) was 0, now 4,000
.
. gen heter = (_n>_N/2)
.
. gen x = runiform()
. gen y = .
(4,000 missing values generated)
. replace y = x + rnormal()/3 if heter==0
(2,000 real changes made)
. replace y = x + (1+x)*rnormal()/3 if heter==1
(2,000 real changes made)
. gen y_c = min(max(y,0),1)
We will first compare the available command sqreg with the proposed command ldvqreg in the case where there is no censoring, i.e. without specifying ll(\#) and ul(\#) (thus the command assumes no censoring). This is done to evaluate if the smoothed implementation works. The results below show that the results are very similar, and thus ldvqreg works for the general case.
stlog. sqreg y x if heter==0 , q(20 50 80) reps(100)
(fitting base model)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Simultaneous quantile regression Number of obs = 2,000
bootstrap(100) SEs .20 Pseudo R2 = 0.2514
.50 Pseudo R2 = 0.2570
.80 Pseudo R2 = 0.2524
------------------------------------------------------------------------------
| Bootstrap
y | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
q20 |
x | 1.017471 .0315822 32.22 0.000 .9555336 1.079409
_cons | -.2881128 .0168678 -17.08 0.000 -.3211931 -.2550325
-------------+----------------------------------------------------------------
q50 |
x | 1.030221 .0391766 26.30 0.000 .9533901 1.107053
_cons | -.0148498 .0181692 -0.82 0.414 -.0504823 .0207828
-------------+----------------------------------------------------------------
q80 |
x | 1.092272 .0385613 28.33 0.000 1.016648 1.167897
_cons | .2442029 .0224929 10.86 0.000 .2000909 .2883149
------------------------------------------------------------------------------
. test [q20=q50=q80]: x
( 1) [q20]x - [q50]x = 0
( 2) [q20]x - [q80]x = 0
F( 2, 1998) = 1.70
Prob > F = 0.1837
. ldvqreg y x if heter==0 , q(20 50 80) reps(100)
(running cqr_est on estimation sample)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Censored quantile regression Number of obs = 2,000
Replications = 100
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q20 |
x | 1.009058 .0381342 26.46 0.000 .9343168 1.0838
_cons | -.2800764 .0225376 -12.43 0.000 -.3242492 -.2359036
-------------+----------------------------------------------------------------
q50 |
x | 1.041249 .0366032 28.45 0.000 .9695078 1.11299
_cons | -.0182596 .0212655 -0.86 0.391 -.0599391 .0234199
-------------+----------------------------------------------------------------
q80 |
x | 1.0884 .0344859 31.56 0.000 1.020809 1.155991
_cons | .2457266 .019879 12.36 0.000 .2067646 .2846887
------------------------------------------------------------------------------
. test [q20=q50=q80]: x
( 1) [q20]x - [q50]x = 0
( 2) [q20]x - [q80]x = 0
chi2( 2) = 3.23
Prob > chi2 = 0.1992
.
. sqreg y x if heter==1 , q(20 50 80) reps(100)
(fitting base model)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Simultaneous quantile regression Number of obs = 2,000
bootstrap(100) SEs .20 Pseudo R2 = 0.0922
.50 Pseudo R2 = 0.1363
.80 Pseudo R2 = 0.2003
------------------------------------------------------------------------------
| Bootstrap
y | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
q20 |
x | .7749115 .0672129 11.53 0.000 .6430968 .9067262
_cons | -.3017343 .0280326 -10.76 0.000 -.3567105 -.2467581
-------------+----------------------------------------------------------------
q50 |
x | 1.01513 .0485833 20.89 0.000 .9198508 1.110409
_cons | .0034164 .0240824 0.14 0.887 -.0438129 .0506458
-------------+----------------------------------------------------------------
q80 |
x | 1.309644 .0642509 20.38 0.000 1.183639 1.43565
_cons | .2884671 .0252653 11.42 0.000 .2389181 .3380162
------------------------------------------------------------------------------
. test [q20=q50=q80]: x
( 1) [q20]x - [q50]x = 0
( 2) [q20]x - [q80]x = 0
F( 2, 1998) = 20.09
Prob > F = 0.0000
. ldvqreg y x if heter==1 , q(20 50 80) reps(100)
(running cqr_est on estimation sample)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Censored quantile regression Number of obs = 2,000
Replications = 100
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q20 |
x | .7489802 .0545416 13.73 0.000 .6420807 .8558797
_cons | -.2819161 .0256249 -11.00 0.000 -.3321398 -.2316923
-------------+----------------------------------------------------------------
q50 |
x | 1.019204 .0599742 16.99 0.000 .9016568 1.136751
_cons | .0039883 .0260766 0.15 0.878 -.0471208 .0550975
-------------+----------------------------------------------------------------
q80 |
x | 1.32032 .0535042 24.68 0.000 1.215453 1.425186
_cons | .2646587 .0221209 11.96 0.000 .2213026 .3080149
------------------------------------------------------------------------------
. test [q20=q50=q80]: x
( 1) [q20]x - [q50]x = 0
( 2) [q20]x - [q80]x = 0
chi2( 2) = 84.47
Prob > chi2 = 0.0000
Second, we show how to estimate the quantiles with the censored variable using the ldvqreg command. For this we must use the options ll(0) and ul(1) to indicate the lower (0) and upper (1) censoring points that correspond to this case. Note that both results are similar to the sqreg command with y as dependent variable (i.e. no censoring). Therefore, the ldvqreg command allows us to retrieve some of the information about the latent variable distribution.
stlog. ldvqreg y_c x if heter==0 , q(20 50 80) reps(100) ll(0) ul(1)
(running cqr_est on estimation sample)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Censored quantile regression Number of obs = 2,000
Replications = 100
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y_c | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q20 |
x | .9540131 .0689456 13.84 0.000 .8188821 1.089144
_cons | -.2385125 .0496892 -4.80 0.000 -.3359016 -.1411234
-------------+----------------------------------------------------------------
q50 |
x | 1.002916 .0240021 41.78 0.000 .9558728 1.049959
_cons | .0010923 .0136379 0.08 0.936 -.0256374 .027822
-------------+----------------------------------------------------------------
q80 |
x | 1.090821 .0663381 16.44 0.000 .9608005 1.220841
_cons | .2454639 .0247217 9.93 0.000 .1970102 .2939177
------------------------------------------------------------------------------
. test [q20=q50=q80]: x
( 1) [q20]x - [q50]x = 0
( 2) [q20]x - [q80]x = 0
chi2( 2) = 2.10
Prob > chi2 = 0.3501
.
. ldvqreg y_c x if heter==1 , q(20 50 80) reps(100) ll(0) ul(1)
(running cqr_est on estimation sample)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Censored quantile regression Number of obs = 2,000
Replications = 100
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y_c | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q20 |
x | .5630813 .0856675 6.57 0.000 .395176 .7309865
_cons | -.1516944 .0410796 -3.69 0.000 -.232209 -.0711798
-------------+----------------------------------------------------------------
q50 |
x | .9788213 .0363784 26.91 0.000 .9075208 1.050122
_cons | .01849 .0123575 1.50 0.135 -.0057302 .0427102
-------------+----------------------------------------------------------------
q80 |
x | 1.37022 .1536848 8.92 0.000 1.069004 1.671437
_cons | .2560525 .0359951 7.11 0.000 .1855034 .3266015
------------------------------------------------------------------------------
. test [q20=q50=q80]: x
( 1) [q20]x - [q50]x = 0
( 2) [q20]x - [q80]x = 0
chi2( 2) = 32.67
Prob > chi2 = 0.0000
Finally, we show that ignoring censoring in the estimation of conditional quantiles introduces a bias by comparing the results of the sqreg and ldvqreg commands using the censored dependent variable.\footnote{This is a generalization of the bias that occurs for censoring in the mean-based model, which can be studied by the Tobit estimator and its comparison to standard OLS.} Since we only compare point estimates, we run only a few replicates of the bootstrap.
stlog. sqreg y_c x, reps(5) q(20 50 80)
(fitting base model)
Bootstrap replications (5)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.....
Simultaneous quantile regression Number of obs = 4,000
bootstrap(5) SEs .20 Pseudo R2 = 0.1504
.50 Pseudo R2 = 0.2474
.80 Pseudo R2 = 0.1968
------------------------------------------------------------------------------
| Bootstrap
y_c | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
q20 |
x | .5620175 .0234281 23.99 0.000 .5160853 .6079496
_cons | -.0655659 .0015824 -41.44 0.000 -.0686682 -.0624636
-------------+----------------------------------------------------------------
q50 |
x | 1.003579 .0273909 36.64 0.000 .9498775 1.057281
_cons | .0020266 .0138975 0.15 0.884 -.0252202 .0292735
-------------+----------------------------------------------------------------
q80 |
x | .7244305 .0309551 23.40 0.000 .6637412 .7851198
_cons | .398641 .024758 16.10 0.000 .3501016 .4471804
------------------------------------------------------------------------------
. ldvqreg y_c x, reps(5) q(20 50 80) ll(0) ul(1)
(running cqr_est on estimation sample)
Bootstrap replications (5)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.....
Censored quantile regression Number of obs = 4,000
Replications = 5
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y_c | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q20 |
x | .8210614 .0353826 23.21 0.000 .7517129 .8904099
_cons | -.2278362 .0284962 -8.00 0.000 -.2836878 -.1719846
-------------+----------------------------------------------------------------
q50 |
x | 1.000194 .0144165 69.38 0.000 .971938 1.02845
_cons | .00578 .0063768 0.91 0.365 -.0067183 .0182782
-------------+----------------------------------------------------------------
q80 |
x | 1.133657 .0676917 16.75 0.000 1.000984 1.266331
_cons | .2681894 .0143108 18.74 0.000 .2401407 .2962381
------------------------------------------------------------------------------
Note that the coefficients computed by both commands are different. The gap between the two represents the bias for ignoring the censorship process. Figure (ref) shows the three lines estimated by both commands. The green line correspond to the $\tau=0.9$ case, the blue line to the $\tau=0.5$ one, and finally the red one to $\tau=0.2$. The points with the symbol "x" represent the realizations of the latent (uncensored) variable while the gray circles are those of the observed variable (censored). Clearly, the sqreg command underestimates the coefficients of the extreme quantiles as a consequence of the simulated upper and lower censoring while those estimated by the ldvqreg command are consistent with the scatter of the latent variable.
figure[figure omitted — 145 chars of source]
The command ldvqreg can be used to predict censored quantiles and also to compute the probability of censorship by the options texttt{qcen()} and pcen, respectively. Quantile prediction can be done in an individual way for each $\tau$, but the probability of censorship requires many $\tau$s (at least 2). We show now an example code and a graph in Figure (ref) with the predicted censured quantiles (left panel) and probability of censoring (right panel).
stlog. ldvqreg y_c x , reps(2) q(10 20 30 40 50 60 70 80 90) ll(0) ul(1) /*
*/ qcen(myqcen) pcen(mypcen)
(running cqr_est on estimation sample)
Bootstrap replications (2)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..
(output omitted)
. summarize
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
heter | 4,000 .5 .5000625 0 1
x | 4,000 .4973596 .2883611 .000018 .9997839
y | 4,000 .5076568 .5295976 -1.163579 2.778667
y_c | 4,000 .4922552 .3645911 0 1
mypcen | 4,000 .25675 .125413 .1111111 .5555556
-------------+---------------------------------------------------------
mypcen_s | 4,000 .2706427 .1154597 .1384926 .5122733
myqcen_q10 | 4,000 .0946118 .1214869 0 .3766204
myqcen_q20 | 4,000 .2127563 .1962473 0 .5930477
myqcen_q30 | 4,000 .3135726 .2376881 0 .7425613
myqcen_q40 | 4,000 .4120319 .2696362 0 .8849297
-------------+---------------------------------------------------------
myqcen_q50 | 4,000 .5032121 .2883758 .005798 1
myqcen_q60 | 4,000 .5963741 .3047473 .0502407 1
myqcen_q70 | 4,000 .6813506 .2779192 .1597887 1
myqcen_q80 | 4,000 .7620734 .2443681 .2682098 1
myqcen_q90 | 4,000 .8610955 .2007863 .3594372 1
figure[figure omitted — 151 chars of source]
It should be noted that in the summarize output there are new variables that were generated with the names used in the ldvqreg run. On one hand, the variables mypcen and mypcen s have the probability with the na\"ive and the smoothed formulas, respectively. On the other hand, the varlist myqcen\underlineq10-myqcen\underlineq90 are the predicted censored quantiles for $\tau\in\{0.10, 0.20, ..., 0.90\}$.
Binary dependent variable
Consider now a binary dependent variable case. The DGP for this case is the following.
stlog. drop _all
. set seed 321
. set obs 2000
number of observations (_N) was 0, now 2,000
. gen x = runiform()*10
. gen y = -2.5 + x + x*(rchi2(1)-1)/sqrt(2)
. gen y_b = (y>0)
. ta y_b
y_b | Freq. Percent Cum.
------------+-----------------------------------
0 | 883 44.15 44.15
1 | 1,117 55.85 100.00
------------+-----------------------------------
Total | 2,000 100.00
We first compute a probit model, then a QR model with the (unobserved) latent variable, and finally the proposed BQR using the developed command. For the last two we consider the median estimate, i.e. $\tau=0.5$. In order to compare these two we normalize the coefficients of the median QR regression to $\Vert \boldsymbol{b}\Vert=1$. The binary regression model already has this normalization.
stlog. qui probit y_b x
. nlcom (_b[x]/sqrt(_b[x]^2+_b[_cons]^2)) (_b[_cons]/sqrt(_b[x]^2+_b[_cons]^2))
_nl_1: _b[x]/sqrt(_b[x]^2+_b[_cons]^2)
_nl_2: _b[_cons]/sqrt(_b[x]^2+_b[_cons]^2)
------------------------------------------------------------------------------
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
_nl_1 | .2230184 .004476 49.83 0.000 .2142456 .2317912
_nl_2 | -.9748142 .001024 -951.94 0.000 -.9768213 -.9728072
------------------------------------------------------------------------------
.
. qui bsqreg y x
. mat norma = e(b)*e(b)'
. gen y_n = y/sqrt(norma[1,1])
. bsqreg y_n x
(fitting base model)
Bootstrap replications (20)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
....................
Median regression, bootstrap(20) SEs Number of obs = 2,000
Raw sum of deviations 1378.646 (about .13423963)
Min sum of deviations 1185.645 Pseudo R2 = 0.1400
------------------------------------------------------------------------------
y_n | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
x | .2300503 .0081119 28.36 0.000 .2141418 .2459589
_cons | -.9731787 .0179613 -54.18 0.000 -1.008404 -.937954
------------------------------------------------------------------------------
.
. ldvqreg y_b x
(running bqr_est on estimation sample)
Bootstrap replications (20)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
....................
Binary quantile regression Number of obs = 2,000
Replications = 20
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
x | .2381934 .0069091 34.48 0.000 .2246517 .251735
_cons | -.9712218 .0016994 -571.51 0.000 -.9745526 -.9678911
------------------------------------------------------------------------------
Note that in this case the BQR model show similar results to the QR model with the latent variable (normalized), but not to the Probit model. In fact, the Probit model should differ from the median estimates given that we are using an asymmetric DGP.
Consider now the comparison of the ldvqreg with the standard QR alternatives in STATA. In this case we compare it with bsqreg (QR with standard errors computed by bootstrap), separately for different quantiles.
stlog. bsqreg y_b x, q(20)
(fitting base model)
Bootstrap replications (20)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.xxxx.x....xx.x..xx.......xx.x.x..
.2 Quantile regression, bootstrap(20) SEs Number of obs = 2,000
Raw sum of deviations 223.4 (about 0)
Min sum of deviations 223.3644 Pseudo R2 = 0.0002
------------------------------------------------------------------------------
y_b | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
x | .1398933 .0011419 122.51 0.000 .137654 .1421327
_cons | -.3986311 .0105947 -37.63 0.000 -.419409 -.3778533
------------------------------------------------------------------------------
. nlcom (_b[x]/sqrt(_b[x]^2+_b[_cons]^2)) (_b[_cons]/sqrt(_b[x]^2+_b[_cons]^2))
_nl_1: _b[x]/sqrt(_b[x]^2+_b[_cons]^2)
_nl_2: _b[_cons]/sqrt(_b[x]^2+_b[_cons]^2)
------------------------------------------------------------------------------
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
_nl_1 | .3311357 .0057459 57.63 0.000 .3198739 .3423975
_nl_2 | -.9435832 .0020164 -467.94 0.000 -.9475353 -.939631
------------------------------------------------------------------------------
. ldvqreg y_b x, q(20)
(running bqr_est on estimation sample)
Bootstrap replications (20)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
....................
Binary quantile regression Number of obs = 2,000
Replications = 20
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
x | .1410802 .0025301 55.76 0.000 .1361212 .1460391
_cons | -.990006 .0003634 -2724.15 0.000 -.9907183 -.9892938
------------------------------------------------------------------------------
.
. bsqreg y_b x, q(50)
(fitting base model)
Bootstrap replications (20)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
....................
Median regression, bootstrap(20) SEs Number of obs = 2,000
Raw sum of deviations 441.5 (about 1)
Min sum of deviations 301.819 Pseudo R2 = 0.3164
------------------------------------------------------------------------------
y_b | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
x | .1271259 .0011701 108.65 0.000 .1248311 .1294206
_cons | -.094313 .0069562 -13.56 0.000 -.1079551 -.0806709
------------------------------------------------------------------------------
. nlcom (_b[x]/sqrt(_b[x]^2+_b[_cons]^2)) (_b[_cons]/sqrt(_b[x]^2+_b[_cons]^2))
_nl_1: _b[x]/sqrt(_b[x]^2+_b[_cons]^2)
_nl_2: _b[_cons]/sqrt(_b[x]^2+_b[_cons]^2)
------------------------------------------------------------------------------
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
_nl_1 | .8031167 .0199962 40.16 0.000 .7639249 .8423085
_nl_2 | -.5958218 .0269532 -22.11 0.000 -.648649 -.5429946
------------------------------------------------------------------------------
. ldvqreg y_b x, q(50)
(running bqr_est on estimation sample)
Bootstrap replications (20)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
....................
Binary quantile regression Number of obs = 2,000
Replications = 20
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
x | .2381934 .0096565 24.67 0.000 .2192669 .2571198
_cons | -.9712218 .0023759 -408.79 0.000 -.9758785 -.9665652
------------------------------------------------------------------------------
. bsqreg y_b x, q(80)
(fitting base model)
convergence not achieved.
convergence not achieved
r(430);
Note that the results are very different across estimators. This applies even if we normalize the bsqreg coefficients to $\Vert \boldsymbol{b}\Vert=1$. In fact, the QR estimates show convergence problems in several bootstrap simulations (denoted by an x in the output), while the ldvqreg runs smoothly. Overall this shows that BQR should be implemented with the proposed smoothed version.
Finally, we implement tests of homogeneity and symmetry, comparing the (true) latent variable model with the binary regression case.
To evaluate the symmetry of the conditional distribution we use the procedure suggested by Koenker05 evaluating the following linear null hypothesis:
equation*[equation* omitted — 222 chars of source]
for some $\delta \in (0, \frac{1}{2})$. This can be easily implemented by a Wald test using the test command.
stlog. * With unobservable data (uncensored)
. sqreg y x , q(10 25 50 75 90) reps(300)
(fitting base model)
Bootstrap replications (300)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
.................................................. 150
.................................................. 200
.................................................. 250
.................................................. 300
Simultaneous quantile regression Number of obs = 2,000
bootstrap(300) SEs .10 Pseudo R2 = 0.2544
.25 Pseudo R2 = 0.1967
.50 Pseudo R2 = 0.1400
.75 Pseudo R2 = 0.1630
.90 Pseudo R2 = 0.2030
------------------------------------------------------------------------------
| Bootstrap
y | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
q10 |
x | .3023696 .0017696 170.86 0.000 .2988991 .3058402
_cons | -2.499844 .0022336 -1119.20 0.000 -2.504225 -2.495464
-------------+----------------------------------------------------------------
q25 |
x | .3563443 .0066943 53.23 0.000 .3432157 .3694729
_cons | -2.498919 .0095113 -262.73 0.000 -2.517572 -2.480266
-------------+----------------------------------------------------------------
q50 |
x | .5799625 .0212302 27.32 0.000 .5383269 .6215981
_cons | -2.453407 .0326152 -75.22 0.000 -2.517371 -2.389444
-------------+----------------------------------------------------------------
q75 |
x | 1.174422 .052652 22.31 0.000 1.071164 1.277681
_cons | -2.359083 .0911639 -25.88 0.000 -2.53787 -2.180297
-------------+----------------------------------------------------------------
q90 |
x | 2.169029 .0961683 22.55 0.000 1.980428 2.357629
_cons | -2.38754 .1410773 -16.92 0.000 -2.664214 -2.110866
------------------------------------------------------------------------------
.
. * Homogeneity
. test [q10=q25=q50=q75=q90]: x
( 1) [q10]x - [q25]x = 0
( 2) [q10]x - [q50]x = 0
( 3) [q10]x - [q75]x = 0
( 4) [q10]x - [q90]x = 0
F( 4, 1998) = 118.08
Prob > F = 0.0000
.
. * Symmetry
. test (([q10]x+[q25]x+[q75]x+[q90]x)/4-[q50]x=0) ///
> (([q10]_cons+[q25]_cons+[q75]_cons+[q90]_cons)/4-[q50]_cons=0)
( 1) .25*[q10]x + .25*[q25]x - [q50]x + .25*[q75]x + .25*[q90]x = 0
( 2) .25*[q10]_cons + .25*[q25]_cons - [q50]_cons + .25*[q75]_cons + .25*[q90]_cons = 0
F( 2, 1998) = 176.51
Prob > F = 0.0000
.
. * With observable data (censored)
. ldvqreg y_b x , q(10 25 50 75 90) reps(300)
(running bqr_est on estimation sample)
Bootstrap replications (300)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
.................................................. 150
.................................................. 200
.................................................. 250
.................................................. 300
Binary quantile regression Number of obs = 2,000
Replications = 300
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q10 |
x | .1101229 .0532167 2.07 0.039 .00582 .2144257
_cons | -.9939236 .0027315 -363.88 0.000 -.9992772 -.9885699
-------------+----------------------------------------------------------------
q25 |
x | .1548161 .0044306 34.94 0.000 .1461323 .1634998
_cons | -.9879507 .0006984 -1414.58 0.000 -.9893196 -.9865819
-------------+----------------------------------------------------------------
q50 |
x | .2381934 .0096646 24.65 0.000 .2192511 .2571356
_cons | -.9712218 .002419 -401.49 0.000 -.9759631 -.9664806
-------------+----------------------------------------------------------------
q75 |
x | .4386173 .0448135 9.79 0.000 .3507844 .5264501
_cons | -.898675 .0230642 -38.96 0.000 -.9438799 -.85347
-------------+----------------------------------------------------------------
q90 |
x | .722866 .0350865 20.60 0.000 .6540977 .7916342
_cons | -.6909895 .035699 -19.36 0.000 -.7609582 -.6210208
------------------------------------------------------------------------------
.
. * Homogeneity
. test [q10=q25=q50=q75=q90]: x
( 1) [q10]x - [q25]x = 0
( 2) [q10]x - [q50]x = 0
( 3) [q10]x - [q75]x = 0
( 4) [q10]x - [q90]x = 0
chi2( 4) = 365.80
Prob > chi2 = 0.0000
.
. * Symmetry
. test (([q10]x+[q25]x+[q75]x+[q90]x)/4-[q50]x=0) ///
> (([q10]_cons+[q25]_cons+[q75]_cons+[q90]_cons)/4-[q50]_cons=0)
( 1) .25*[q10]x + .25*[q25]x - [q50]x + .25*[q75]x + .25*[q90]x = 0
( 2) .25*[q10]_cons + .25*[q25]_cons - [q50]_cons + .25*[q75]_cons + .25*[q90]_cons = 0
chi2( 2) = 47.46
Prob > chi2 = 0.0000
The results are expected. We reject the hypotheses of both homoscedasticity and symmetry of the latent variable. Both features should indicate that the assumptions of the Probit and Logit models are not valid ad we should consider the semi-parametric approach given by ldvqreg.
Finally, the ldvqreg also computes the conditional probabilities of $y=1$ using the estimated coefficients for a grid of $\tau$s by the option p1(). We show here an example coding:
stlog. ldvqreg y_b x , reps(2) q(10 20 30 40 50 60 70 80 90) ll(0) ul(1) p1(p_bqr)
(running bqr_est on estimation sample)
Bootstrap replications (2)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..
(output omitted)
. probit y_b x
Iteration 0: log likelihood = -1372.574
Iteration 1: log likelihood = -922.7862
Iteration 2: log likelihood = -921.47418
Iteration 3: log likelihood = -921.47373
Iteration 4: log likelihood = -921.47373
Probit regression Number of obs = 2,000
LR chi2(1) = 902.20
Prob > chi2 = 0.0000
Log likelihood = -921.47373 Pseudo R2 = 0.3287
------------------------------------------------------------------------------
y_b | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
x | .3639832 .0141984 25.64 0.000 .3361549 .3918116
_cons | -1.590972 .0738312 -21.55 0.000 -1.735679 -1.446265
------------------------------------------------------------------------------
. predict p_pro
(option pr assumed; Pr(y_b))
. summarize
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
x | 2,000 4.9855 2.852372 .0001804 9.99784
y | 2,000 2.408413 6.126037 -2.499892 60.79322
y_b | 2,000 .5585 .4966901 0 1
y_n | 2,000 .9553311 2.42998 -.9916178 24.11449
p_bqr | 2,000 .5653889 .3212985 0 1
-------------+---------------------------------------------------------
p_bqr_s | 2,000 .5661044 .3177954 2.72e-13 .9842031
p_pro | 2,000 .5578556 .3137343 .0558153 .9797236
figure[figure omitted — 138 chars of source]
Note that new variables appear, that is, p bqr and p bqr generated by ldvqreg and the variable p\underlinepro generated by \texttt{probit}. Figure (ref) shows these three predicted probabilities of $y=1|\boldsymbol{x}$. It should be noted that the Probit model underestimates the probabilities for the center values and overestimates in the extremes, in particular for low \texttt{x}. This is an expected result because of the heterogeneity and asymmetries in the DGP.
Example 2: Labor Supply Models
In this section we show an example of the ldvqreg command applied to the study of hours worked and the probability of having a job in Uruguay. The data comes from the 2015 Continuous Household Survey (ECH for its acronym in Spanish) prepared by the National Institute of Statistics (INE) and the sample consists of women between 18 and 45 years old who are in the labor force and living in urban areas of Montevideo. It is usual in the literature to treat hours worked as a censored variable and therefore to use a Tobit type I model in empirical studies. On the other hand, binary Probit/Logit models are widely used to study the probability of having a job. In both cases, the ldvqreg command is a flexible alternative that allows evaluating some key assumptions of the mentioned maximum likelihood models such as homoscedasticity and symmetry of the conditional distribution.
First we show the model for hours worked. The covariates are age, years of education, the number of children under 6 years of age in the household, and three dummy variables that indicate whether the woman is married, whether she is the head of the household, and whether her partner has a job. Below is the code with a description of the variables together with the result of the tobit and ldvqreg commands applied to the 0.20, 0.50 and 0.80 quantiles. For clarity of exposition, the coefficients are also shown in Table (ref).
stlog. use labordatauy, clear
. describe
Contains data from labordatauy.dta
obs: 9,601
vars: 8 19 Sep 2021 10:01
size: 307,232
--------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
--------------------------------------------------------------------------------------
work float
hours float
age float
educ float
married float
children float
couplewrk float
head float
--------------------------------------------------------------------------------------
. tobit hours age educ married children couplewrk head, ll(0)
Tobit regression Number of obs = 9,601
LR chi2(6) = 453.89
Prob > chi2 = 0.0000
Log likelihood = -38264.287 Pseudo R2 = 0.0059
------------------------------------------------------------------------------
hours | Coef. Std. Err. t P>|t| [95
-------------+----------------------------------------------------------------
age | .3345651 .0269592 12.41 0.000 .2817195 .3874108
educ | .4935618 .0514794 9.59 0.000 .3926513 .5944724
married | 2.646408 .5473636 4.83 0.000 1.57346 3.719357
children | -2.297002 .3264407 -7.04 0.000 -2.936895 -1.65711
couplewrk | -1.529182 .534851 -2.86 0.004 -2.577603 -.4807612
head | 2.032225 .4190952 4.85 0.000 1.21071 2.853741
_cons | 13.67016 1.034941 13.21 0.000 11.64146 15.69887
-------------+----------------------------------------------------------------
/sigma | 18.11237 .1431627 17.83174 18.393
------------------------------------------------------------------------------
1,037 left-censored observations at hours <= 0
8,564 uncensored observations
0 right-censored observations
. outreg2 using "cen-qreg.xls", replace
cen-qreg.xls
dir : seeout
.
. ldvqreg hours age educ married children couplewrk head, ll(0) reps(100) q(20 50 80)
(running cqr_est on estimation sample)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Censored quantile regression Number of obs = 9,601
Replications = 100
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
hours | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q20 |
age | .5395249 .0504014 10.70 0.000 .4407399 .6383099
educ | 1.617458 .078667 20.56 0.000 1.463273 1.771642
married | 4.504101 .9645752 4.67 0.000 2.613568 6.394634
children | -3.008667 .5073226 -5.93 0.000 -4.003001 -2.014333
couplewrk | -2.672318 .9351631 -2.86 0.004 -4.505204 -.8394319
head | 3.875635 .7831536 4.95 0.000 2.340682 5.410588
_cons | -22.81325 1.393761 -16.37 0.000 -25.54497 -20.08153
-------------+----------------------------------------------------------------
q50 |
age | .1841254 .0296005 6.22 0.000 .1261096 .2421413
educ | .0484223 .0603246 0.80 0.422 -.0698118 .1666564
married | 3.138284 .7572092 4.14 0.000 1.654181 4.622386
children | -2.693533 .4289794 -6.28 0.000 -3.534318 -1.852749
couplewrk | -2.414126 .6813139 -3.54 0.000 -3.749476 -1.078775
head | 1.058981 .3585019 2.95 0.003 .3563303 1.761632
_cons | 29.86262 1.365012 21.88 0.000 27.18724 32.53799
-------------+----------------------------------------------------------------
q80 |
age | .0454839 .0129672 3.51 0.000 .0200687 .0708991
educ | -.488003 .0267038 -18.27 0.000 -.5403416 -.4356645
married | .4958638 .2746884 1.81 0.071 -.0425155 1.034243
children | -.5143125 .1713502 -3.00 0.003 -.8501528 -.1784723
couplewrk | -.5283063 .2773909 -1.90 0.057 -1.071983 .0153699
head | .3686784 .2151083 1.71 0.087 -.0529261 .7902829
_cons | 48.86151 .4881569 100.09 0.000 47.90474 49.81828
------------------------------------------------------------------------------
. outreg2 using "cen-qreg.xls", append
cen-qreg.xls
dir : seeout
. test [q20=q50=q80]
( 1) [q20]age - [q50]age = 0
( 2) [q20]educ - [q50]educ = 0
( 3) [q20]married - [q50]married = 0
( 4) [q20]children - [q50]children = 0
( 5) [q20]couplewrk - [q50]couplewrk = 0
( 6) [q20]head - [q50]head = 0
( 7) [q20]age - [q80]age = 0
( 8) [q20]educ - [q80]educ = 0
( 9) [q20]married - [q80]married = 0
(10) [q20]children - [q80]children = 0
(11) [q20]couplewrk - [q80]couplewrk = 0
(12) [q20]head - [q80]head = 0
chi2( 12) = 2924.46
Prob > chi2 = 0.0000
. test (0.5*_b[q20:age]+0.5*_b[q80:age]=_b[q50:age]) ///
> (0.5*_b[q20:edu]+0.5*_b[q80:edu]=_b[q50:edu]) ///
> (0.5*_b[q20:mar]+0.5*_b[q80:mar]=_b[q50:mar]) ///
> (0.5*_b[q20:chi]+0.5*_b[q80:chi]=_b[q50:chi]) ///
> (0.5*_b[q20:cou]+0.5*_b[q80:cou]=_b[q50:cou]) ///
> (0.5*_b[q20:hea]+0.5*_b[q80:hea]=_b[q50:hea]) ///
> (0.5*_b[q20:_co]+0.5*_b[q80:_co]=_b[q50:_co])
( 1) .5*[q20]age - [q50]age + .5*[q80]age = 0
( 2) .5*[q20]educ - [q50]educ + .5*[q80]educ = 0
( 3) .5*[q20]married - [q50]married + .5*[q80]married = 0
( 4) .5*[q20]children - [q50]children + .5*[q80]children = 0
( 5) .5*[q20]couplewrk - [q50]couplewrk + .5*[q80]couplewrk = 0
( 6) .5*[q20]head - [q50]head + .5*[q80]head = 0
( 7) .5*[q20]_cons - [q50]_cons + .5*[q80]_cons = 0
chi2( 7) = 1054.47
Prob > chi2 = 0.0000
table[table omitted — 1,419 chars of source]
Note that the tests show that homoscedasticity and symmetry of the conditional distribution are rejected at the usual levels of significance. Therefore, the overall effect of the covariates is heterogeneous and it is also likely that the coefficients estimated by Tobit model are potentially biased.
Second, we analyze the binary regression model using the variable work as a dependent variable, which is a dummy variable that indicates with 1 if the woman is working and 0 otherwise. As in the previous example, we start by showing the result of the Probit model where we normalize the coefficients in such a way that $\Vert \boldsymbol{b}\Vert=1$ and therefore are comparable with those of the output of the ldvqreg command. Again, we estimate the parameters of the conditional quantiles 0.20, 0.50 and 0.80 of the latent variable. The code is shown below and the results, for simplicity, are shown in Table (ref):
stlog. probit work age educ married children couplewrk head
Iteration 0: log likelihood = -3286.7444
Iteration 1: log likelihood = -2928.7265
Iteration 2: log likelihood = -2917.8391
Iteration 3: log likelihood = -2917.8201
Iteration 4: log likelihood = -2917.8201
Probit regression Number of obs = 9,601
LR chi2(6) = 737.85
Prob > chi2 = 0.0000
Log likelihood = -2917.8201 Pseudo R2 = 0.1122
------------------------------------------------------------------------------
work | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
age | .0402997 .0026915 14.97 0.000 .0350244 .045575
educ | .0831836 .005493 15.14 0.000 .0724175 .0939497
married | .2323897 .0494435 4.70 0.000 .1354823 .3292971
children | -.0802435 .0321561 -2.50 0.013 -.1432682 -.0172187
couplewrk | -.051575 .0468705 -1.10 0.271 -.1434395 .0402895
head | .2070765 .0440624 4.70 0.000 .1207159 .2934372
_cons | -1.035893 .1003225 -10.33 0.000 -1.232521 -.8392642
------------------------------------------------------------------------------
. mat b_probit = e(b)
. svmat b_probit
. sca norm = 0
. foreach b of varlist b_probit* {
2. sca norm = norm + `b'[1]^2
3. }
. sca norm = sqrt(norm)
. outreg2 using "bin-qreg.xls", stnum(replace coef=coef/norm, replace se=se/norm) replace
bin-qreg.xls
dir : seeout
. ldvqreg work age educ married children couplewrk head, reps(100) q(20 50 80)
(running bqr_est on estimation sample)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Binary quantile regression Number of obs = 9,601
Replications = 100
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
work | Coef. Std. Err. z P>|z| [95
-------------+----------------------------------------------------------------
q20 |
age | .0292285 .0035849 8.15 0.000 .0222022 .0362549
educ | .0323487 .0085367 3.79 0.000 .015617 .0490803
married | .2048792 .0422928 4.84 0.000 .1219869 .2877715
children | -.0749141 .0393592 -1.90 0.057 -.1520567 .0022285
couplewrk | -.1221973 .0423323 -2.89 0.004 -.2051671 -.0392276
head | .1493376 .0565451 2.64 0.008 .0385111 .260164
_cons | -.9556585 .0162207 -58.92 0.000 -.9874504 -.9238665
-------------+----------------------------------------------------------------
q50 |
age | .0257198 .0232722 1.11 0.269 -.0198928 .0713324
educ | .1716362 .1126731 1.52 0.128 -.0491991 .3924715
married | .4773294 .2691138 1.77 0.076 -.0501239 1.004783
children | .117616 .1788098 0.66 0.511 -.2328448 .4680768
couplewrk | -.1989163 .2876677 -0.69 0.489 -.7627346 .364902
head | .2621181 .1656298 1.58 0.114 -.0625104 .5867466
_cons | -.7873564 .1550116 -5.08 0.000 -1.091174 -.4835392
-------------+----------------------------------------------------------------
q80 |
age | .0720622 .0227476 3.17 0.002 .0274777 .1166467
educ | .0672349 .0912818 0.74 0.461 -.1116741 .2461438
married | .2004946 .1340388 1.50 0.135 -.0622167 .4632059
children | -.0696732 .1128843 -0.62 0.537 -.2909224 .151576
couplewrk | -.0327274 .2034881 -0.16 0.872 -.4315568 .366102
head | .1811072 .0872446 2.08 0.038 .010111 .3521035
_cons | -.9546537 .1201494 -7.95 0.000 -1.190142 -.7191653
------------------------------------------------------------------------------
. outreg2 using "bin-qreg.xls", append
bin-qreg.xls
dir : seeout
. test [q20=q50=q80]
( 1) [q20]age - [q50]age = 0
( 2) [q20]educ - [q50]educ = 0
( 3) [q20]married - [q50]married = 0
( 4) [q20]children - [q50]children = 0
( 5) [q20]couplewrk - [q50]couplewrk = 0
( 6) [q20]head - [q50]head = 0
( 7) [q20]age - [q80]age = 0
( 8) [q20]educ - [q80]educ = 0
( 9) [q20]married - [q80]married = 0
(10) [q20]children - [q80]children = 0
(11) [q20]couplewrk - [q80]couplewrk = 0
(12) [q20]head - [q80]head = 0
chi2( 12) = 24.58
Prob > chi2 = 0.0169
. test (0.5*_b[q20:age]+0.5*_b[q80:age]=_b[q50:age]) ///
> (0.5*_b[q20:edu]+0.5*_b[q80:edu]=_b[q50:edu]) ///
> (0.5*_b[q20:mar]+0.5*_b[q80:mar]=_b[q50:mar]) ///
> (0.5*_b[q20:chi]+0.5*_b[q80:chi]=_b[q50:chi]) ///
> (0.5*_b[q20:cou]+0.5*_b[q80:cou]=_b[q50:cou]) ///
> (0.5*_b[q20:hea]+0.5*_b[q80:hea]=_b[q50:hea]) ///
> (0.5*_b[q20:_co]+0.5*_b[q80:_co]=_b[q50:_co])
( 1) .5*[q20]age - [q50]age + .5*[q80]age = 0
( 2) .5*[q20]educ - [q50]educ + .5*[q80]educ = 0
( 3) .5*[q20]married - [q50]married + .5*[q80]married = 0
( 4) .5*[q20]children - [q50]children + .5*[q80]children = 0
( 5) .5*[q20]couplewrk - [q50]couplewrk + .5*[q80]couplewrk = 0
( 6) .5*[q20]head - [q50]head + .5*[q80]head = 0
( 7) .5*[q20]_cons - [q50]_cons + .5*[q80]_cons = 0
chi2( 7) = 3.45
Prob > chi2 = 0.8406
table[table omitted — 1,503 chars of source]
In this case it is not possible to reject neither the hypotheses of symmetry nor homoscedasticity at 1% significance, so it seems that a standard model like the Probit works relatively well. Although the latter gives the impression that the ldvqreg command is somewhat innocuous, it should be noted that it serves either as an empirical way of validating or refuting (and possibly replacing) the estimates of a Probit/Logit model.
Comments and suggestions
This paper proposes a new Stata command ldvqreg to estimate censored quantile regression and binary regression models. A key feature of the proposed command is that it implements a smoothed version of the quantile regression model. Thus, it works very well for the case of censoring and binary dependent variable.
We illustrate the potential pitfalls of ignoring the censoring mechanisms. In the simulation exercises we compare the standard quantile regression estimates with our corrected procedure. The results highlight that the former may be biased in the usual way. In fact this is the same issue that may appear if we compare the Tobit model with standard OLS. The same applies to the binary regression model. In this case, we show that the Probit model may be biased in the underlying data generating process is not homoscedastic and symmetric, while the implementation using standard quantile regression estimates may suffer from convergence problems. In all cases the command ldvqreg clearly solves this issues.