1. Home
  2. NLCONTRASTS procedure


Fits nonlinear contrasts to quantitative factors in ANOVA (R.C. Butler).


PRINT = string tokens Printed output required (aovtable, information, covariates, effects, residuals, contrasts, means, %cv, missingvalues); default aovt, info, cova, mean, miss
CURVE = string token Curve (as in FITCURVE) to use for nonlinear regression (exponential, dexponential, cexponential, lexponential, logistic, glogistic, gompertz, ldl, qdl, qdq); default expo
FPROBABILITY = string token Printing of probabilities for variance ratios (yes, no); default no
PSE = string token Standard errors to print with means tables (differences, means); default diff
WEIGHT = variate Variate of weights for each unit; default * (no weights)


Y = variates Data to be analysed
XFACTOR = factors Factor with quantitative levels for which contrasts are to be found
XLEVELS = variates Variate of values to use for the levels of XFACTOR; if unset, the factor levels themselves are used
GROUPFACTOR = factors Factor whose interaction with XFACTOR is to be assessed
CONTRASTS = pointers Structures to hold the estimates of the fitted contrasts: CONTRASTS[1] is a pointer with two values, labelled 'Curve' (parameter estimates for a single fitted curve) and 'Deviations' (the differences between this curve and the means for XFACTOR); CONTRASTS[2] has three values, labelled 'Common NonLin' (parameter estimates for curves fitted with common nonlinear parameters for all levels of GROUPFACTOR), 'Separate Curves' (parameter estimates for curves fitted with all parameters varying with the levels of GROUPFACTOR) and 'Deviations' (differences between the treatment means and the Separate Curves); the order of the parameters is as in the output of the procedure, the variates of estimated contrasts are labelled by the parameter names as used in the printed output, while the 'Deviations' are both tables, labelled by the relevant factors
SECONTRASTS = pointers Structures to save the standard errors for the contrast estimates, including 'deviations'; the pointer has the same form as the CONTRASTS pointer
DFCONTRASTS = pointers Structures to save the degrees of freedom for the contrast estimates; the pointer has the same form as the CONTRASTS pointer, except that the variates and tables are replaced by scalars


The ANOVA directive allows linear contrasts to be fitted and incorporated into the analysis-of-variance table. NLCONTRASTS extends this to enable nonlinear contrasts to be fitted to the effects of a quantitative factor and its interaction with another factor. The analysis should include both main effects and the interaction between the factors. The procedure will work for any block structure providing each treatment term is estimated entirely within one stratum. The result is similar to ANOVA with a polynomial contrast, but with slightly different partitions of the treatment sums of squares. The main effect is partitioned into the sum of squares for the “Curve” and the remainder or “Deviations”. The interaction sum of squares is partitioned into the sum of squares due to curves with “Common Nonlinear” parameters for the levels of the non-quantitative factor, and the extra sum of squares due to having “Separate Curves” for each level of that factor, and the remaining sum of squares which again represents “Deviations”.

The BLOCKSTRUCTURE and TREATMENTSTRUCTURE directives must be used in the normal way before the procedure is called, and any COVARIATES should also be defined first. The structure of the analysis-of-variance table is then accessed from inside the procedure. The Y parameter defines the variate to be analysed, and the form of nonlinear contrast is defined using the CURVE option of the procedure. The same choices of curves are available as for FITCURVE. There are four other options, PRINT, FPROBABILITY, PSE, and WEIGHT, which are exactly as for ANOVA. The XFACTOR parameter defines the factor to which the contrasts are to be fitted, and the XLEVELS parameter may be used to define x values for the regressions if the levels already defined for the factor are unsuitable. The GROUPFACTOR parameter defines the factor whose interaction with XFACTOR is to be assessed. The final three parameters CONTRASTS, SECONTRASTS and DFCONTRASTS can be used to save the parameter estimates for the contrasts, their standard errors and degrees of freedom respectively.




ANOVA is used to obtain the basic analysis-of-variance table and the sums of squares for the treatment terms. FITCURVE is then used with the treatment means to fit three sets of curves: a single curve, curves with common nonlinear parameters, and entirely separate curves. The deviances and degrees of freedom obtained from these are used in conjunction with the treatment sums of squares to calculate the contrast sums of squares and degrees of freedom. Further details are given by Butler & Brain (1992). New lines for the analysis-of-variance table are then constructed using PRINT and EDIT, and these lines are then inserted into the table (saved in a text with ADISPLAY) using EDIT. The standard errors for the parameter estimates and deviances are based on the Residual Mean Square for the appropriate stratum. Standard errors for deviations are calculated using the method in the Guide to the Genstat Command Language, Part 2, Section 4.5.

Action with RESTRICT

If the Y variate is restricted, the procedure will use only the units not excluded by the restriction.


Butler, R.C. & Brain, P. (1993). Nonlinear Contrasts in ANOVA. Genstat Newsletter, 29, 20-27.

See also


Procedures: NLAR1, RPARALLEL.

Commands for: Analysis of variance, Regression analysis.


        !t('Doses of a herbicide were applied in two volumes of liquid.',\
        'The analysis asseses whether the dose-response of weed Fresh',\
        'Weight changes with Volume. The dose-reponse is fitted as a',\
        'logistic curve using log(Dose).'); STYLE=meta,plain
READ    Fwt
4.33   4.94   5.26   4.15   6.64   3.67   4.26   4.93   7.00   5.37
3.79   3.82   3.75   3.11   4.80   5.24   6.37   6.89   3.38   4.80
3.69   5.65   4.92   2.57   3.77   6.19   3.31   6.39   2.28   5.23
3.29   4.08   6.06   5.04   2.66   3.95   2.21   0.50   5.14   3.34
0.71   3.32   2.61   3.74   2.41   2.90   3.32   2.77   2.66   4.48
2.56   2.64   3.57   2.11   2.29   2.26   1.36   2.92   2.77   2.40
6.52   5.51   4.58   5.91   5.85   5.33   4.88   7.01   5.54   6.21
6.27   5.29   5.67   5.23   4.80   4.07   5.09   3.14   7.63   2.84
3.59   2.92   2.38   4.02   2.92   3.53   3.42   3.12   3.20   2.77
3.39   4.11   3.49   2.50   3.11   3.15   2.03   2.85   1.65   3.13
1.37   1.25   0.62   2.11   1.87   3.81   0.55   2.29   2.62   1.44
1.60   1.15   2.27   2.46   1.91   2.16   1.84   2.99   2.56   1.39  :
FACTOR  [NVALUES=120; LABELS=!t(Small, Large); values=60(1,2)] Volume
FACTOR  [NVALUES=120; LEVEL=6; VALUES=10(1...6)2] Doses
FACTOR  [NVALUES=120; LEVEL=10; VALUES=(1...10)12] Block
VARIATE [VALUES=10,20,40,100,160,340] Dose
CALC    Ldose=log(Dose)
BLOCK   Block
TREAT   Doses*Volume
Updated on March 7, 2019

Was this article helpful?