Controls iterative fitting of generalized linear, generalized additive and nonlinear models, and specifies parameters, bounds etc for nonlinear models.
Options
MAXCYCLE = scalars |
Maximum number of iterations for Fisher-scoring algorithm (used in generalized linear models), back-fitting algorithm (used in additive models) and nonlinear algorithms; single setting implies the same limit for all; default 15, 15, 30 |
---|---|
TOLERANCE = scalar or variate |
Scalar or first unit of a variate defines the convergence criterion for the relative change in deviance and, if required, the second element of a variate defines the criterion for convergence to a zero deviance; default !(0.0001,1.0E-11) |
FITTEDVALUES = variate |
Initial fitted values for generalized linear model; default * |
METHOD = string token |
Algorithm for fitting nonlinear model (GaussNewton, NewtonRaphson, FletcherPowell); default Gaus , but Newt for scalar minimization |
LINEARPARAMETERS = scalars |
Scalars to hold current values of linear parameters used in nonlinear model, for reference within model calculations |
Parameters
PARAMETER = scalars |
Nonlinear parameters in the model |
---|---|
LOWER = scalars |
Lower bound for each parameter |
UPPER = scalars |
Upper bound for each parameter |
STEPLENGTH = scalars |
Initial step length for each parameter |
INITIAL = scalars |
Initial value for each parameter |
Description
RCYCLE
can be used, after MODEL
, to modify aspects of the optimization process used by later FIT
, FITCURVE
and FITNONLINEAR
directives.
The MAXCYCLE
option can be set to a list of three scalars to specify respectively the maximum number of iterations to be used in the Fisher-scoring algorithm used to fit a generalized linear model, the back-fitting algorithm used in generalized additive models, and the algorithms for nonlinear models. These have the defaults 15, 15 and 30. If a single value is supplied, it is taken to apply to all three situations.
The TOLERANCE
option can be set to a scalar or a variate to control the criterion for convergence in generalized linear and generalized additive models. A scalar or the first unit of a variate defines the convergence criterion for the relative change in deviance (default 0.0001). The iteration stops when the absolute change in deviance in successive cycles is less than the tolerance multiplied by the current value of the deviance. The second element of a variate defines the criterion for convergence to a zero deviance. If TOLERANCE
is unset, or if it is set to a scalar, the default criterion for zero deviance is 1.0E-11.
The algorithm for generalized linear models has to start by estimating an initial set of fitted values. Genstat usually obtains these by a simple transformation of the observed responses. It may be that better estimates are available, for example from a previously fitted model; if so, you can supply them by the FITTEDVALUES
option.
The PARAMETER
, STEPLENGTH
and INITIAL
parameters can be used to supply initial step lengths and initial values for the nonlinear parameters in the standard curves fitted by FITCURVE
, although this will usually not be necessary; FITCURVE
has effective ways of its own to ascertain good starting value for each parameter, for example by a short grid search or by some manipulation of the data values. The parameters must be listed in the same order as Genstat uses to print them. RCYCLE
defines the identifiers as scalars holding the initial values that you have supplied; after the model has been fitted they contain the estimated values of the parameters.
The other parameters are relevant only to general nonlinear models fitted by FITNONLINEAR
or FIT
. The PARAMETER
parameter then merely lists the scalars that are used to represent the nonlinear parameters in the model calculations, the LOWER
and UPPER
parameters specify bounds, the STEPLENGTH
parameter specifies initial step lengths, and the INITIAL
parameter specifies initial values. The METHOD
option is also relevant only for general nonlinear models, when it specifies the optimization method to be used. (Bounds are determined automatically for standard curves, and Genstat then always uses a modified Newton method.)
Options: MAXCYCLE
, TOLERANCE
, FITTEDVALUES
, METHOD
, LINEARPARAMETERS
.
Parameters: PARAMETER
, LOWER
, UPPER
, STEPLENGTH
, INITIAL
.
See also
Directives: FIT
, FITCURVE
, FITNONLINEAR
.
Commands for: Regression analysis.
Example
" Example FITN-1: Fitting a standard curve using FITNONLINEAR Modelling the relationship between yield of sugar from cane and amount of nitrogen fertilizer. NOTE: this model is fitted most efficiently in Genstat by the FITCURVE directive with option CURVE=exponential. This example is to illustrate the use of FITNONLINEAR, which is really provided for fitting models that are not in FITCURVE." READ Nitrogen,Yield 0 60 0 73 0 77 0 72 50 125 50 144 50 145 50 116 100 152 100 154 100 160 100 141 150 182 150 167 150 181 150 185 200 198 200 188 200 189 200 182 : " 1) Three parameters treated as nonlinear" MODEL Yield; FITTED=Expon RCYCLE PARAMETER=Rate,Range,Inter; INITIAL=0.95,-100,100;\ UPPER=1,*,*; STEP=0.01,*,* EXPRESSION [VALUE=(Expon=Inter+Range*Rate**Nitrogen)] Calcexp FITNONLINEAR [CALCULATION=Calcexp] " Display the fitted curve. Note that the parameter of the RGRAPH procedure must be set to the x-variate to be used in the plot after a nonlinear fit." RGRAPH [GRAPHICS=high] Nitrogen " Plot residuals against fitted values. Note that the RCHECK procedure cannot be used to check assumptions after a nonlinear fit." RKEEP RESIDUAL=r; FITTED=f DGRAPH r; f " 2) Linear parameters separated" MODEL Yield RCYCLE PARAMETER=Rate; INITIAL=0.95; UPPER=1; STEP=0.01 EXPRESSION [VALUE=(Expon=Rate**Nitrogen)] Calcexp FITNONLINEAR [PRINT=model,summary,estimates,correl,fitted;\ CALCULATION=Calcexp] Expon " Estimate s.e.s for linear parameters as well" FITNONLINEAR [PRINT=m,s,e,c; CALCULATION=Calcexp; SELINEAR=yes] Expon " 3) Explicit likelihood" MODEL [FUNCTION=Sum] RCYCLE PARAMETER=Rate,Range,Inter; INITIAL=0.95,-100,100;\ UPPER=1,*,*; STEP=0.001,*,* EXPRESSION [VALUE=(Sum=SUM((Yield-Inter-Range*Rate**Nitrogen)**2))]\ Calcexp FITNONLINEAR [CALC=Calcexp] " To provide true standard errors, multiply SE by residual variance." RKEEP ESTIMATES=Estimates; SE=se CALC sigma2 = Sum / (NVALUES(Yield) - 3) & se = se * SQRT(sigma2) PRINT Estimates,se