Defines the random model for a hierarchical or double hierarchical generalized linear model (R.W. Payne, Y. Lee, J.A. Nelder & M. Noh).

### Options

`DISTRIBUTION` = string token |
Distribution for the random model (`beta` , `normal` , `gamma` , `inversegamma` ); default `norm` |
---|---|

`LINK` = string token |
Link for the random model (`identity` , `logarithm` , `logit` , `reciprocal` ); default `iden` |

### Parameters

`TERMS` = formula |
Random model |
---|---|

`DLINK` = string tokens |
Link for the dispersion model for each random term (`logarithm` , `reciprocal` ); default `loga` |

`DFORMULA` = formula structures |
Dispersion model for each random term; default `*` i.e. none |

`DOFFSET` = variates |
Offset variate for dispersion model for each random term; default `*` i.e. none |

`LMATRIX` = matrices |
Linear transformation to apply to design matrix Z of each random term, in order to define correlations between its effects; default `*` i.e. none |

`DDISPERSION` = scalar |
Dispersion parameter to use in the dispersion model for each random term; default 1 |

`FDISPERSION` = scalar |
Fixed value for the dispersion parameter of each random term; default `!s(*)` i.e. dispersion is estimated |

`IDISPERSION` = scalar |
Initial value for the dispersion parameter for each random term; default `*` i.e. formed automatically |

### Description

`HGRANDOMMODEL`

is one of several procedures with the prefix HG, which provide tools for fitting the hierarchical generalized linear models defined by Lee & Nelder (1996, 2001a, 2006) and described by Lee, Nelder & Pawitan (2006). These models extend generalized linear models (GLMs) to include additional random terms in the linear predictor. They include generalized linear mixed models (GLMMs) as a special case, but do not constrain the additional terms to follow a Normal distribution and to have an identity link (as in the GLMM). For example, if the basic generalized linear model is a log-linear model (Poisson distribution and log link), a more appropriate assumption or the additional random terms might be a gamma distribution and a log link.

The `TERMS`

parameter defines the additional random terms. These should not include the final (residual) term, unless you want to define a saturated random model as, for example, in the use of a negative binomial distribution in the Fabric example, discussed in Lee, Nelder & Pawitan 2006, Section 6.6.3. The `LINK`

and `DISTRIBUTION`

options specify their distribution and link function respectively.

The HGLM methodology also caters for structured dispersion models, in which fixed terms are included in the generalized linear models that are used to estimate the dispersion parameters for the random terms of the HGLM. Currently these GLMs must have a gamma distribution. These fixed terms are specified in a Genstat formula structure using the `DFORMULA`

parameter (which runs in parallel with the list of random terms supplied by the `TERMS`

parameter). The `DLINK`

parameter specifies the link to use with each dispersion model, the `DOFFSET`

parameter allows you to specify an offset variate, and the `DDISPERSION`

parameter defines the dispersion parameter for the dispersion GLM (default 1). You can also extend a dispersion GLM to become an HGLM (thus making the full model a *double hierarchical generalized linear model* or *DHGLM*), by using the `HGDRANDOMMODEL`

procedure to add some random terms.

Alternatively, if you do not define a dispersion model for a random term, you can use the `FDISPERSION`

parameter to fix its dispersion at a specific value.

The `LMATRIX`

parameter allows correlation structures to be defined for random terms, using the method described by Lee & Nelder (2001b). This is done by setting `LMATRIX`

to a matrix L that is used as a post-multiplier for the Z matrix of the random term concerned. Lee & Nelder (2001b) give examples illustrating the types of model that can be defined.

The `IDISPERSION`

parameter allows you to define initial values for the dispersion parameters of the random terms. An initial value for the residual dispersion parameter phi can be defined using the `IDISPERSION`

option of the `HGFIXEDMODEL`

procedure. If you set both of these, the `HGANALYSE`

procedure will then use them to initialize the weights that are involved in the fitting of the augmented mean model; for details see Chapter 6 of Lee, Nelder & Pawitan (2006). The default weights that are formed automatically if either of these is unset are satisfactory in most circumstances, but you may want to try your own initial values if you encounter convergemce problems.

Options: `DISTRIBUTION`

, `LINK`

.

Parameters: `TERMS`

, `DLINK`

, `DFORMULA`

, `DOFFSET`

, `LMATRIX`

, `DDISPERSION`

, `FDISPERSION`

, `IDISPERSION`

.

### Method

The information is stored in a workspace `G5PL_HG`

(accessed using the `WORKSPACE`

directive) for later use by `HGANALYSE`

.

### References

Lee, Y., & Nelder, J.A. (1996). Hierarchical generalized linear models (with discussion). *Journal of the Royal Statistical Society, Series B*, 58, 619-678.

Lee, Y., & Nelder, J.A. (2001a). Hierarchical generalized linear models: a synthesis of generalised linear models, random-effect models and structured dispersions. *Biometrika*, 88, 987-1006.

Lee, Y. & Nelder, J.A. (2001b). Modelling and analysing correlated non-normal data. *Statistical Modelling*, 1, 3-16.

Lee, Y. & Nelder, J.A. (2006). Double hierarchical generalized linear models (with discussion). *Appl. Statist.*, 55, 139-185.

Lee, Y., Nelder, J.A. & Pawitan, Y. (2006). *Generalized Linear Models with Random Effects: Unified Analysis via H-likelihood*. Chapman & Hall, London.

Lee, Y., Nelder, J.A. & Pawitan, Y. (2006). *Generalized Linear Models with Random Effects: Unified Analysis via H-likelihood*. Chapman and Hall, Boca Raton.

### See also

Procedures: `HGANALYSE`

, `HGDISPLAY`

, `HGDRANDOMMODEL`

, `HGFIXEDMODEL`

, `HGFTEST`

, `HGGRAPH`

, `HGKEEP`

, `HGNONLINEAR`

, `HGPLOT`

, `HGPREDICT`

, `HGRTEST`

, `HGSTATUS`

, `HGWALD`

.

Commands for: Regression analysis.

### Example

CAPTION 'HGRANDOMMODEL example',!t(\ 'Breaking angles of cake baked from 3 recipes at 10 temperatures',\ '(Cochran & Cox, 1957, Experimental Designs, page 300).',\ 'Data values are assumed to follow a GLM with a gamma distribution',\ 'and recriprocal link. The linear predictor contains additional',\ 'random variables, with inverse gamma distributions and reciprocal',\ 'link, for replicates and batches of cake mixture.'); STYLE=meta,plain FACTOR [NVALUES=270; LEVELS=3] Recipe & [LEVELS=15] Replicate & [LEVELS=!(175,185...225)] Temperature GENERATE Recipe,Replicate,Temperature VARIATE [NVALUES=270] Angle READ Angle 42 46 47 39 53 42 47 29 35 47 57 45 32 32 37 43 45 45 26 32 35 24 39 26 28 30 31 37 41 47 24 22 22 29 35 26 26 23 25 27 33 35 24 33 23 32 31 34 24 27 28 33 34 23 24 33 27 31 30 33 33 39 33 28 33 30 28 31 27 39 35 43 29 28 31 29 37 33 24 40 29 40 40 31 26 28 32 25 37 33 39 46 51 49 55 42 35 46 47 39 52 61 34 30 42 35 42 35 25 26 28 46 37 37 31 30 29 35 40 36 24 29 29 29 24 35 22 25 26 26 29 36 26 23 24 31 27 37 27 26 32 28 32 33 21 24 24 27 37 30 20 27 33 31 28 33 23 28 31 34 31 29 32 35 30 27 35 30 23 25 22 19 21 35 21 21 28 26 27 20 46 44 45 46 48 63 43 43 43 46 47 58 33 24 40 37 41 38 38 41 38 30 36 35 21 25 31 35 33 23 24 33 30 30 37 35 20 21 31 24 30 33 24 23 21 24 21 35 24 18 21 26 28 28 26 28 27 27 35 35 28 25 26 25 38 28 24 30 28 35 33 28 28 29 43 28 33 37 19 22 27 25 25 35 21 28 25 25 31 25 : FACPRODUCT !p(Replicate,Recipe); Batch HGFIXEDMODEL [DISTRIBUTION=gamma; LINK=reciprocal] Recipe*Temperature HGRANDOMMODEL [DISTRIBUTION=inversegamma; LINK=reciprocal] Replicate+Batch HGANALYSE Angle