*! version 0.1 - 6 Jun 2016
help fqreg

Title

fqreg -- Quantile regression for non-negative data with a mass-point at zero and an upper bound

Syntax

fqreg
depvar
indepvars
[if] [in]
[, options]

quantile(#) estimate # quantile; default is quantile(.5)

ul(#) specifies the upper limit of the dependent variable; by default the upper limit is 1

gamma starting value for gamma if one is not provided using the from option (see maximize_options); by default gamma is set to 0

wlsiter(#) attempt # weighted least-squares iterations before doing linear programming iterations for the determination of starting values; default is wlsiter(1)

cluster(clustvar) specifies that the standard errors allow for intragroup correlation

margins(varlist) compute average marginal effects for varlist

nose suppresses calculation of the VCE and standard errors for the margins

nowarning suppress "convergence not achieved" message of iterate(0)

maximize_options control the maximization process

Weights are not allowed.

Description

fqreg estimates quantile regression for non-negative data with a mass-point at zero and an upper bound, using
the specification and method described in Machado, Santos Silva, and Wei (2016).

Besides the usual table with results, fqreg reports the estimated quantile, the value of the R2 (defined
as the square of the correlation between the dependent variable and its fitted values), the number of observations,
the percentage of observations for which the estimated quantile is equal to zero, and the value of the objective
function, which is proportional to the average of the check function.

The command fqreg uses Stata's [R] ml command to perform the estimation.
Therefore, fqreg shares many characteristics of the ml command, including its limitations and
benefits. For example, after fqreg is used to estimate a model, it is possible to get predictions or
test hypotheses about the parameters exactly in the same way as it is done after estimation with ml.
Also as with ml, convergence can be difficult if the dependent variable has very large values.

fqreg also has an option to estimate average marginal effects; for dummy variables the marginal effect is the discrete change from the base level, other variables are treated as continuous. If this option is used, it is not
possible to compute predictions after the command and the tests that are performed are about the marginal
effects, not the parameters.

Options

ul(#) specifies the upper limit of the dependent variable; by default the upper limit is 1.
Stata often finds it difficult to estimate models with large values of the dependent variable.
Therefore, when convergence is difficult to achieve, it may be helpful to rescale the dependent
variable so that it is bounded between zero and 1. The estimated coefficients will not be affected
by the rescaling but the estimated marginal effects will be in the scale of the new variable.

gamma starting value for gamma if one is not provided using the from option (see
maximize_options); by default gamma is set to 0.

cluster(clustvar) by default fqreg computes heteroskedasticity robust standard errors. The cluster
option specifies that the standard errors also allow for intragroup correlation, relaxing the usual
requirement that the observations be independent. That is, the observations are independent across groups
(clusters) but not necessarily within groups. clustvar specifies to which group each observation
belongs. cluster(clustvar) affects the standard errors and variance-covariance matrix of
the estimators but not the estimated coefficients; see .

margins(varlist) compute average marginal effects for varlist. For dummy variables the marginal effect is the discrete change from the base level, other variables are treated as continuous

nose suppresses calculation of the VCE and standard errors for the margins. Note that computation of
the standard errors for the margins can be very time consuming.

maximize_options:
technique(string),
iterate(#),
nolog,
trace,
difficult,
gradient,
showstep,
hessian,
showtolerance,
tolerance(#),
ltolerance(#),
nrtolerance(#),
nonrtolerance,
from(init_specs); see [R] maximize for more details.

Remarks

fqreg is not an official Stata command and was written by J.A.F. Machado, J.M.C. Santos Silva, and K. Wei.
For further help and support, please contact jmcss@surrey.ac.uk. Please notice that this software is provided
as is, without warranty of any kind, express or implied, including but not limited to the warranties of
merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors be liable
for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from,
out of or in connection with the software or the use or other dealings in the software.

Examples

Setup - generate a discrete and a continuous regressor and then generate y bounded between 0 and 1

. clear all

. set obs 10000

. set seed 13813

. g x1=rbinomial(1,0.4)

. g x2=rnormal(0,1)

. g y=rbinomial(5000,max(1e-5,((1 + 1)*(exp(1+0.5*x1-1*x2)/(1+exp(1+0.5*x1-1*x2)))-1)))/5000

Estimation of the conditional median suppressing the log

. fqreg y x1 x2, nolog

Estimation of the conditional median and compute margins

. fqreg y x1 x2, m(x1 x2)

Estimation of the conditional first quartile

. fqreg y x1 x2, q(.25)

Saved results

The output saved in e() by fqreg depends on whether or not the option margins is used. By default margins
is not used and the output saved in e() is essentially the same that is saved by ml. Some of the more relevant
results are listed below and more details can be seen in maximize. When the option margins is used the output saved
in e() is the same that is saved by margins; again, some of the more relevant results are listed below
and more details can be seen in margins.

By default, the output saved in e() includes:

Scalars

e(N) number of observations

e(ic) number of iterations

e(k) number of parameters (includes the parameters corresponding to the base category of the dummy variables, which are set to zero)

e(converged) 1 if converged, 0 otherwise

e(rc) return code

e(ll) value of the objective function (times -1)

e(r2) R-squared, computed as the square of the correlation between the dependent variable and its fitted values

e(N_clust) number of clusters

e(q) quantile requested

e(k_eq) number of equations in e(b)

e(k_dv) number of dependent variables

e(df_m) model degrees of freedom

Macros

e(depvar) name of dependent variable

e(cmd) fqreg

e(predict) program used to implement predict

e(vce) vcetype specified in vce()

e(vcetype) title used to label Std. Err.

e(clustvar) name of cluster variable

e(which) max or min; whether optimizer is to perform
maximization or minimization

e(ml_method) type of ml method

e(user) name of likelihood-evaluator program

e(technique) maximization technique

e(properties) b V

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

e(ilog) iteration log (up to 20 iterations)

e(gradient) gradient vector

Functions

e(sample) marks estimation sample

When the option margins is used, the output saved in e() includes:

Scalars

e(N) number of observations

Macros

e(cmd) margins

e(model_vce) vcetype from estimation command

e(model_vcetype) Std. Err. title from estimation command

e(vce) vcetype specified in vce()

e(vcetype) title used to label Std. Err.

e(expression) prediction expression

e(properties) b V

Matrices

e(b) estimates

e(V) variance-covariance matrix of the estimates

e(_N) sample size corresponding to each margin estimate

Functions

e(sample) marks estimation sample

Reference

Machado, J.A.F., Santos Silva, J.M.C., and Wei, K. (2016),
"Quantiles, Corners, and the Extensive Margin of Trade," European Economic Review, forthcoming.

Also see

Manual: [R] ml

Last modified on 6 June 2016