Fits regressions 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` |
---|---|

`CALCULATION` = expression structures |
Calculation of explanatory variates involving nonlinear parameters |

`CONSTANT` = string token |
How to treat the constant (`estimate` , `omit` ); default `esti` |

`FACTORIAL` = scalars |
Limit for expansion of model terms; default 3 |

`POOL` = string token |
Whether to pool ss in accumulated summary between all terms fitted in a linear model (`yes` , `no` ); default `no` |

`DENOMINATOR` = string token |
Whether to base ratios in accumulated summary on rms from model with smallest residual ss or smallest residual ms (`ss` , `ms` ); default `ss` |

`NOMESSAGE` = string tokens |
Which warning messages to suppress (`dispersion` , `leverage` , `residual` , `aliasing` , `marginality` , `vertical` , `df` , `inflation` ); default `*` |

`FPROBABILITY` = string token |
Printing of probabilities for variance and deviance ratios (`yes` , `no` ); default `no` |

`TPROBABILITY` = string token |
Printing of probabilities for t-statistics (`yes` , `no` ); default `no` |

`SELECTION` = string tokens |
Statistics to be displayed in the summary of analysis produced by `PRINT=summary` , `seobservations` is relevant only for a Normally distributed response, and `%cv` only for a gamma-distributed response (`%variance` , `%ss` , `adjustedr2` , `r2` , `seobservations` , `dispersion` , `%cv` , `%meandeviance` , `%deviance` , `aic` , `bic` , `sic` ); default `%var` , `seob` if `DIST=normal` , `%cv` if `DIST=gamma` , and `disp` for other distributions |

`SELINEAR` = string token |
Whether to calculate s.e.s for linear parameters when nonlinear parameters are also estimated (`yes` , `no` ); default `no` |

`WEIGHTS` = variate |
Prior weights for the units |

`CMETHOD` = string token |
Estimation method (`maximumlikelihood` , `reml` ); default `maxi` |

`CPARAMETER` = scalars |
Correlation parameter |

`CPOSITIONS` = variate |
Correlation positions |

`CGROUPS` = factor |
Groupings of correlation positions |

`MAXCYCLE` = scalars |
Maximum number of iterations; default 100 |

`TOLERANCE` = scalars |
Convergence criterion; default 10^{-5} |

### Parameter

`TERMS` = formula |
Terms to be fitted |
---|

### Description

`RAR1`

allows you to fit regression 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. The parameter phi of the AR1 or power-distance model is estimated within `RAR1`

, 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, `RAR1`

is used much like `FIT`

. It must be preceded by a `MODEL`

statement. You can also give an `RCYCLE`

statement first if you want to estimate nonlinear parameters. The `MODEL`

statement must have the `WEIGHT`

option set to a symmetrix matrix, which need not have any values defined. `RAR1`

will set the values according to the distances (`CPOSITIONS`

), groups (`CGROUPS`

) and estimated parameter phi. These values remain set after `RAR1`

. So you can display or save further output using `RCHECK`

, `RDISPLAY`

, `RGRAPH`

or `RKEEP`

, in the usual way. You could also, for example, use `RAR1`

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. `RAR1`

has a `TERMS`

parameter to specify the terms to be fitted, like the parameter of `FIT`

. It also has options `CALCULATION`

, `CONSTANT`

, `FACTORIAL`

, `POOL`

, `DENOMINATOR`

, `NOMESSAGE`

, `FPROBABILITY`

, `TPROBABILITY`

, `SELECTION`

and `SELINEAR`

which operate like those of `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, |
---|---|

`cmonitoring` |
provides monitoring information for the estimation of phi, |

`cplot` |
plots the likelihood (or REML 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 `CMETHOD`

option controls whether phi is estimated for regression models by REML or by maximum likelihood (default `maxi`

); with nonlinear models only maximum likelihood is available. 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`

, `CALCULATION`

, `CONSTANT`

, `FACTORIAL`

, `POOL`

, `DENOMINATOR`

, `NOMESSAGE`

, `FPROBABILITY`

, `TPROBABILITY`

, `SELECTION`

, `SELINEAR`

, `WEIGHTS`

, `CMETHOD`

, `CPARAMETER`

, `CPOSITIONS`

, `CGROUPS`

, `MAXCYCLE`

, `TOLERANCE`

.

Parameter: `TERMS`

.

### Method

To estimate phi `RAR1`

uses procedure `MIN1DIMENSION`

, which calls a procedure `_MIN1DFUNCTION`

, which is loaded automatically with `RAR1`

. `_MIN1DFUNCTION`

uses the `FIT`

directive to fit the regression model for a particular value of phi, and then evaluates the likelihood or `REML`

likelihood (according to the setting of the `CMETHOD`

option).

The total degrees of freedom for the regression are decreased by one, to take account of the estimation of the correlation parameter phi, by setting a variable in the regression save structure (`rsave[1][3]$[47]`

) to one.

### Action with `RESTRICT`

Restrictions are not allowed.

### See also

Directive: `VSTRUCTURE`

.

Procedure: `NLAR1`

.

Commands for: Repeated measurements, Regression analysis.

### Example

CAPTION 'RAR1 example',!t('Regress daily gas demand on coldness,',\ 'using an AR(1) model for errors, with phi estimated by REML;',\ 'see Guide to Genstat, Part 2, Example 7.4a'); STYLE=meta,plain READ [SETNVALUES=yes] Demand 324.04 333.30 345.96 403.74 391.84 361.36 358.26 356.44 360.60 326.56 341.74 349.14 363.76 352.46 368.34 382.50 381.26 351.14 348.04 359.46 364.76 338.44 339.20 342.06 396.84 418.24 457.46 463.36 440.34 443.80 419.06 390.34 383.14 415.26 449.86 471.84 458.70 408.46 345.34 309.04 283.56 287.36 314.44 303.40 286.16 298.54 308.44 309.16 336.86 337.64 334.10 302.66 303.84 289.94 251.86 239.26 288.84 319.40 311.46 308.74 361.74 390.16 367.76 365.14 364.40 367.56 363.84 340.34 319.76 319.06 322.24 281.10 312.96 295.64 273.74 321.16 313.16 286.64 348.60 359.46 338.94 322.44 338.96 359.26 357.24 404.00 386.56 391.14 411.14 405.46 377.86 371.74 333.20 354.06 319.64 310.04 336.86 301.36 295.24 264.90 312.46 363.34 362.04 340.26 : READ [SETNVALUES=yes] Coldness -33.5 -21.8 -13.8 -12.4 -0.9 -38.7 -32.7 -49.0 -34.2 -59.2 -40.9 -34.8 -29.8 -34.9 -10.8 -26.2 1.6 -50.3 -53.0 -40.5 -32.2 -60.2 -50.5 -47.5 9.1 32.9 42.6 29.2 16.8 6.5 -0.8 -14.6 -14.2 -9.1 8.9 13.8 11.3 -34.1 -67.9 -93.3 -100.9 -91.7 -69.3 -82.8 -79.6 -79.6 -57.4 -74.8 -58.8 -53.0 -63.8 -68.1 -91.1 -76.0 -115.9 -114.2 -93.5 -68.3 -74.9 -78.4 -21.4 -27.1 -38.7 -55.8 -64.1 -46.2 -59.0 -49.7 -59.8 -87.9 -51.5 -90.9 -85.5 -87.5 -94.1 -55.8 -75.7 -104.1 -60.9 -48.9 -59.1 -56.8 -50.3 -59.1 -56.0 -38.7 -13.7 -47.0 -24.1 -31.8 -44.8 -65.4 -84.2 -47.9 -70.2 -98.4 -76.1 -104.2 -97.0 -117.3 -62.0 -44.8 -47.3 -64.3 : CALCULATE nunits = NVALUES(Demand) VARIATE [VALUES=1...nunits] Time SYMMETRIC [ROWS=nunits] wmat MODEL [WEIGHTS=wmat] Demand RAR1 [CMETHOD=reml; CPOSITIONS=Time] Coldness " compare with REML " GROUP Time; Timefactor VCOMPONENTS [FIXED=Coldness; CADJUST=none] Timefactor VSTRUCTURE [TERM=Timefactor] AR; ORDER=1 REML [PRINT=effects,components,deviance] Demand