Forms predictions from a `GLMM`

analysis (R.W. Payne).

### Options

`PRINT` = string tokens |
What to print (`description` , `predictions` , `backpredictions` , `se` , `sesummary` , `sed` , `sedsummary` , `vcovariance` ); default `desc` , `pred` , `back` , `seds` |

`MODEL` = formula |
Indicates which model terms (fixed and/or random) are to be used in forming the predictions; default `*` includes all the fixed terms and relevant random terms |

`OMITTERMS` = formula |
Specifies terms to be excluded from the `MODEL` ; default `*` i.e. none |

`FACTORIAL` = scalar |
Limit on the number of factors or variates in each term in the models specified by `MODEL` or `OMITTERMS` ; default 3 |

`PRESENTCOMBINATIONS` = factors |
Lists factors for which averages should be taken across combinations that are present |

`WEIGHTS` = tables |
One-way tables of weights classified by factors in the model; default `*` |

`OFFSET` = scalar |
Value of offset on which to base predictions; default 0 |

`NBINOMIAL` = scalar |
Supplies the total number of trials to be used for prediction with a binomial distribution (providing a value n greater than one allows predictions to be made of the number of “successes” out of n, whereas the value one predicts the proportion of successes); default 1 |

`PREDICTIONS` = table or scalar |
To save the predictions; default `*` |

`BACKPREDICTIONS` = table or scalar |
To save back-transformed predictions; default `*` |

`SE` = table or scalar |
To save standard errors of predictions; default `*` |

`SED` = symmetric matrix |
To save standard errors of differences between predictions; default `*` |

`VCOVARIANCE` = symmetric matrix |
To save variances and covariances of predictions; default `*` |

`GLSAVE` = pointer |
Save structure from the `GLMM` analysis; default `*` uses the `SAVE` structure from the most recent `GLMM` analysis |

**Parameters**

`CLASSIFY` = vectors |
Variates and/or factors to classify table of predictions |

`LEVELS` = variates, scalars or texts |
To specify values of variates and/or levels of factors for which predictions are calculated |

`PARALLEL` = identifiers |
For each vector in the `CLASSIFY` list, allows you to specify another vector in the `CLASSIFY` list with which the values of this vector should change in parallel (you then obtain just one dimension in the table of predictions for these vectors) |

`NEWFACTOR` = identifiers |
Identifiers for new factors that are defined when `LEVELS` are specified |

**Description**

`GLPREDICT`

can be used after the `GLMM`

directive to produce predictions of the values of the response variate at particular values of the variables in the fixed or random models. By default the predictions are from the most recent `GLMM`

analysis, but you can use another analysis by supplying its save structure using the `GLSAVE`

option.

The parameters are the same as those of `VPREDICT`

(which `GLPREDICT`

uses to form the predictions). The `CLASSIFY`

parameter specifies variates or factors that are to be included in the table of predictions, and the `LEVELS`

parameter supplies the values at which the predictions are to be made. For a factor, you can select some or all of the levels, while for a variate you can specify any set of values. A single level or value is represented by a scalar; several levels or values must be combined into a variate (which may of course be `unnamed`

). Alternatively, if the factor has labels, you can use these to select the levels for prediction by setting `LEVELS`

to a text. A missing value in the `LEVELS`

parameter is taken to stand for all the levels of a factor, or the mean value of a variate.

The `PARALLEL`

parameter allows you to indicate that a factor or variate should change in parallel with another factor or variate. Both of these should have the same number of values specified for it by the `LEVELS`

parameter of `GLPREDICT`

. The predictions are then formed for each set of corresponding values rather than for every combination of these values.

When you specify `LEVELS`

, a new factor must be defined to classify that dimension of the table. By default this will be an unnamed factor, but you can use the `NEWFACTOR`

parameter to give it an identifier. The `EXTRA`

attribute of the factor is set to the name of the corresponding factor or variate in the `CLASSIFY`

list; this will then be used to label that dimension of the table of predictions.

The prediction calculations consist of two steps. The first step is to calculate a table of fitted values. The `MODEL`

, `OMITTERMS`

and `FACTORIAL`

options specify the model to use for this. The formula specified by `MODEL`

is expanded into a list of model terms, deleting any that contain more variates of factors than the limit specified by the `FACTORIAL`

option. Then, any terms in the formula specified by `OMITTERMS`

are removed.

The second step averages the fitted values over the classifications that are not in the list that was supplied by the `CLASSIFY`

parameter. The `WEIGHTS`

option can supply one-way tables classified by any of the factors in the model. These are used to calculate the weight to be used for each fitted value when calculating the averages. Equal weights are assumed for any factor for which no table of weights has been supplied. (Note, this differs from the default in `PREDICT`

, which uses *marginal weights*; see the `VPREDICT`

option `ADJUSTMENT`

for details.) In the averaging all the fitted values are generally used. However, if you define a list of factors using the `PRESENTCOMBINATIONS`

option, any combination of levels of these factors that does not occur in the data will be omitted from the averaging. Where a prediction is found to be inestimable, i.e. not invariant to the model parameterization, a missing value is given.

The `OFFSET`

option specifies the offset value to use when calculating predicted means. The default is zero.

The `NBINOMIAL`

parameter can be used to supply the total number of trials to be used for back-transformed predictions with a binomial distribution. If you provide a value *n* greater than one, `GLPREDICT`

predicts the number of “successes” out of *n*. The default, `NBINOMIAL=1`

, predicts the proportion of successes.

Printed output is controlled by settings of the `PRINT`

option with settings:

`description`

describes the terms and standardization policies used when forming the predictions,

`predictions`

prints the predictions,

`backpredictions`

prints back-transformed predictions,

`se`

prints standard errors of the predictions,

`sesummary`

prints the minimum, average and maximum standard error,

`sed`

prints standard errors of differences between the predictions,

`sedsummary`

prints the minimum, average and maximum standard error of difference,

`vcovariance`

prints the variance and covariances of the predictions.

The default is to print descriptions, predictions, back-transformed predictions, and a summary of the standard error of differences. Standard errors and standard errors of differences are printed only if the predictions themselves are printed.

You can also save the results, using the `PREDICTIONS`

, `BACKPREDICTIONS`

, `SE`

, `SED`

and `VCOVARIANCE`

options.

Options: `PRINT`

, `MODEL`

, `OMITTERMS`

, `FACTORIAL`

, `PRESENTCOMBINATIONS`

, `WEIGHTS`

, `OFFSET`

, `NBINOMIAL`

, `PREDICTIONS`

, `BACKPREDICTIONS`

, `SE`

, `SED`

, `VCOVARIANCE`

, `GLSAVE`

.

Parameters: `CLASSIFY`

, `LEVELS`

, `PARALLEL`

, `NEWFACTOR`

.

### See also

Procedures: `GLMM`

, `GLDISPLAY`

, `GLKEEP`

, `GLPERMTEST`

, `GLPLOT`

, `GLRTEST`

, `GLTOBITPOISSON`

.

Commands for: Regression analysis.

### Example

CAPTION 'GLPREDICT example',\ !t('Data from an experiment on Great Knott, Rothamsted;',\ 'see West, J.S., Fitt, B.D.L., Leech, P.K., Biddulph, J.E.,',\ 'Huang, Y.-J. &, Balesdent, M.-H. (2002).',\ 'Effects of timing of ~italic{Leptosphaeria maculans}',\ 'ascospore release and fungicide regime on phoma leaf spot',\ 'and phoma stem canker development on winter oilseed rape',\ '(~italic{Brassica napus}) in southern England.',\ 'Plant Pathology, 51, 454–463.'); STYLE=meta,plain SPLOAD [PRINT=*] '%data%/GtKnott2000.gsh' GLMM [PRINT=model,components,wald,deviance; DISTRIBUTION=binomial;\ LINK=logit; DISPERSION=*; FIXED=Cultivar*Fungicide;\ RANDOM=Block/Wholeplot] LMplants; NBINOMIAL=Nplants GLPREDICT [PRINT=predictions,backpredictions,sed; PREDICTIONS=Predictions;\ SED=sed] Cultivar,Fungicide PEN 11,12; SYMBOL='circle'; CSYMBOL='red','blue'; CFILL='match'; SIZE=1.25 VARIATE [VALUES=11,12] pens DTABLE Predictions; XFACTOR=Fungicide; GROUPS=Cultivar; BAR=MEAN(sed);\ BARDESCRIPTION='average sed'; PENS=pens