1. Home
2. NLAR1 procedure

# NLAR1 procedure

Fits curves with an AR1 or a power-distance correlation model (R.W. Payne).

### Options

`PRINT` = string tokens What to print (`model`, `deviance`, `summary`, `estimates`, `correlations`, `fittedvalues`, `accumulated`, `monitoring`, `cparameter`, `cmonitoring`, `cplot`); default `mode`, `summ`, `esti`, `cpar` Which standard curve to fit (`exponential`, `dexponential`, `cexponential`, `lexponential`, `logistic`, `glogistic`, `gompertz`, `ldl`, `qdl`, `qdq`, `fourier`, `dfourier`, `gaussian`, `dgaussian`); default `expo` Sense of a standard curve (`right`, `left`); default `righ` Constrained origin for a standard curve; default `*` i.e. not constrained How to treat nonlinear parameters between groups in standard curves (`common`, `separate`); default `comm` Define a nonlinear model involving explanatory variates and nonlinear parameters; default `*` implies that a standard curve is fitted How to treat the constant (`estimate`, `omit`); default `esti` Limit for expansion of model terms; default 3 Whether to pool ss in accumulated summary between all terms fitted in a linear model (`yes`, `no`); default `no` Whether to base ratios in accumulated summary on rms from model with smallest residual ss or smallest residual ms (`ss`, `ms`); default `ss` Which warning messages to suppress (`dispersion`, `leverage`, `residual`, `aliasing`, `marginality`, `vertical`, `df`, `inflation`); default `*` Printing of probabilities for variance and deviance ratios (`yes`, `no`); default `no` Statistics to be displayed in the summary of analysis produced by `PRINT=summary` (`%variance`, `%ss`, `adjustedr2`, `r2`, `seobservations`, `dispersion`, `%cv`, `%meandeviance`, `%deviance`, `aic`, `bic`, `sic`); default `%var`, `seob` Whether to calculate s.e.s for linear parameters when nonlinear parameters are also estimated (`yes`, `no`); default `no` Prior weights for the units Correlation parameter Correlation positions Groupings of correlation positions Maximum number of iterations; default 100 Convergence criterion; default 10-5

### Parameter

`TERMS` = formula Terms to be fitted

### Description

`NLAR1` allows you to fit curves and nonlinear models to data, such as repeated measurements, where the residuals may follow an AR1 or a power-distance correlation model. The `CPOSITIONS` option specifies the coordinates of the observations in the direction (e.g. time) along which the correlation model operates. You can also use the `CGROUPS` option to specify a factor to define groups of observations for the model – the correlation model is then defined only over the observations that belong to the same groups. If you are fitting a standard curve, `CPOSITIONS` will take the x-variate for the curve as its default, and the group factor (if specified e.g. to define parallel curves) as the default for `CGROUPS`. `NLAR1` also allows the data units to have unequal weights, which can be supplied in a variate using the `WEIGHTS` option.

The parameter phi of the AR1 or power-distance model is estimated within `NLAR1`, and is assumed to be the same for every group. (Note that the model will be AR1 if the observations are each one unit apart within each group – the power-distance model is the natural extension of the AR1 model to unequally-spaced data; see Method.) You can save the estimated value of phi, in a scalar, using the `CPARAMETER` option.

Otherwise, `NLAR1` is used much like `FITCURVE` or `FIT` (which are used inside `NLAR1` to fit the model). `NLAR1` must be preceded by a `MODEL` statement. You must also give an `RCYCLE` statement first if you want to fit a user-defined nonlinear model (using `FIT`), rather than a standard curve (using `FITCURVE`). The `MODEL` statement must have the `WEIGHT` option set to a symmetrix matrix, which need not have any values defined. `NLAR1` will set the values according to the distances (`CPOSITIONS`), groups (`CGROUPS`) and estimated parameter phi. These values remain set after `NLAR1`. So you can display or save further output using `RCHECK`, `RDISPLAY`, `RGRAPH` or `RKEEP`, in the usual way. You could also, for example, use `NLAR1` to fit a full set of regression terms, and then use `DROP` to investigate smaller models while still using the phi estimate from the full model. `NLAR1` has a `TERMS` parameter to specify the terms to be fitted, like the parameter of `FIT` and `FITCURVE`. It also has options `CURVE`, `SENSE`, `ORIGIN`, `NONLINEAR`, `CALCULATION`, `CONSTANT`, `FACTORIAL`, `POOL`, `DENOMINATOR`, `NOMESSAGE`, `FPROBABILITY`, `SELECTION` and `SELINEAR` which operate like those of `FITCURVE` and `FIT`. If the `CALCULATION` option is unset, then options `CURVE`, `SENSE`, `ORIGIN`, `NONLINEAR` define which standard curve to fit (using `FITCURVE`). Alternatively, if `CALCULATION` is set, those options are ignored, and the expressions specified by `CALCULATION` define a nonlinear model to be fitted (by `FIT`).

The `PRINT` option is also similar, except that it has three additional settings:

    `cparameter` prints the estimated value of the correlation phi, together with a test for phi=0, provides monitoring information for the estimation of phi, plots the likelihood for phi.

Note, the likelihood values omit some constant terms that depend only on the regression terms. The default is `PRINT=model,summary,estimates,cparameter`.

The other options control the estimation. The `MAXCYCLE` option defines the maximum number of iterations (default 100) used to estimate phi, and the `TOLERANCE` option specifies the convergence criterion i.e. the accurary to which phi is to be estimated (default 10-5).

Options: `PRINT`, `CURVE`, `SENSE`, `ORIGIN`, `NONLINEAR`, `CALCULATION`, `CONSTANT`, `FACTORIAL`, `POOL`, `DENOMINATOR`, `NOMESSAGE`, `FPROBABILITY`, `SELECTION`, `SELINEAR`, `WEIGHTS`, `CMETHOD`, `CPARAMETER`, `CPOSITIONS`, `CGROUPS`, `MAXCYCLE`, `TOLERANCE`.

Parameter: `TERMS`.

### Method

To estimate phi `NLAR1` uses procedure `MIN1DIMENSION`, which calls a procedure `_MIN1DFUNCTION`, which is loaded automatically with `NLAR1`. `_MIN1DFUNCTION` uses the `FITCURVE` or `FIT` directives to fit the regression model for a particular value of phi, and then evaluates the likelihood. If standard curves are fitted using `FITCURVE` for groups of observations, these groups must be independent. Otherwise `FITCURVE` will give a fault diagnostic. (Thus the default setting for the `CGROUPS` option with standard curves is the group factor, if one has been specified in the `TERMS` formula.)

### Action with `RESTRICT`

Restrictions are not allowed.

Directives: `FITCURVE`, `FITNONLINEAR`, `VSTRUCTURE`.

Procedure: `RAR1`.

Commands for: Repeated measurements, Regression analysis.

### Example

```CAPTION   'NLAR1 example'; STYLE=meta
VARIATE   [VALUES=5...30] x
&         [VALUES=1.30,3.55,5.13,6.48,7.85,8.96,9.84,10.91,11.29,11.76,\
12.12,12.55,12.70,13.14,13.47,13.78,14.01,14.11,14.55,14.71,\
14.57,14.30,14.67,14.68,15.03,15.00] y
SYMMETRIC [ROWS=26] wt
MODEL     [WEIGHTS=wt] y
NLAR1     [CURVE=exponential] x
```
Updated on June 19, 2019