```help for xrigls                                                 Patrick Royston
-------------------------------------------------------------------------------

Reference Interval Estimation by Generalized Least Squares

Syntax

xrigls yvar xvar [if] [in] [, major_options minor_options]

options                       Description
-------------------------------------------------------------------------
major_options
alpha(#)                    specifies significance level for testing
between FP functions
centile(# [# ...])          defines the centiles of yvar|xvar
cv                          models the S-curve as a coefficient of
variation
detail                      displays the final regression models
fp([m:term] [s:term])       specifies fractional polynomial models
minor_options
covars([m:vars] [s:vars])   includes variables as predictors of the
mean and/or SD curve
cycles(#)                   determines the number of fitting cycles
nograph                     suppresses the graph of the results
noleave                     prevents the creation of new variables
notidy                      preserves fractional polynomial
transformations
powers(powlist)             defines powers for fractional polynomials
ropts([m:mopts] [s:sopts])  determines regression options
saving(filename[, replace]) saves the graph to a file
se                          calculates standard errors of estimated
centile curves
-------------------------------------------------------------------------

where term is of the form [powers] # [# ...]|df #.

Description

xrigls calculates reference intervals for yvar based on the xvar- (e.g.
age-) specific mean and standard deviation of yvar.  yvar is assumed to
be Normally distributed, conditional on xvar.

Options

+-------+
----+ Major +------------------------------------------------------------

alpha(#) specifies the significance level for testing between degrees of
FP for the mean and SD curves. Default : 0.05.

centile(# [#...]) defines the required centiles of yvar|xvar.  Default is
3 and 97 (i.e. a 94% reference interval).

cv models the S-curve as a coefficient of variation.

detail displays the final regression models for the mean and SD curves.

fp([m:term [, s:term]{cmd:) specifies fractional polynomial models in
xvar for the mean and SD curves. term is of form [powers] # [#
...]|df #.  The phrase powers is optional.  The powers should be
separated by spaces, for example fp(m:powers 0 1, s:powers 2). If
powers or df are not given for any curve, the default is cmd:fp(m:df
4,s:df 2)}. df # specifies that the degrees of freedom for the
best-fitting FP model are to be at most # for the curve in question.
The powers are then determined from the data.

+-------+
----+ Minor +------------------------------------------------------------

covars([m:vars [, s:vars]{cmd:) includes variables as predictors in the
regression model for the mean and/or SD (S) curves.

cycles(#) determines the number of fitting cycles (fit mean, calculate
absolute residuals, fit absolute residuals, recalculate weights,
etc.).  The default value of # is 2: an initial (unweighted) fit for
the mean is followed by an unweighted fit of the absolute residuals;
weights are calculated, and one weighted fit for the mean, one
weighted fit for the absolute residuals and a final weighted fit for
the mean are carried out.

nograph suppresses a plot of yvar against xvar with fitted values and
reference limits superimposed.  The default is to have the graph.

noleave prevents the creation of new variables. The default (leave)
causes new variables, appropriately labelled, containing the
estimated mean, SD, Z- scores for yvar and also the centiles
specified in centile(), to be created.

noselect specifies that the degree of FP will be that specified in the
fp() option. The default is to select a lower order FP if the
likelihood ratio test has P-value alpha().

notidy preserves the variables created in the routine representing the
fractional polynomials powers of the xvar used in the analysis.

powers(powlist) specifies powers for FP models. Default powlist is -2,
-1,-0.5, 0, 0.5, 1, 2, 3 (0 meaning log).

ropts([m:mopts] [,] [s:sopts]) determines the regression options for the
mean and SD regression models.  Example: ropt(m:nocons) suppresses
the constant for the mean curve.

saving(filename[, replace] saves the graph to a file (see nograph).

se calculates the standard errors of the estimated centile curves.

Remarks

yvar is assumed to have a normal (Gaussian) distribution.  If a constant
SD is assumed, it is estimated by the residual mean square in the usual
way.  Otherwise, the SD is estimated by regression of the absolute
residuals on an FP in xvar.  The SD's are the predicted values from this
regression, multiplied by the square root of pi/2 (i.e. 1.2533...).
Since the correct regression for yvar should include weights proportional
to the reciprocal of the squared SD, the regression for yvar is repeated
using weights equal to the squared reciprocal of the fitted SDs. At each
iteration, models of lower degree are also fitted. The FP with the lowest
degree (k), for which the FP with degree k+1 is not a significantly
better fit, is selected. The selection criteria between models may be
specified.

xrigls displays the deviance (-2 * ln likelihood) for the entire model
(including weights derived from the fitted SD). In general, the lower the
deviance, the better the fit of the model.

Examples

. sysuse auto

. xrigls mpg weight, fp(m:1 3,s:2 2) centile(10 90) cycles(3)

The FP model with powers (1,3) is used for the mean, and the FP model
with powers (2,2) for the SD.  Three cycles are performed. The results
are saved in new variables. A graph of the resulting 10th, 50th and 90th
centiles (or 80% reference interval) is given.

. xrigls mpg weight, fp(m:df 2,s:df 2) noselect powers(1 2 3) cv

The model for the mean of mpg is the best FP1 function of weight, and for
the CV, the best degree-1 FP function of weight. The chosen powers will
be a subset of {1,2,3}. A graph of the resulting 94% reference interval
and new variables are also given.

. xrigls mpg weight, alpha(0.1) fp(m:df 2,s:df 2)

For both the mean and SD, a selection will be made between the best
degree-1 FP function, linear and constant fits using a significance level
of 10% in the the likelihood-ratio tests.

Stored Results

xrigls is an R-class program and saves in the r() functions:

r(dev)  deviance of final model
`r(mpow)'       powers in final FP model for mean curve
`r(spow)'       powers in final FP model for SD curve

Authors

Patrick Royston, MRC Clinical Trials Unit, London.
pr@ctu.mrc.ac.uk

Eileen Wright, Macclesfield

Also see

```