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.
34,976 characters · 15 sections · 38 citation commands
Censored quantile instrumental variable estimation with Stata
\inserttype[st0001]{article} { Victor Chernozhukov\\MIT\\Cambridge, Massachusetts\\[email removed] \and Ivan Fernandez-Val\\Boston University\\Boston, Massachusetts\\[email removed] \and Sukjin Han\\UT Austin\\Austin, Texas\\[email removed] \and Amanda Kowalski\\University of Michigan\\Ann Arbor, Michigan\\[email removed] }
CFK15 introduced a censored quantile instrumental variable (CQIV) estimator. In this article, we introduce a Stata command, cqiv, that implements the CQIV estimator in Stata. Our goal is to facilitate the use of the cqiv command in a wide set of applications.
Many applications involve censoring as well as endogeneity. For example, suppose that we are interested in the price elasticity of medical expenditure, as in K16. Medical expenditure is censored from below at zero, and the price of medical care is endogenous to the level of medical expenditure through the structure of the insurance contract. Given an instrument for the price of medical care, the CQIV estimator facilitates estimation of the price elasticity of expenditure on medical care in a way that addressess censoring as well as endogeneity.
The CQIV estimator addresses censoring using the censored quantile regression (CQR) approach of P86, and it addresses endogeneity using a control function approach. For computation, the CQIV estimator adapts the CH02 algorithm for CQR estimation. An important side feature of the cqiv stata command is that it can also be used in quantile regression applications that do not include censoring or endogeneity.
In section (ref), we summarize the theoretical background on the CQIV command, following CFK15. In section (ref), we introduce the use of the CQIV command. We provide an empirical application with examples that involve estimation of Engel curves, as in CFK15.
We first describe a model of triangular system for the CQIV regression. Suppose $Y$ is an observed response variable obtained by censoring a continuous latent response $Y^{\ast }$ from below at the level determined by the variable $C$. Let $D$ be the continuous regressor of interest, possibly endogenous, and $W$ be a vector of covariates, possibly containing $C$, and $Z$ is a vector of (possibly discrete) IVs excluded from the equation for $Y^{\ast }$.\footnote{We consider a single endogenous regressor $D$ in the model and in the cqiv procedure.} We observe $\{Y_{i},D_{i},W_{i},Z_{i},C_{i}\}_{i = 1}^{n}$, a sample of size $n$ of independent and identically distributed observations from the random vector $(Y,D,W,Z,C),$ which obeys
where $V$ is a latent unobserved variable that accounts for the possible endogeneity of $D$, $X = x(D,W,V)$ with $x(D,W,V)$ being a vector of transformations of $(D,W,V)$, $Q_{Y^{\ast }}(u \mid D,W,V)$ is the $u$-quantile of $Y^{*}$ conditional on $(D,W,V)$, $Q_{D}(v \mid W,Z)$ is the $v$-quantile of $D$ conditional on $(W,Z)$, and
This CQIV regression model nests the uncensored case of the quantile IV (QIV) regression by making $C$ arbitrarily small. As an example for the CQIV model, in the Engel curve application of CFK15, $Y$ is the expenditure share in alcohol, bounded from below at $C=0$, $D$ is total expenditure on nondurables and services, $W$ are household demographic characteristics, and $Z$ is labor income measured by the earnings of the head of the household. Total expenditure is likely to be jointly determined with the budget composition in the household's allocation of income across consumption goods and leisure. Thus, households with a high preference to consume “non-essential” goods such as alcohol tend to expend a higher proportion of their incomes, and therefore they tend to have a higher expenditure. The control variable $V$ in this case is the marginal propensity to consume, measured by the household ranking in the conditional distribution of expenditure given labor income and household characteristics. This propensity captures unobserved preference variables that affect both the level and composition of the budget. Under the conditions for a two stage budgeting decision process (GO59), where the household first divides income between consumption and leisure/labor and then decide the consumption allocation, some sources of income can provide plausible exogenous variation with respect to the budget shares. For example, if preferences are weakly separable in consumption and leisure/labor, the consumption budget shares do not depend on labor income given the consumption expenditure (see, e.g., DM80). This justifies the use of labor income as an exclusion restriction.
A simple version of the model (ref)--(ref) is as follows:
where $\Phi^{-1}$ denotes the quantile function of the standard normal distribution, and also assume that $(\Phi ^{-1}(V)$, $\Phi ^{-1}(\epsilon))$ is jointly normal with correlation $\rho_0$. From the properties of the multivariate normal distribution, $\Phi ^{-1}(\epsilon)= \rho_0 \Phi ^{-1}(V)+(1 - \rho_0^2)^{1/2} \Phi ^{-1}(U)$, where $U \sim U(0,1)$. This result yields a specific expression for the conditional quantile function of $Y^{\ast}$:
where $V$ enters the equation through $\Phi ^{-1}(V)$.
Given this model, CFK15 introduce the estimator for the parameter $\beta_0(u)$ as
where $\rho _{u}(z)=(u-1(z<0))z$ is the asymmetric absolute loss function of KB78, $\widehat{X}_{i}=x(D_{i},W_{i},\widehat{V_{i}})$ , $\widehat{S}_{i}=s(\widehat{X}_{i},C_i),$ $s(X,C)$ is a vector of transformations of $(X,C)$, $\varsigma$ is a positive cut-off, and $\widehat{V_{i}}$ is an estimator of $ V_{i}$ which is described below.
The estimator in ((ref)) adapts the algorithm of CH02 developed for the censored quantile regression (CQR) estimator to a setting where there is possible endogeneity. \ As described in CFK15, this algorithm is based on the following implication of the model: $$ P(Y \leq X'\beta_0(u) \mid X, C, X'\beta_0(u) > C) = P(Y^* \leq X'\beta_0(u) \mid X,C,X'\beta_0(u) > C) = u, $$ provided that $P(X'\beta_0(u) > C) > 0.$ In other words, $X'\beta_0(u)$ is the conditional $u$-quantile of the observed outcome for the observations for which $X'\beta_0(u) > C,$ i.e., the conditional $u$-quantile of the latent outcome is above the censoring point. These observations change with the quantile index and may include censored observations. CFK15 refer to them as the “quantile-uncensored” observations. The multiplier $1(\widehat{S}_{i}^{\prime}\widehat{\gamma}>\varsigma)$ is a selector that predicts if observation $i$ is quantile-uncensored. For the conditions on this selector, consult Assumptions 4(a) and 5 in CFK15.
cqiv implements the censored quantile instrumental variable (CQIV) estimator which is computed using an iterative procedure where each step takes the form specified in equation ((ref)) with a particular choice of $1(\widehat{S}_{i}^{\prime }\widehat{\gamma}>\varsigma)$. We briefly describe this procedure here and then provide a practical algorithm in the next section. The procedure first selects the set of quantile-uncensored observations by estimating the conditional probabilities of censoring using a flexible binary choice model. Since $\{X'\beta_0(u) > C\} \equiv \{P(Y^* \leq C \mid X,C) < u\}$, quantile-uncensored observations have conditional probability of censoring lower than the quantile index $u$. The linear part of the conditional quantile function, $X_i'\beta_0(u)$, is estimated by standard quantile regression using the sample of quantile-uncensored observations. Then, the procedure updates the set of quantile-uncensored observations by selecting those observations with conditional quantile estimates that are above their censoring points, $X_i'\widehat\beta(u) > C_i$, and iterate.
cqiv provides different ways of estimating the control variable $V$, which can be chosen with option \underbar{f}irststage(\ststring). Note that if $Q_D(v \mid W,Z)$ is invertible in $v$, the control variable has several equivalent representations:
where $F_{D}(D \mid W,Z)$ is the distribution of $D$ conditional on $(W,Z)$. Different estimators of $V$ can be constructed based on parametric or semiparametric models for $F_{D}(D \mid W,Z)$ and $Q_{D}(V\mid W,Z)$. Let $R=r(W,Z)$ with $r(W,Z)$ being a vector of collecting transformations of $(W,Z)$ specified by the researcher. When \ststring is quantile, a quantile regression model is assumed, where $Q_{D}(v\mid W,Z)=R^{\prime }\pi_0 (v)$ and
The estimator of $V$ then takes the form
where $\widehat{\pi }(v)$ is the KB78 quantile regression estimator which is calculated within cqiv using the built-in qreg command in Stata, and $\tau$ is a small positive trimming constant that avoids estimation of tail quantiles. The integral in (ref) can be approximated numerically using a finite grid of quantiles.\footnote{The use of the integral to obtain a generalized inverse is convenient to avoid monotonicity problems in $v \mapsto R^{\prime }\widehat{\pi }(v)$ due to misspecification or sampling error. CFG10 developed asymptotic theory for this estimator.} Specifically, the fitted values for pre-specified quantile indices (whose number $n_q$ is controlled by option nquant(\num)) are calculated, which then yields
For other related quantile regression models that can alternatively be used, see CFK15.
When \ststring is distribution, $\vartheta_0$ is estimated using distribution regression. In this case we consider a semiparametric model for the conditional distribution of $D$ to construct a control variable $$ V = F_D(D \mid W,Z) = \Lambda(R' \pi_0 (D)), $$ where $\Lambda$ is a probit or logit link function; this can be chosen using option ldv1(\ststring) where \ststring is either probit or logit. The estimator takes the form
where $\widehat{\pi}(d)$ is the maximum likelihood estimator of $\pi_0(d)$ at each $d$ (see, e.g., FP95, and CFM13).\footnote{CFM13 developed asymptotic theory for this estimator.} The expression (ref) can be approximated by considering a finite grid of evenly-spaced thresholds for the conditional distribution function of $D$, where the number of thresholds $n_t$ is controlled by option nthresh(\num). Concretely, for threshold $d_j$ with $j=1,...,n_t$,
where $\widehat{\pi}(d_j)$ is probit or logit estimate with $\tilde{D}_i (d_j)=1\{D_i \leq d_j\}$ as a dependent variable and $R_i$ as regressors.
Lastly, when \ststring is ols, a linear regression model $D=R^{\prime }\pi_0+V$ is assumed and $\widehat V$ is a transformation of the OLS residual:
where $\Phi$ is the standard normal distribution, $\widehat{\pi}$ is the OLS estimator of $\pi_0$, and $\widehat{\sigma}$ is the estimator of the error standard deviation. In estimation of (ref) using cqiv, we assume that the control function $\widehat V$ enters the equation through $\Phi ^{-1}(\widehat V)$. This is motivated by the example (ref)--(ref).
The algorithm recommended in CFK15 to obtain CQIV estimates is similar to Chernozhukov and Hong (2002), but it additionally has an initial step to estimate the control variable $V$. This step is numbered as 0 to facilitate comparison with the CH02 3-Step CQR algorithm. \
For each desired quantile $u$, perform the following steps:
Remark 1 (Step 1). To predict the quantile-uncensored observations, a probit, logit, or any other model that fits the data well can be used. cqiv provides option ldv2(\ststring) where \ststring can be either probit or logit. Note that the model does not need to be correctly specified; it suffices that it selects a nontrivial subset of observations with $X_i'\beta_0(u)>C_i$. To choose the value of $k_0$, it is advisable that a constant fraction of observations satisfying $\Lambda(\widehat{S}_{i}^{\prime }\widehat{\delta })>1-u$ are excluded from $J_{0}$ for each quantile. To do so, one needs to set $k_0$ as the $q_{0}$th quantile of $\Lambda(\widehat{S}_{i}^{\prime }\widehat{ \delta })$ conditional on $\Lambda(\widehat{S}_{i}^{\prime }\widehat{\delta})>1-u$, where $q_{0}$ is a percentage (10% worked well in our simulation with little sensitivity to values between 5 and 15%). The value for $q_0$ can be chosen with option \texttt{drop1(\num)}.
Remark 2 (Step 2). To choose the cut-off $\varsigma_{1}$, it is advisable that a constant fraction of observations satisfying $\widehat{X}_{i}^{\prime }\widehat{ \beta }^0(u)>C_{i}$ are excluded from $J_{1}$ for each quantile. \ To do so, one needs to set $\varsigma_{1}$ to be the $q_{1}$th quantile of $\widehat{X} _{i}^{\prime }\widehat{\beta }^0(u) - C_i$ conditional on $\widehat{X}_{i}^{\prime } \widehat{\beta }^0(u)>C_{i}$, where $q_{1}$ is a percentage less than $q_{0}$ (3% worked well in our simulation with little sensitivity to values between 1 and 5%). The value for $q_1$ can be chosen with option drop2(\num).\footnote{In practice, it is desirable that $ J_{0}$ $\subset $ $J_{1}$. If this is not the case, CFK15 recommend altering $q_{0}$, $q_{1}$, or the specification of the regression models. At each quantile, the percentage of observations from the full sample retained in $J_{0}$, the percentage of observations from the full sample retained in $J_{1}$, and the percentage of observations from $J_{0}$ not retained in $J_{1}$ can be computed as simple robustness diagnostic tests. The estimator $ \widehat{\beta }^0(u)$ is consistent but will be inefficient relative to the estimator obtained in the subsequent step because it uses a smaller conservative subset of the quantile-uncensored observations if $q_0 > q_1$.}
Remark 3 (Steps 1 and 2). In terms of the notation of (ref), the selector of Step 1 can be expressed as $1(\widehat{S}_i'\widehat{\gamma} > \varsigma_0)$, where $\widehat{S}_i'\widehat{\gamma} = \widehat{S}_i'\widehat{\delta} - \Lambda^{-1}(1-u)$ and $\varsigma_0 = \Lambda^{-1}(1-u+k_0) - \Lambda^{-1}(1-u)$. The selector of Step 2 can also be expressed as $1(\widehat{S}_i'\widehat{\gamma} > \varsigma_1),$ where $\widehat{S}_i = (\widehat{X}_i', C_i)'$ and $\widehat{\gamma} = (\widehat{\beta}^{0}(u)',-1)'$.
CFK15 recommend obtaining standard errors and confidence intervals through either weighted bootstrap or nonparametric bootstrap procedures. We focus on weighted bootstrap here. To speed up the computation, a procedure is proposed that uses a one-step CQIV estimator in each bootstrap repetition.
For $b = 1, \ldots, B$, repeat the following steps:
Remark 4 (Step 2). The estimate of the control function $ \widehat \vartheta_{b}^{e}$ can be obtained by weighted least squares, weighted quantile regression, or weighted distribution regression, depending upon which \ststring is chosen among ols, quantile, or distribution in option firststage(\ststring).
Remark 5 (Step 3). A computationally less expensive alternative is to set $J_{1b} = J_{1}$ in all the repetitions, where $J_1$ is the subset of selected observations in Step 2 of the CQIV algorithm. This alternative is not considered in the cqiv routine, because while it is computationally faster, it sacrifices accuracy.
Remark 6 As discussed in CFK15, we focus on weighted bootstrap, partly because it has practical advantages over nonparametric bootstrap to deal with discrete regressors with small cell sizes, since it avoids having singular designs under the bootstrap data generating process. The cqiv procedure allows both weighted and nonparametric bootstraps.
Remark 7 For a cluster bootstrap procedure with clustered data, the bootstrap weights are generated after treating the cluster unit as the unit at which observations are assumed to be independent. In this procedure, the same weight is drawn for all the observations within each cluster.
\endinput
The syntax for cqiv is as follows:
cqiv conducts CQIV estimation. This command can implement both censored and uncensored quantile IV estimation either under exogeneity or endogeneity. The estimators proposed by CFK15 are used if CQIV estimation or QIV without censoring estimation are implemented. The estimator proposed by CH02 is used if CQR is estimated without endogeneity. Note that all the variables in the parentheses of the syntax are those involved in the first stage estimation of CQIV and QIV.
\underbar{q}uantiles(\stnumlist) specifies the quantiles at which the model is estimated and should contain percentage numbers between 0 and 100. Note that this is not the list of quantiles for the first stage estimation with the quantile regression specification. \\ \\ \underbar{c}ensorpt(\num) specifies the fixed censoring point of the dependent variable, where the default is 0; inappropriately specified censoring point will generate errors in estimation. \\ \\ censorvar(\varname) specifies the censoring variable (i.e., the random censoring point) of the dependent variable. \\ \\ \underbar{t}op sets right censoring of the dependent variable; otherwise, left censoring is assumed as default. \\ \\ \underbar{u}ncensored selects uncensored quantile IV (QIV) estimation. \\ \\ \underbar{e}xogenous selects censored quantile regression (CQR) with no endogeneity, which is proposed by CH02. \\ \\ \texttt{\underbar{f}irststage(\ststring)} determines the first stage estimation procedure, where \texttt{\ststring} is either \texttt{quantile} for quantile regression (the default), \texttt{distribution} for distribution regression (either probit or logit), or \texttt{ols} for OLS estimation. Note that \texttt{firststage(distribution)} can take a considerable amount of time to execute. \\ \\ \texttt{firstvar(\varlist)} specifies the list of variables other than instruments that are included in the first stage estimation; default is all the variables that are included in the second stage estimation. \\ \\ \texttt{nquant(\num)} determines the number of quantiles used in the first stage estimation when the estimation procedure is \texttt{quantile}; default is 50, that is, total 50 evenly-spaced quantiles from $1/51$ to $50/51$ are chosen in the estimation; it is advisable to choose a value between 20 to 100. \\ \\ \texttt{nthresh(\num)} determines the number of thresholds used in the first stage estimation when the estimation procedure is \texttt{distribution}; default is 50, that is, total 50 evenly-spaced thresholds (i.e., the sample quantiles of \texttt{\depvar}) are chosen in the estimation; it is advisable to choose a value between 20 and the value of the sample size. \\ \\ \texttt{ldv1(\ststring)} determines the LDV model used in the first stage estimation when the estimation procedure is \texttt{distribution}, where \texttt{\ststring} is either \texttt{probit} for probit estimation (the default), or \texttt{logit} for logit estimation. \\ \\ \texttt{ldv2(\ststring)} determines the LDV model used in the first step of the second stage estimation, where \texttt{\ststring} is either \texttt{probit} (the default), or \texttt{logit}.
\underbar{cor}ner calculates the (average) marginal quantile effects for censored dependent variable when the censoring is due to economic reasons such are corner solutions. Under this option, the reported coefficients are the average corner solution marginal effects if the underlying function is linear in the endogenous variable, i.e., the average of $1\{Q_{Y^{\ast }}(u\mid D,W,V)>C\}\partial_{D}Q_{Y^{\ast }}(u\mid D,W,V)=1\{x(D,W,V)'\beta_0(u)>C\}\partial_{D}x(D,W,V)'\beta_0(u)$ over all observations. If the underlying function is nonlinear in the endogenous variable, average marginal effects must be calculated directly from the coefficients without corner option. For details of the related concepts, see Section 2.1 of CFK15. The relevant example can be found in Section 3.5. \\ \\ drop1(\num) sets the proportion of observations $q_0$ with probabilities of censoring above the quantile index that are dropped in the first step of the second stage (See Remark 1 above for details); default is 10. \\ \\ drop2(\num) sets the proportion of observations $q_1$ with estimate of the conditional quantile above (below for right censoring) that are dropped in the second step of the second stage (See Remark 2 above for details); default is 3. \\ \\ \underbar{viewl}og shows the intermediate estimation results; the default is no log.
\underbar{co}nfidence(\ststring) specifies the type of confidence intervals. With \ststring being no, which is the default, no confidence intervals are calculated. With \ststring being boot or weightedboot, either nonparametric bootstrap or weighted bootstrap (respectively) symmetric t-percentile confidence intervals are calculated. The weights of the weighted bootstrap are generated from the standard exponential distribution. Note that \texttt{confidence(boot)} and \texttt{confidence(weightboot)} can take a considerable amount of time to execute. \\ \\ \texttt{\underbar{clu}ster(\ststring)} implements a cluster bootstrap procedure for clustered data when \texttt{confidence(weightboot)} is selected, with \texttt{\ststring} specifying the variable that defines the group or cluster. \\ \\ \texttt{\underbar{b}ootreps(\num)} sets the number of repetitions of bootstrap or weighted bootstrap if the \texttt{confidence(boot)} or \texttt{confidence(weightboot)} is selected. The default number of repetitions is 100. \\ \\ \texttt{\underbar{s}etseed(\num)} sets the initial seed number in repetition of bootstrap or weighted bootstrap; the default is 777. \\ \\ \texttt{\underbar{le}vel(\num)} sets confidence level, and default is 95.
\underbar{no}robust suppresses the robustness diagnostic test results. No diagnostic test results to suppress when uncensored is employed.
cqiv saves the following results in e():
\\ {*Note that the entry complete denotes whether all the steps are included in the procedure; 1 when they are, and 0 otherwise. For other entries consult the paper.}
We illustrate how to use the command by using some examples. For the dataset, we use a household expenditure dataset for alcohol consumption drawn from the British Family Expenditure Survey (FES); see BCK07 and CFK15 for detailed description of the data. Using this dataset, we are interested in learning how the share of total expenditure on alcohol (alcohol) is affected by (logarithm of) total expenditure (logexp), controlling for the number of children (nkids). For the endogenous expenditure, we use disposable income, i.e., (logarithm of) gross earnings of the head of the household (logwages), as an excluded instrument. The dataset (alcoholengel.dta) can be downloaded from SSC as follows:
The first line will show the dataset is accessible via the second line of the command. The second and third lines will then download alcoholengel.dta to the current working directory. Given this dataset, we can generate part of the empirical results of CFK15:
Here, logexp2 is the squared (logarithm of) total expenditure. Using cqiv command, the QIV estimation can be implemented with uncensored option:
And the CQR estimation with exogenous option:
Here are other possible examples of the CQIV estimation with different specifications and options. Outputs are all omitted.
In order of appearance, the commands conduct: the estimation using OLS in the first stage; the estimation using distribution regression with logistic distribution; the estimation where nkids is the only variable other than the instrument that is included in the first stage estimation; the estimation with two instruments and calculating the confidence interval using the weighted bootstrap; and the estimation calculating the marginal effects when censoring is due to corner solutions. In this particular example, logexp2 cannot be included in the first-stage regression when distribution regression is implemented. This is because logexp2 is a monotone transformation of logexp, and thus the distribution estimation yields a perfect fit.
\endinput
We would like to thank Simon J{\"a}ger, Blaise Melly and Sanna Nivakoski for helpful comments.