Finds the best `REML`

random model from a set of models defined by `VFMODEL`

(R.W. Payne).

### Options

`PRINT` = string tokens |
Controls what summary output is produced about the models (`deviance` , `aic` , `bic` , `sic` , `dffixed` , `dfrandom` , `change` , `exit` , `best` ); default `devi` , `aic` , `sic` , `dfra` , `best` |
---|---|

`PBEST` = string tokens |
Controls the output from the `REML` analysis with the best model (`model` , `components` , `effects` , `means` , `stratumvariances` , `monitoring` , `vcovariance` , `deviance` , `Waldtests` , `missingvalues` , `covariancemodels` , `aic` , `sic` , `bic` ); default `*` i.e. none |

`PTRY` = string tokens |
Controls the output to present to present from the `REML` analysis used to try each model (`model` , `components` , `effects` , `means` , `stratumvariances` , `monitoring` , `vcovariance` , `deviance` , `Waldtests` , `missingvalues` , `covariancemodels` , `aic` , `sic` , `bic` ); default `*` i.e. none |

`MODELSTRUCTURES` = pointer |
Model-definition structures specifying the models to try |

`PTERMS` = formula |
Terms (fixed or random) for which effects or means are to be printed; default `*` implies all the fixed terms |

`PSE` = string token |
Standard errors to be printed with tables of effects and means (`differences` , `estimates` , `alldifferences` , `allestimates` , `none` ); default `diff` |

`MVINCLUDE` = string tokens |
Whether to include units with missing values in the explanatory factors and variates and/or the y-variates (`explanatory` , `yvariate` ); default `*` i.e. omit units with missing values in either explanatory factors or variates or y-variates |

`METHOD` = string token |
How to choose the best model (`aic` , `sic` , `bic` ); default `sic` |

`PROHIBIT` = string token |
Whether to exclude models where any estimated variance parameters are held at a bound (`bound` ); default `*` |

### Parameters

`Y` = variates |
Response variates |
---|---|

`NBESTMODEL` = scalars |
Saves the number of the best model for each y-variate, returning a missing value if no models could be fitted successfully |

`SAVE` = REML save structures |
Save structure from the analysis of the best model for each y-variate |

### Description

`VARANDOM`

allows you to try several alternative random models for a `REML`

analysis, and then select the best one according to either their Akaike or Schwarz (Bayesian) information coefficients.

Model-definition structures for the models to be assessed must be specified using the `MODELSTRUCTURES`

option. These are formed using the `VFMODEL`

and `VFSTRUCTURE`

procedures, which define the aspects controlled by the `VCOMPONENTS`

and `VSTRUCTURE`

directives, respectively.

The response variate for the analysis must be specified by the `Y`

parameter. The number of the best model can be saved, in a scalar, by the `NBESTMODEL`

parameter; it returns a missing value if no models could be fitted successfully The `REML`

save structure from the analysis with the best model can be saved using the `SAVE`

parameter.

The `MVINCLUDE`

option controls whether units with missing values in the explanatory factors and variates and/or the y-variate are included in the analysis, as in the `REML`

directive.

The `METHOD`

option specifies how to assess the models

`aic` |
uses their Akaike information coefficients, |
---|---|

`sic` or `bic` |
uses their Schwarz (Bayesian) information coefficients (default). |

You can set option `PROHIBIT`

`=`

`bound`

, to excludes models with any estimated variance parameters held at a bound.

The `PRINT`

option specifies the summary output to be produced about the models. The settings are mainly the same as those of the `VRACCUMULATE`

procedure (which is used to store and then print details of the analyses). There is also an extra setting `best`

, which prints the description of the best model. The default is to print the best description, together with the deviance, the Akaike and Schwarz (Bayesian) information coefficients and the number of degrees, for all the random models.

The `PBEST`

option specifies the output to be produced from the `REML`

analysis with the best model. Similarly, the `PTRY`

option indicates what output should be produced for each candidate random model when it is tried. Their settings are mainly the same as those of the `PRINT`

option of the `REML`

directive. There are also extra settings `aic`

and `sic`

(with a synonym `bic`

) to print the Akaike and Schwarz (Bayesian) information coefficients, respectively. The default for both these options is to produce no output.

The `PTERMS`

option operates as in `REML`

, to specify the terms whose means and effects are printed by `PBEST`

and `PTRY`

; the default is all the fixed terms. Likewise, the `PSE`

option controls the type of standard error that is displayed with the means and effects; the default is to give a summary of the standard errors of differences.

Options: `PRINT`

, `PBEST`

, `PTRY`

, `MODELSTRUCTURES`

, `PTERMS`

, `PSE`

, `MVINCLUDE`

, `METHOD`

, `PROHIBIT`

.

Parameters: `Y`

, `NBESTMODEL`

, `SAVE`

.

### See also

Directives: `REML`

, `VCOMPONENTS`

, `VSTRUCTURE`

.

Procedures: `VAOPTIONS`

, `VARECOVER`

, `VFMODEL`

, `VFSTRUCTURE`

, `VMODEL`

, `VRACCUMULATE`

.

Commands for: REML analysis of linear mixed models.

### Example

CAPTION 'VARANDOM example',\ 'Slate Hall Farm data (Guide to REML in Genstat, Section 1.8).';\ STYLE=meta,plain SPLOAD '%gendir%/data/slatehall.gsh' " define model for analysis as a randomized-blocks design " VFMODEL [MODELSTRUCTURE=RCBD; DESCRIPTION='Randomized blocks';\ FIXED=variety] replicates " define model for analysis as a Lattice square design " VFMODEL [MODELSTRUCTURE=Latticesq; DESCRIPTION='Lattice square';\ FIXED=variety] replicates/(rows*columns) " define model for analysis with an AR1 (x) AR1 model " VFMODEL [MODELSTRUCTURE=AR1xAR1; DESCRIPTION='AR1 (x) AR1';\ FIXED=variety] fieldrow.fieldcolumn VFSTRUCTURE [MODELSTRUCTURE=AR1xAR1; TERMS=fieldrow.fieldcolumn]\ 2('AR'); ORDER=1; FACTOR=fieldrow,fieldcolumn " define model for analysis with an AR1 (x) AR1 model + measurement error " VFMODEL [MODELSTRUCTURE=AR1xAR1p; DESCRIPTION='AR1 (x) AR1 + plots';\ FIXED=variety] fieldrow.fieldcolumn+plotnumber VFSTRUCTURE [MODELSTRUCTURE=AR1xAR1p; TERMS=fieldrow.fieldcolumn]\ 2('AR'); ORDER=1; FACTOR=fieldrow,fieldcolumn VARANDOM [MODELSTRUCTURES=RCBD,Latticesq,AR1xAR1,AR1xAR1p]\ yield; SAVE=savebest VDISPLAY [PRINT=model,components,wald] savebest