Carries out analysis of parallelism for nonlinear functions; synonym
FITPARALLEL (R.C. Butler).
|What to print (
||Calculation(s) involving explanatory variate; no default (must be set)|
||Which models to fit (
||How to treat constant (
||Explanatory variate; must be set|
||Grouping factor for data; must be set|
||To save results from model
This procedure mimics the testing of parallelism which can be carried out using
FITCURVE, but caters for any nonlinear functions or sums of nonlinear functions.
FITCURVE can be used successively to fit four models with varying degrees of parallelism between curves fitted to different levels of a grouping factor where each curve is the same function of an explanatory variate, but only has a limited choice of ten curves.
RPARALLEL will fit these same four models for any function (or sum of functions) that the user defines.
Definitions – Take a response variate Y and explanatory variate X, and functions f(X; θ) to describe the relationship between them, where θ represents the parameters of f. Levels of a factor are denoted by i, and j denotes values of X for each level of the factor. Ai, Bi and θi are the constant, slope, and nonlinear parameters for factor level i respectively.
Single Line – the same model with the same parameters is fitted to all levels of a factor
Yij = A + B × f (Xij; θ) (cf.
Constants Separate – different values of the constant A are fitted for each level of a factor.
Yij = Ai + B × f (Xij; θ) (cf.
FITCURVE factor +
Linear Separate – different values of constant
A and “slope”
B are fitted for each level of a factor.
Yij = Ai + Bi × f (Xij; θ) (c.f.
Nonlinear Separate – different values of all parameters are fitted for each level of a factor.
Yij = Ai + Bi × f (Xij; θi) (c.f.
When sums of functions are fitted by
RPARALLEL, the models are similar, but each includes a set of Bi‘s, f’s and θi‘s, one set for each function.
The four models are fitted in a single call of the procedure (unlike
FITCURVE) so that an accumulated analysis of variance can be compiled. The dependent variate and the parameters of the functions to be fitted are defined in the usual way using the
RCYCLE directives, and the explanatory variate and the grouping factor for the data are defined using the
GROUPS parameters of the procedure. The constant term in the fitted equation can be omitted or estimated by setting the
CONSTANT option appropriately. The
METHOD option determines the most complex of the four models to be fitted, with all simpler models also fitted. For example, if
METHOD=linearseparate, the single-line and constants-separate models are also fitted. The
CALCULATION option is set to an expression or list of expressions to define the form of the function to be fitted, as for
Printed output is controlled using the
RKEEP, providing this model is not
nonlinearseparate; for that case the results can be saved only by setting the parameter
RESULTS. This forms a pointer whose elements are labelled by the names of their contents:
RDISPLAY is used after
METHOD=nonlinearseparate has been fitted, only the results of fitting to the last level of the
GROUPS factor will be displayed.
The single-line and constants-separate models are fitted using
FITNONLINEAR in a similar manner to
FITCURVE in a similar situation, but saving the results for later use in an Accumulated Analysis of Variance. The linear-separate model (i.e. Parallel Lines) is fitted by setting up expressions (in a pointer
f) which calculate one dummy variable for each factor-level by function combination, which are fitted using
FITNONLINEAR as follows:
FITNONLINEAR [CALCULATION=f] dummy + GROUPS
The final Separate nonlinear model is fitted using a loop which restricts the data to each level of the factor in turn, and saves the sums of squares and estimates found for each subset. The final residual sums of squares for the whole model is calculated as the sum of the residual sums of squares for the individual parts, and the standard errors for the estimates are calculated using this and values saved from the matrix of second derivatives (
This method is described more fully by Butler & Brain (1990).
GROUPS are ignored, but the analysis is carried out on any restricted set of the dependent variate defined by the
Butler, R.C. & Brain, P. (1990). Parallelism in non-linear models. Genstat Newsletter, 25, 40-46.
CAPTION 'RPARALLEL example',\ !t('1. Fitting a logistic curve on log(Concentration) of',\ 'herbicide to the weights of sugarbeet grown at two different',\ 'soil pHs.'); STYLE=meta,plain READ [SERIAL=yes; SETNVALUES=yes] Weight,Conc 9.48 14.40 13.71 12.26 12.90 12.34 11.61 11.15 9.80 1.93 1.85 10.77 10.99 10.67 10.63 10.83 9.69 6.60 2.97 0.35 0.07 0.06 : 0 0 0.2 0.4 0.6 1.2 2.5 5.0 10.0 20.0 40.0 0 0 0.2 0.4 0.6 1.2 2.5 5.0 10.0 20.0 40.0 : FACTOR [LABELS=!t('5.8','8.0'); VALUES=11(1,2)] pH EXPRESSION e; !e( 1 / (1 + (Conc * EXP(-M) )**B) ) MODEL Weight; FITTED=Fitted RCYCLE B,M; INITIAL=1.43,1.86 RPARALLEL [CALCULATION=e] Conc; GROUPS=pH; RESULTS=Keep PRINT Conc,pH,Weight,Keep['FITTEDVALUES'] CAPTION !t('2. Data from Butler, R.C. & Brain, P.',\ 'Detecting Parallelism in Non-Linear models.',\ 'Genstat Newsletter 25. Fitting the sum of two',\ 'exponentials to counts of radioactivity over time.') READ [SETNVALUES=yes; SERIAL=yes] Time,dpm 0 1 3 6 10 15 20 30 40 50 60 80 100 120 140 160 180 210 240 270 300 360 420 0 1 3 6 10 15 20 30 40 50 60 80 100 120 140 160 180 210 240 270 300 360 420 : * 557.2 816.1 783.3 561.4 461.5 298.7 306.9 253.3 212.6 190.2 205.8 221.2 195.4 217.7 211.8 182.3 225.5 214.1 222.0 201.8 301.2 270.1 * 554.0 875.6 862.1 618.2 429.1 323.4 295.2 262.0 216.0 180.1 227.1 228.3 218.5 232.2 217.0 208 245.9 236.0 222.8 208.4 288.3 266.7 : FACTOR [LEVELS=2; VALUES=23(1...2)] Run EXPRESSION Exp; !e( DIFF( EXP(-k1 * Time))) & Exp; !e( DIFF( EXP(-k2 * Time))) MODEL dpm RCYCLE [MAXCYCLE=25] PARAMETER=k1,k2; LOWER=0,0; INITIAL=0.003,0.05 RPARALLEL [PRINT=model,accumulated,estimates; CALCULATION=Exp;\ METHOD=linearseparate; CONSTANT=omit] Time; GROUPS=Run