help qreg, help iqreg, help sqreg, dialogs: qreg iqreg
help bsqreg, help _qreg sqreg bsqreg
also see: qreg postestimation
-------------------------------------------------------------------------------
Title
[R] qreg -- Quantile regression
Syntax
Quantile regression
qreg depvar [indepvars] [if] [in] [weight] [, qreg_options]
Interquantile range regression
iqreg depvar [indepvars] [if] [in] [, iqreg_options]
Simultaneous-quantile regression
sqreg depvar [indepvars] [if] [in] [, sqreg_options]
Quantile regression with bootstrap standard errors
bsqreg depvar [indepvars] [if] [in] [, bsqreg_options]
Internal estimation command for quantile regression
_qreg [depvar [indepvars] [if] [in] [weight]] [, _qreg_options]
qreg_options description
-------------------------------------------------------------------------
Model
quantile(#) estimate # quantile; default is quantile(.5)
Reporting
level(#) set confidence level; default is level(95)
Optimization
optimization options control the optimization process; seldom used
wlsiter(#) attempt # weighted least-squares iterations
before doing linear programming iterations
-------------------------------------------------------------------------
iqreg_options description
-------------------------------------------------------------------------
Model
quantiles(# #) interquantile range; default is
quantiles(.25 .75)
reps(#) perform # bootstrap replications; default is
reps(20)
Reporting
level(#) set confidence level; default is level(95)
nodots suppress display of the replication dots
-------------------------------------------------------------------------
sqreg_options description
-------------------------------------------------------------------------
Model
quantiles(#[#[# ...]]) estimate # quantiles; default is quantiles(.5)
reps(#) perform # bootstrap replications; default is
reps(20)
Reporting
level(#) set confidence level; default is level(95)
nodots suppress display of the replication dots
-------------------------------------------------------------------------
bsqreg_options description
-------------------------------------------------------------------------
Model
quantile(#) estimate # quantile; default is quantile(.5)
reps(#) perform # bootstrap replications; default is
reps(20)
Reporting
level(#) set confidence level; default is level(95)
-------------------------------------------------------------------------
_qreg_options description
-------------------------------------------------------------------------
quantile(#) estimate # quantile; default is quantile(.5)
level(#) set confidence level; default is level(95)
accuracy(#) relative accuracy required for linear
programming algorithm; should not be
specified
optimization options control the optimization process; seldom used
-------------------------------------------------------------------------
by, mi estimate, rolling, statsby, and xi are allowed with qreg, iqreg,
sqreg, and bsqreg; fracpoly, mfp, nestreg, and stepwise are allowed
with qreg; see prefix.
qreg and _qreg allow aweights and fweights; see weight.
See [R] qreg postestimation for features available after estimation.
Menu
qreg
Statistics > Nonparametric analysis > Quantile regression
iqreg
Statistics > Nonparametric analysis > Interquantile regression
sqreg
Statistics > Nonparametric analysis > Simultaneous-quantile
regression
bsqreg
Statistics > Nonparametric analysis > Bootstrapped quantile
regression
Description
qreg fits quantile (including median) regression models, also known as
least-absolute-value models (LAV or MAD) and minimum L1-norm models.
iqreg estimates interquantile range regressions, regressions of the
difference in quantiles. The estimated variance-covariance matrix of the
estimators (VCE) is obtained via bootstrapping.
sqreg estimates simultaneous-quantile regression. It produces the same
coefficients as qreg for each quantile. Reported standard errors will be
similar, but sqreg obtains an estimate of the VCE via bootstrapping, and
the VCE includes between-quantile blocks. Thus you can test and
construct confidence intervals comparing coefficients describing
different quantiles.
bsqreg is equivalent to sqreg with one quantile.
_qreg is the internal estimation command for quantile regression. _qreg
is not intended to be used directly; if interested, see [R] qreg.
Options for qreg
+-------+
----+ Model +------------------------------------------------------------
quantile(#) specifies the quantile to be estimated and should be a number
between 0 and 1, exclusive. Numbers larger than 1 are interpreted as
percentages. The default value of 0.5 corresponds to the median.
+-----------+
----+ Reporting +--------------------------------------------------------
level(#); see [R] estimation options.
+--------------+
----+ Optimization +-----------------------------------------------------
optimization_options: iterate(#), [no]log, trace. iterate() specifies
the maximum number of iterations; log/nolog specifies whether to show
the iteration log; and trace specifies that the iteration log should
include the current parameter vector. These options are seldom used.
wlsiter(#) specifies the number of weighted least-squares iterations that
will be attempted before the linear programming iterations are
started. The default value is 1. If there are convergence problems,
increasing this number should help.
Options for iqreg
+-------+
----+ Model +------------------------------------------------------------
quantiles(# #) specifies the quantiles to be compared. The first number
must be less than the second, and both should be between 0 and 1,
exclusive. Numbers larger than 1 are interpreted as percentages.
Not specifying this option is equivalent to specifying
quantiles(.25 .75), meaning the interquartile range.
reps(#) specifies the number of bootstrap replications to be used to
obtain an estimate of the variance-covariance matrix of the
estimators (standard errors). reps(20) is the default and is
arguably too small. reps(100) would perform 100 bootstrap
replications. reps(1000) would perform 1,000 replications.
+-----------+
----+ Reporting +--------------------------------------------------------
level(#); see [R] estimation options.
nodots suppresses display of the replication dots.
Options for sqreg
+-------+
----+ Model +------------------------------------------------------------
quantiles(# [# [# ...]]) specifies the quantiles to be estimated and
should contain numbers between 0 and 1, exclusive. Numbers larger
than 1 are interpreted as percentages. The default value of 0.5
corresponds to the median.
reps(#) specifies the number of bootstrap replications to be used to
obtain an estimate of the variance-covariance matrix of the
estimators (standard errors). reps(20) is the default and is
arguably too small. reps(100) would perform 100 bootstrap
replications. reps(1000) would perform 1,000 replications.
+-----------+
----+ Reporting +--------------------------------------------------------
level(#); see [R] estimation options.
nodots suppresses display of the replication dots.
Options for bsqreg
+-------+
----+ Model +------------------------------------------------------------
quantile(#) specifies the quantile to be estimated and should be a number
between 0 and 1, exclusive. Numbers larger than 1 are interpreted as
percentages. The default value of 0.5 corresponds to the median.
reps(#) specifies the number of bootstrap replications to be used to
obtain an estimate of the variance-covariance matrix of the
estimators (standard errors). reps(20) is the default and is
arguably too small. reps(100) would perform 100 bootstrap
replications. reps(1000) would perform 1,000 replications.
+-----------+
----+ Reporting +--------------------------------------------------------
level(#); [R] estimation options.
Options for _qreg
quantile(#) specifies the quantile to be estimated and should be a number
between 0 and 1, exclusive. The default value of 0.5 corresponds to
the median.
level(#); see [R] estimation options.
accuracy(#) should not be specified; it specifies the relative accuracy
required for the linear programming algorithm. If the potential for
improving the sum of weighted deviations by deleting an observation
from the basis is less than this on a percentage basis, the algorithm
will be said to have converged. The default value is 10^-10.
optimization_options: iterate(#), [no]log, trace. iterate() specifies
the maximum number of iterations; log/nolog specifies whether to show
the iteration log; and trace specifies that the iteration log should
include the current parameter vector. These options are seldom used.
Examples
---------------------------------------------------------------------------
Setup
. webuse twogrp
Median regression
. qreg y x
Estimate .75 quantile
. qreg y x, quantile(.75)
---------------------------------------------------------------------------
Setup
. sysuse auto
Median regression
. qreg price weight length foreign
Replay results
. qreg
Estimate .25 quantile
. qreg price weight length foreign, quantile(.25)
Estimate .75 quantile
. qreg price weight length foreign, quantile(.75)
Estimate [.25, .75] interquantile range, performing 100 bootstrap
replications
. iqreg price weight length foreign, quantile(.25 .75) reps(100)
Same as above
. iqreg price weight length foreign, reps(100)
Estimate .25, .5, and .75 quantiles simultaneously, performing 100
bootstrap replications
. sqreg price weight length foreign, quantile(.25 .5 .75) reps(100)
Median regression with bootstrap standard errors
. bsqreg price weight length foreign
Estimate .75 quantile with bootstrap standard errors
. bsqreg price weight length foreign, quantile(.75)
---------------------------------------------------------------------------
Saved results
qreg saves the following in e():
Scalars
e(N) number of observations
e(df_m) model degrees of freedom
e(df_r) residual degrees of freedom
e(q) quantile requested
e(q_v) value of the quantile
e(sum_adev) sum of absolute deviations
e(sum_rdev) sum of raw deviations
e(f_r) residual density estimate
e(rank) rank of e(V)
e(convcode) 0 if converged; otherwise, return code for why
nonconvergence
Macros
e(cmd) qreg
e(cmdline) command as typed
e(depvar) name of dependent variable
e(properties) b V
e(predict) program used to implement predict
e(marginsnotok)
predictions disallowed by margins
Matrices
e(b) coefficient vector
e(V) variance-covariance matrix of the estimators
Functions
e(sample) marks estimation sample
iqreg saves the following in e():
Scalars
e(N) number of observations
e(df_r) residual degrees of freedom
e(q0) lower quantile requested
e(q1) upper quantile requested
e(reps) number of replications
e(sumrdev0) lower quantile sum of raw deviations
e(sumrdev1) upper quantile sum of raw deviations
e(sumadev0) lower quantile sum of absolute deviations
e(sumadev1) upper quantile sum of absolute deviations
e(rank) rank of e(V)
e(convcode) 0 if converged; otherwise, return code for why
nonconvergence
Macros
e(cmd) iqreg
e(cmdline) command as typed
e(depvar) name of dependent variable
e(vcetype) title used to label Std. Err.
e(properties) b V
e(predict) program used to implement predict
e(marginsnotok)
predictions disallowed by margins
Matrices
e(b) coefficient vector
e(V) variance-covariance matrix of the estimators
Functions
e(sample) marks estimation sample
sqreg saves the following in e():
Scalars
e(N) number of observations
e(df_r) residual degrees of freedom
e(n_q) number of quantiles requested
e(q#) the quantiles requested
e(reps) number of replications
e(sumrdv#) sum of raw deviations for q#
e(sumadv#) sum of absolute deviations for q#
e(rank) rank of e(V)
e(convcode) 0 if converged; otherwise, return code for why
nonconvergence
Macros
e(cmd) sqreg
e(cmdline) command as typed
e(depvar) name of dependent variable
e(eqnames) names of equations
e(vcetype) title used to label Std. Err.
e(properties) b V
e(predict) program used to implement predict
e(marginsnotok)
predictions disallowed by margins
Matrices
e(b) coefficient vector
e(V) variance-covariance matrix of the estimators
Functions
e(sample) marks estimation sample
bsqreg saves the following in e():
Scalars
e(N) number of observations
e(df_r) residual degrees of freedom
e(q) quantile requested
e(q_v) value of the quantile
e(reps) number of replications
e(sum_adev) sum of absolute deviations
e(sum_rdev) sum of raw deviations
e(rank) rank of e(V)
e(convcode) 0 if converged; otherwise, return code for why
nonconvergence
Macros
e(cmd) bsqreg
e(cmdline) command as typed
e(depvar) name of dependent variable
e(properties) b V
e(predict) program used to implement predict
e(marginsnotok)
predictions disallowed by margins
Matrices
e(b) coefficient vector
e(V) variance-covariance matrix of the estimators
Functions
e(sample) marks estimation sample
_qreg saves the following in r():
Scalars
r(N) number of observations
r(df_m) model degrees of freedom
r(q) quantile requested
r(q_v) value of the quantile
r(sum_w) sum of the weights
r(sum_adev) sum of absolute deviations
r(sum_rdev) sum of raw deviations
r(f_r) residual density estimate
r(ic) number of iterations
r(convcode) 1 if converged, 0 otherwise
Also see
Manual: [R] qreg
Help: [R] qreg postestimation;
[R] bootstrap, [R] regress, [R] rreg