1. Home
  2. RQLINEAR procedure

RQLINEAR procedure

Fits and plots quantile regressions for linear models (D.B. Baird).

Options

PRINT = string tokens What to print (model, estimates, summary, fittedvalues, correlations, wald, jointqtest, separateqtest); default mode, esti, summ, wald
PLOT = string tokens What to plot (rhistogram, phistograms, fittedvalues, estimates, bootestimates); default rhis, phis, fitt
TERMS = formula Terms to be fitted
WEIGHTS = variate Weights for data values; default equally weighted
CONSTANT = string token Whether to include a constant in the model (omit, estimate); default esti
FACTORIAL = scalar Limit on number of factors or variates in a term; default 3.
FITINDIVIDUALLY = string token Whether to fit the regression model one term at a time (yes, no); default no
FULL = string token Whether to assign all possible parameters to factors and interactions (yes, no); default no
BMETHOD = string token Bootstrap method (xy, weightedxy); default xy
NBOOT = scalar Number of times to bootstrap data to estimate confidence limits; default 200
SEED = scalar Seed for bootstrap randomization; default 0
CIPROBABILITY = scalar Probability level for confidence interval; default 0.95
XPLOT = variate Variate to plot fitted values against; default 1st variate in model

Parameters

Y = variates Response variate
PRQUANTILES = scalars or variates Proportions at which to calculate quantiles; default 0.5
RESIDUALS = variates or pointers Residuals from regression for each quantile
FITTEDVALUES = variates or pointers Fitted values from regression for each quantile
ESTIMATES = variates or pointers Estimated coefficients of model terms for each quantile
SE = variates or pointers Standard errors of the estimated coefficients for each quantile
VCOVARIANCE = symmetric matrices or pointers Variance-covariance matrix of estimates for each quantile
DF = scalars or variates Numbers of degrees of freedom fitted by the model
LOWER = variates or pointers Lower confidence limit of coefficients for each quantile
UPPER = variates or pointers Upper confidence limit of coefficients for each quantile
LOWFITTEDVALUES = variates or pointers Lower confidence limit of fitted values for each quantile
UPPFITTEDVALUES = variates or pointers Upper confidence limit of fitted values for each quantile
OBJECTIVE = scalars or variates Optimal values of the objective function
EXIT = scalars or variates Exit codes indicating whether the estimation was successful

Description

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 LOESS or SPLINE models. The FACTORIAL, CONSTANT and FULL options control how the model is constructed, as in the ordinary regression commands (see e.g. FIT or TERMS). 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 PRINT option with settings:

    model the details of model that is being fitted;
    summary a summary of the fit;
    estimates the model estimates (and confidence limits, standard errors and t-values if bootstrapping is used);
    fittedvalues the residuals and fitted values from the model;
    correlation correlations between the estimates;
    wald Wald Statistic for each model term;
    jointqtest the significance of the joint changes in the model parameters (excepting the intercept) between the quantiles; and
    separateqtest 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 jointqtest and 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.

The PLOT option controls what plots are displayed, with settings

    rhistogram histograms of residuals;
    phistograms histograms of the bootstrap estimates for each parameter;
    fittedvalues observed and fitted values plotted against the explanatory variate specified by the XPLOT option (if XPLOT is not set, the first explanatory variate is used);
    estimates parameter estimates plotted against the quantiles;
    bootestimates 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 TERMS statement.

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 ESTIMATES, FITTEDVALUES, RESIDUALS, LOWER, UPPER, SE, LOWFITTEDVALUES and 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 DF, OBJECTIVE and 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.

Options: PRINT, PLOT, TERMS, WEIGHTS, CONSTANT, FACTORIAL, FITINDIVIDUALLY, FULL, BMETHOD, NBOOT, SEED, CIPROBABILITY, XPLOT.

Parameters: Y, PRQUANTILES, RESIDUALS, FITTEDVALUES, ESTIMATES, SE, VCOVARIANCE, DF, LOWER, UPPER, LOWFITTEDVALUES, UPPFITTEDVALUES, OBJECTIVE, EXIT.

Method

The 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).

Action with RESTRICT

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.

References

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.

See also

Directive: FRQUANTILES.

Procedures: RQNONLINEAR, RQSMOOTH.

Commands for: Regression analysis.

Example

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)
Updated on June 18, 2019

Was this article helpful?