Fits and plots quantile regressions for linear models (D.B. Baird).
|What to print (
||What to plot (
||Terms to be fitted|
||Weights for data values; default equally weighted|
||Whether to include a constant in the model (
||Limit on number of factors or variates in a term; default 3.|
||Whether to fit the regression model one term at a time (
||Whether to assign all possible parameters to factors and interactions (
||Bootstrap method (
||Number of times to bootstrap data to estimate confidence limits; default 200|
||Seed for bootstrap randomization; default 0|
||Probability level for confidence interval; default 0.95|
||Variate to plot fitted values against; default 1st variate in model|
||Proportions at which to calculate quantiles; default 0.5|
||Residuals from regression for each quantile|
||Fitted values from regression for each quantile|
||Estimated coefficients of model terms for each quantile|
||Standard errors of the estimated coefficients for each quantile|
||Variance-covariance matrix of estimates for each quantile|
||Numbers of degrees of freedom fitted by the model|
||Lower confidence limit of coefficients for each quantile|
||Upper confidence limit of coefficients for each quantile|
||Lower confidence limit of fitted values for each quantile|
||Upper confidence limit of fitted values for each quantile|
||Optimal values of the objective function|
||Exit codes indicating whether the estimation was successful|
RQLINEAR calculates and plots quantile regressions. The dependent variate is specified by the
Y parameter. The proportions (between 0 and 1) for which the model is to be fitted are specified by the
PRQUANTILES parameter, as a scalar is there is only one, or a variate if there are several. The default value for
PRQUANTILES is 0.5, i.e. the median.
The model defining the explanatory terms is specified by the
TERMS option, and can include variates, factors and polynomial terms, and interactions between them.
RQLINEAR cannot fit
SPLINE models. The
FULL options control how the model is constructed, as in the ordinary regression commands (see e.g.
FACTORIAL option sets a limit on the number of factors and/or variates in each terms,
CONSTANT option allows you to omit the constant term, and
FULL controls how each term is parameterized.
Output is controlled by the
||the details of model that is being fitted;|
||a summary of the fit;|
||the model estimates (and confidence limits, standard errors and t-values if bootstrapping is used);|
||the residuals and fitted values from the model;|
||correlations between the estimates;|
||Wald Statistic for each model term;|
||the significance of the joint changes in the model parameters (excepting the intercept) between the quantiles; and|
||the significance of the changes in the individual model parameters between the quantiles.|
Correlations and Wald statistics are available only if bootstrapping is done. If option
FITINDIVIDUALLY=yes, the model terms are added in one at a time, and the Wald statistics are given for for each step. Otherwise only an overall test of the full model versus the null model (i.e. just the constant) is provided. The settings
separateqtest are relevant only if several quantiles have been requested by
PRQUANTILES. These compare the differences between all the quantiles in a single test. So if you want to compare quantiles for two specific proportions, you should set
PRQUANTILES to just those two values.
PLOT option controls what plots are displayed, with settings
||histograms of residuals;|
||histograms of the bootstrap estimates for each parameter;|
||observed and fitted values plotted against the explanatory variate specified by the
||parameter estimates plotted against the quantiles;|
||parameter estimates and bootstrap confidence limits plotted against quantiles (note this plot can be slow to produce).|
For the fitted plot, the observed and fitted values can be plotted against a specific variate given by the option
XPLOT, rather than just the default which is the first variate in the
BMETHOD option controls the method that is used to obtain standard errors and confidence limits by bootstrapping for the parameter estimates and fitted values. The
xy setting re-samples the units with replacement; this is the default. Alternatively, the
weightedxy setting uses all the units but with weights are generated from a exponential distribution with mean 1. Bootstrapping can be slow, you can set
BMETHOD=* to stop any being done. The
NBOOT option specifies the number of bootstrap samples that are taken, and the
CIPROBABILITY option sets the size of the confidence limits. The
SEED option defines the seed for the random numbers that are used to select the bootstrap samples. The default of zero continues the existing sequence of random numbers if any have already been used in the current Genstat job. If none have been used, Genstat picks a seed at random.
The results from the model fit can be saved in various parameters. The
UPPFITTEDVALUES parameters save their results in variates if only one quantile has been defined, or in pointers to a set of variates (one for each quantile) if there were several. Similarly
VCOVARIANCE saves a symmetric matrix, or a pointer to several symmetric matrices, while
EXIT save either a scalar or a variate (with a value for each quantile).
EXIT saves the value of the exit code from the estimation of each set of regression quantiles by the
FRQUANTILES directive (which is used inside
RQLINEAR): a value of zero indicates that the estimation was successful, a value of one means the solution is non-unique (this may not be a problem, as the returned solution will still be optimal), and a value of two means the algorithm has failed.
TERMS directive is used to form a design matrix for the model, and the
FRQUANTILES directive is then used to to estimate the regression quantiles. For further details of the underlying methodology, see Koenker & D’Orey (1987) or Koenker (2005).
Restrictions on the
Y variate or on variates or factors in the
TERMS model are combined, and only those units which are unrestricted in all structures are used in the regression. However, restrictions on the
WEIGHTS variate are ignored.
Koenker, R. (2005). Quantile Regression. Cambridge University Press, New York.
Koenker, R.W. & D’Orey, V. (1987). Algorithm AS229 computing regression quantiles. Applied Statistics, 36, 383-393.
Commands for: Regression analysis.
CAPTION 'RQLINEAR example'; STYLE=meta SPLOAD '%GENDIR%/Examples/Engel.gsh' RQLINEAR [PRINT=#,separateqtest; PLOT=fit,boot; TERMS=Income;\ BMETHOD=xy; NBOOT=200; SEED=412261] Food_Exp;\ PRQUANTILES=!(0.1,0.25,0.5,0.75,0.9)