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

### Options

`PRINT` = string tokens |
What to print (`model` , `estimates` , `summary` , `fittedvalues` , `correlations` , `monitoring` ); default `mode` , `esti` , `summ` |
---|---|

`PLOT` = string tokens |
What to plot (`rhistogram` , `phistograms` , `fittedvalues` , `confidencelimits` ); default `phis` , `fitt` , `conf` |

`X` = variates |
Variates to fit in the model |

`DATA` = variates or factors |
Data to bootstrap in parallel with `Y` ; default takes the variates and factors of the same length as `Y` involved in the `CALCULATION` expressions |

`CONSTANT` = string token |
Whether to include a constant in the model (`omit` , `estimate` ); default `esti` |

`CALCULATION` = expression structures |
Calculation of explanatory variates involving nonlinear parameters |

`PARAMETERS` = pointer |
Pointer to scalars representing the nonlinear parameters to be optimized in the expressions |

`INITIAL` = variate |
Initial values for parameters |

`LOWPARAMETERS` = variate |
Lower bound for parameters |

`UPPPARAMETERS` = variate |
Upper bound for parameters |

`STEPLENGTHS` = variate |
Step sizes for parameters |

`LINEARPARAMETERS` = pointer |
Pointer to scalars representing the linear parameters in the model (including the constant) |

`METHOD` = string token |
Which optimization method to use (`gaussnewton` , `newtonraphson` , `fletcherpowell` , `simplex` ); default `gaus` |

`NBOOT` = scalar |
Number of times to bootstrap data to estimate confidence limits; default 100 |

`SEED` = scalar |
Seed for bootstrap randomization; default 0 |

`CIPROBABILITY` = scalar |
Probability level for confidence interval; default 0.95 |

`MAXCYCLE` = scalar |
Maximum number of iterations for optimization; default 200 |

`XPLOT` = variate |
Variate to plot fitted values against; default is the first variate on the right-hand side of the `CALCULATION` expressions |

### Parameters

`Y` = variates |
Response variates |
---|---|

`PRQUANTILE` = scalars |
Proportion at which to calculate the quantile for each response variate; default 0.5 |

`RESIDUALS` = variates |
Residuals from the nonlinear model |

`FITTEDVALUES` = variates |
Fitted values from the nonlinear model |

`ESTIMATES` = variates |
Estimates of the parameters in the model (nonlinear, linear and constant) |

`SE` = variates |
Standard errors of the parameters |

`VCOVARIANCE` = symmetric matrices |
Variance-covariance matrix for the parameters |

`LOWER` = variates |
Lower confidence limits for the parameters |

`UPPER` = variates |
Upper confidence limits for the parameters |

`LOWFITTEDVALUES` = variates |
Lower confidence limits for the fitted values |

`UPPFITTEDVALUES` = variates |
Upper confidence limits for the fitted values |

`OBJECTIVE` = scalars |
Optimal values of the objective function |

`TITLE` = texts |
Titles for fitted value graphs |

### Description

`RQNONLINEAR`

calculates and plots quantile nonlinear regressions. The dependent variate is specified by the `Y`

parameter. The proportion (between 0 and 1) for which the model is to be fitted is specified by the `PRQUANTILE`

parameter, as a scalar is there is only one. The default value is 0.5, i.e. the median.

The `X`

option lists the variates that are to be fitted in the model. Some of these will be functions of nonlinear parameters, which must be be supplied (as a set of scalars in a pointer) using the `PARAMETERS`

option. The `CALCULATION`

option supplies a list of expression structures to calculate the values of the relevant `X`

variates (from the parameters and other data structures). By default the model will include the constant, but this can be omitted by setting option `CONSTANT=omit`

. The `LINEARPARAMETERS`

option can be set to a pointer containing a set of scalars to represent the linear parameters in the model (i.e. the regression coefficients and the constant, if present). Initial values, lower and upper bounds and step lengths for the parameters are supplied, in variates, by the `INITIAL`

, `LOWPARAMETER`

, `UPPPARAMETER`

and `STEPLENGTHS`

options, respectively. The `METHOD`

option specifies the method to use to estimate the nonlinear parameters. The settings `gaussnewton`

, `newtonraphson`

and `fletcherpowell`

use the `FITNONLINEAR`

directive, with the Gauss-Newton, Newton-Raphson or Fletcher-Powell optimization methods, respectively. These methods require initial values to be supplied. The simplex setting uses the `SIMPLEX`

procedure, which requires lower and upper bounds to be supplied. The `MAXCYCLE`

option specifies the maximum number of iterations to be used.

Output is controlled by the `PRINT`

option with settings:

`model` |
a description of the model; |
---|---|

`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; and |

`monitoring` |
monitoring information for the fit. |

Correlations are available only if bootstrapping is done.

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); |

`confidenceintervals` |
includes confidence intervals in the fitted-value plot (available only if bootstrapping is done). |

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 right-hand side of the `CALCULATION`

expressions. The `TITLE`

parameter can supply a title for the plot.

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. `RQNONLINEAR`

can automatically select the data vectors to bootstrap along with the `Y`

variate: they consist of all the variates or factors on the right-hand side of the `CALCULATION`

expressions that are of the same length as Y, plus any `X`

variates that are not calculated by the expressiions. If this does not produce the correct set of vectors for bootstrapping, you can specify them automatically using the `DATA`

option.

The results from the nonlinear fit can be saved by the parameters `RESIDUALS`

, `FITTEDVALUES`

, `ESTIMATES`

, `SE`

, `VCOVARIANCE`

, `DF`

, `LOWER`

, `UPPER`

, `LOWFITTEDVALUES`

, `UPPFITTEDVALUES`

and `OBJECTIVE`

.

Options: `PRINT`

, `PLOT`

, `X`

, `DATA`

, `CONSTANT`

, `CALCULATION`

, `PARAMETERS`

, `INITIAL`

, `LOWPARAMETER`

, `UPPPARAMETER`

, `STEPLENGTHS`

, `LINEARPARAMETERS`

, `METHOD`

, `NBOOT`

, `SEED`

, `CIPROBABILITY`

, `MAXCYCLE`

, `XPLOT`

.

Parameters: `Y`

, `PRQUANTILES`

, `RESIDUALS`

, `FITTEDVALUES`

, `ESTIMATES`

, `SE`

, `VCOVARIANCE`

, `LOWER`

, `UPPER`

, `LOWFITTEDVALUES`

, `UPPFITTEDVALUES`

, `OBJECTIVE`

, `TITLE`

.

### Method

The nonlinear parameters are estimated by either `FITNONLINEAR`

or `SIMPLEX`

, operating on a target function in which the objective function from the quantile regression is calculated by the `RQOBJECTIVE`

function. The `FRQUANTILES`

directive is then used to obtain the estimates of the linear parameters. 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 `X`

variates or factors are combined, and only those units which are unrestricted in all structures are used in the regression.

### 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: `RQLINEAR`

, `RQSMOOTH`

.

Function: `RQOBJECTIVE`

.

Commands for: Regression analysis.

### Example

CAPTION 'RQNONLINEAR example'; STYLE=meta VARIATE [VALUES=0,0.2...7.6] X & [VALUES=2.204,2.950,3.982,3.700,4.804,5.241,5.588,\ 5.268,7.171,7.898,7.248,7.815,6.323,6.981,6.415,\ 8.008,6.676,8.954,7.798,9.826,8.570,8.836,9.521,\ 10.297,7.554,8.910,10.156,9.103,10.070,8.652,6.878,\ 9.429,11.325,7.563,10.534,9.804,8.697,6.861,8.749] Y EXPRESSION expx; VALUE=!e(Z=EXP(-C*X)) RQNONLINEAR [PRINT=model,estimates,summary,monitoring;\ PLOT=fitted,confidence; X=Z; CALCULATION=expx;\ PARAMETERS=!p(C); INITIAL=!(0.5); SEED=13; MAXCYCLE=500]\ 3(Y); PRQUANTILE=0.25,0.5,0.75