1. Home
2. RPARALLEL procedure

# RPARALLEL procedure

Carries out analysis of parallelism for nonlinear functions; synonym `FITPARALLEL` (R.C. Butler).

### Options

`PRINT` = string tokens What to print (`model`, `summary`, `accumulated`, `estimates`, `correlations`, `fittedvalues`, `monitoring`); default `mode`, `summ`, `accu`, `esti` Calculation(s) involving explanatory variate; no default (must be set) Which models to fit (`singleline`, `constantsseparate`, `linearseparate`, `nonlinearseparate`); default `nonl` How to treat constant (`estimate`, `omit`); default `esti`

### Parameters

`X` = variates Explanatory variate; must be set Grouping factor for data; must be set To save results from model `nonlinearseparate`, if fitted; should be set only if `METHOD=nonl`

### Description

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. `FITCURVE X`)

Constants Separate – different values of the constant A are fitted for each level of a factor.

Yij = Ai + B × f (Xij; θ)                (cf. `FITCURVE` factor + `X`)

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. `FITCURVE` `[non=c]` factor `*` `X`)

Nonlinear Separate – different values of all parameters are fitted for each level of a factor.

Yij = Ai + Bi × f (Xij; θi)              (c.f. `FITCURVE` `[non=s]` factor `*` `X`)

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 `MODEL` and `RCYCLE` directives, and the explanatory variate and the grouping factor for the data are defined using the `X` and `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 `FITNONLINEAR`.

Printed output is controlled using the `PRINT` option, with monitoring, summary analysis of variance, estimates, and correlations being printed for each model fitted, but fitted values and accumulated analysis of variance being printed for the most complex model only. The results of fitting the complex model can be saved using `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: `FITTEDVALUES`, `RESIDUALS`, `ESTIMATE`, `SE`, `DEVIANCE`, `DF`. If `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.

Options: `PRINT`, `CALCULATION`, `METHOD`, `CONSTANT`.

Parameters: `X`, `GROUPS`, `RESULTS`.

### Method

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 (`INVERSE` in `RKEEP`).

This method is described more fully by Butler & Brain (1990).

### Action with `RESTRICT`

Restrictions of `X` or `GROUPS` are ignored, but the analysis is carried out on any restricted set of the dependent variate defined by the `MODEL` statement.

### Reference

Butler, R.C. & Brain, P. (1990). Parallelism in non-linear models. Genstat Newsletter, 25, 40-46.

Directives: `FITCURVE`, `FITNONLINEAR`.

Procedures: `NLAR1`, `NLCONTRASTS`.

Commands for: `Regression analysis`.

### Example

```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
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.')
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
```
Updated on March 5, 2019