1. Home
  2. GLKEEP procedure

GLKEEP procedure

Saves results from a GLMM analysis (R.W. Payne).

Options

FACTORIAL = scalar Limit on number of factors in the model terms generated from the TERMS parameter; default 3
RESIDUALS = variate Residuals from the analysis
FITTEDVALUES = variate Fitted values from the analysis
DISPERSION = scalar Dispersion component
VCOVARIANCE = symmetric matrix Variance-covariance matrix for the estimates of the variance components
VESTIMATES = variate Saves a vector of all parameters in the variance model
VARESTIMATES = symmetric matrix Variance-covariance matrix for the parameters in the variance model (as saved by VESTIMATES)
VLABELS = text Vector of text labels for the VESTIMATES and VARESTIMATES structures
MVESTIMATES = variate Estimates of missing values
MVSE = variate Standard errors of missing-value estimates
MVUNITS = variate Unit numbers of missing values
DEVIANCE = scalar Saves the deviance
MODEL = pointer Information defining the mode
RMETHOD = string token Which random terms to use when calculating RESIDUALS (final, all); default fina
DFFIXED = scalar Number of degrees of freedom in the fixed model
DFRANDOM = scalar Number of degrees of freedom in the random model
FMETHOD = string token Controls how to calculate F-statistics for fixed terms (automatic, none, algebraic, numerical); default auto
WMETHOD = string token Controls which Wald statistics are saved (add, drop); default drop
OFFSET = scalar Offset value to use when calculating predicted means; default 0
ITERATIVEWEIGHTS = variate Saves the iterative weights from the generalized linear model fitting
LINEARPREDICTOR = variate Linear predictor from a generalized linear model
YADJUSTED = variate Adjusted response variate
ZADJUSTED = variate Adjusted dependent variate on the linear predictor scale
LPRESIDUALS = variate Residuals from the fit on the linear predictor scale
SELPRESIDUALS = variate Standard errors for the residuals from the fit on the linear predictor scale
EXIT = scalar Exit status of the fit (0 if successful)
GLSAVE = pointer Save structure from the GLMM analysis

Parameters

TERMS = formula Model terms for which information is required
COMPONENTS = scalar or pointer to scalars Estimated variance components
MEANS = table or pointer to tables Predicted means for each term
BACKMEANS = table or pointer to tables Back-transformed means
SEDMEANS = symmetric matrix or pointer to symmetric matrices Standard errors of differences between means
VARMEANS = symmetric matrix or pointer to symmetric matrices Variance-covariance matrix for the means
EFFECTS = table or pointer to tables Effects for each term
SEDEFFECTS = symmetric matrix or pointer to symmetric matrices Standard errors of differences between effects
VAREFFECTS = symmetric matrix or pointer to symmetric matrices Variance-covariance matrix for the effects
CADJUSTMENT = scalar or pointer to scalars For a term involving covariates, saves the adjustment made to its values during the analysis
WALD = scalar or pointer to scalars Wald statistic (fixed terms only)
FSTATISTIC = scalar or pointer to scalars F statistics (fixed terms only)
NDF = scalar or pointer to scalars Numerator d.f. (fixed terms only)
DDF = scalar or pointer to scalars Denominator d.f. (fixed terms only)

Description

GLKEEP saves results from a GLMM analysis. By default the results are from the most recent GLMM analysis. Alternatively, you can set the GLSAVE parameter to a save structure (saved using the GLSAVE parameter of GLMM) to save results from an earlier analysis.

The RESIDUALS and FITTEDVALUES options can specify variates to save the residuals and fitted values, respectively.

The RMETHOD option controls the way in which residuals and fitted values are formed. With the default setting RMETHOD=final, the fitted values are calculated from all the fixed and random effects.

The setting RMETHOD=all can be used to obtain fitted values constructed from the fixed terms alone, omitting all random terms. (The residuals are then calculated as the differences between the values of the y-variate and the fitted values.)

The DISPERSION option saves the dispersion coefficient, in a scalar.

The variance-covariance matrix for the estimates of the variance component can be saved using the VCOVARIANCE option. (The estimates themselves are saved using the COMPONENTS parameter, as described below.)

The VESTIMATES option saves a variate containing all the variance parameters estimated in the model. The VARESTIMATES option can supply a symmetric matrix to save the variance-covariance matrix for the estimates of the variance parameters, matching the ordering and contents of VESTIMATES. The vector of labels for these parameters can be saved by the VLABELS option.

The MVESTIMATES option saves the deviance from the generalized linear model. This represents the variation remaining after fitting the fixed terms and all the random terms. It thus assesses how well those terms explain the random variation in the data.

The degrees of freedom fitted by the fixed model can be saved by the DFFIXED option, and the degrees of freedom in the random model can be saved by the DFRANDOM option.

The MODEL option can be used to save a pointer, with labels 'distribution', 'link', 'aggregation', 'klogratio', 'owndist', 'ownlink', 'random', 'fixed', 'constant', 'factorial', 'offset', 'cdefinitions', 'cvectors', 'y', and 'nbinomial', storing the settings of the corresponding options and parameters of GLMM. The labels can be specified in either lower or upper case, or any mixture.

The ITERATIVEWEIGHTS parameter saves the iterative weights used in the last cycle of the iteration, and the LINEARPREDICTOR parameter saves the linear predictor. The YADJUSTED parameter saves the adjusted response variate used in the last cycle of the iteration, and the ZADJUSTED parameter similarly saves the adjusted response variate on the scale of the linear predictor. The LPRESIDUALS option saves the residuals from the fit on the linear predictor scale. To avoid problems with 0 and 100% observations, they are calculated as differences between the adjusted dependent variate and the fitted values on that scale. The SELPRESIDUALS option saves their standard errors. The EXIT option saves a scalar indicating the exit status for the fit of the GLMM (0 if successful, 1 otherwise).

The parameters of GLKEEP save information about particular model terms in the analysis. With the TERMS parameter you specify a model formula, which Genstat expands to form the series of model terms about which you wish to save information. The FACTORIAL option sets a limit on the number of factors in each term. Any term containing more than that limit is deleted. The subsequent parameters allow you to specify identifiers of data structures to store various components of information for each of the terms that you have specified.

The MEANS parameter saves tables of predicted means, and the BACKMEANS parameter saves back-transformed means. The OFFSET option specifies the offset value to use when calculating predicted means; the default is zero. The SEDMEANS parameter saves symmetric matrices of standard errors of differences for the means, and the VARMEANS parameter saves symmetric matrices of their variances and covariances. The EFFECTS parameter saves tables of effects, and the SEDEFFECTS and VAREFFECTS parameter saves symmetric matrices with standard errors for their differences and their variances and covariances, respectively.

If a term involves a covariate, the CADJUSTMENT parameter can save the adjustment that will have been made to its values during the analysis. This will be zero if option CADJUST was set to none in GLMM. Alternatively, if CADJUST had its default setting of mean, each covariate will have been centred by subtracting its (weighted) mean.

The Wald statistic for fixed terms can be saved in scalars using the WALD parameter. The WMETHOD option controls whether these are from the table where terms are added sequentially to the model, or that where terms are dropped from the full fixed model. The associated F statistic, and its numerator and denominator numbers of degrees of freedom, can be saved in scalars by the FSTATISTIC, NDF and DDF parameters, respectively. The FMETHOD option specifies which algorithm to use to calculate the denominator numbers of degrees of freedom. The default, automatic, will use any stored values that have been calculated for this analysis by earlier GLMM, GLDISPLAY or GLKEEP statements; otherwise it will choose automatically between the two available methods. (See REML for more details.)

If you have a single term, you can supply a table, symmetric matrix or scalar for each of these parameters, as appropriate. However, if you have several terms, you must supply a pointer which will then be set up to contain as many tables, symmetric matrices or scalars as there are terms.

Options: FACTORIAL, RESIDUALS, FITTEDVALUES, DISPERSION, VCOVARIANCE, VESTIMATES, VARESTIMATES, VLABELS, MVESTIMATES, MVSE, MVUNITS, DEVIANCE,  MODEL, RMETHOD, DFFIXED, DFRANDOM, FMETHOD, WMETHOD,  OFFSET, ITERATIVEWEIGHTS, LINEARPREDICTOR, YADJUSTED, ZADJUSTED, LPRESIDUALS, SELPRESIDUALS, EXIT, GLSAVE. Parameters: TERMS, COMPONENTS, MEANS, BACKMEANS, SEDMEANS, VARMEANS, EFFECTS, SEDEFFECTS, VAREFFECTS, CADJUSTMENT, WALD, FSTATISTIC, NDF, DDF.

See also

Procedures: GLMM, GLDISDPLAY, GLPERMTEST, GPLOT, GLPREDICT, GLRTEST, GLTOBITPOISSON.
Commands for: Regression analysis.

Example

CAPTION   'GLKEEP 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; DISTRIBUTION=binomial;\
          LINK=logit; DISPERSION=*; FIXED=Cultivar*Fungicide;\
          RANDOM=Block/Wholeplot] LMplants; NBINOMIAL=Nplants
GLDISPLAY [PRINT=deviance; DEVMETHOD=fulllikelihood]
GLKEEP    [DEVIANCE=dev1; DFFIXED=df1; DEVMETHOD=fulllikelihood]
GLMM      [PRINT=model; DISTRIBUTION=binomial; LINK=logit;\
          DISPERSION=*; FIXED=Cultivar+Fungicide; RANDOM=Block/Wholeplot]\
          LMplants; NBINOMIAL=Nplants
GLDISPLAY [PRINT=deviance; DEVMETHOD=fulllikelihood]
GLKEEP    [DEVIANCE=dev2; DFFIXED=df2; DEVMETHOD=fulllikelihood]
CALCULATE change,dfchange = dev2,df1 - dev1,df2
PRINT    'Change',change,dfchange; decimals=*,3,0; HEAD=*,'Deviance','d.f.'
Updated on February 7, 2023

Was this article helpful?