1. Home
  2. HGKEEP procedure

HGKEEP procedure

Saves information from a hierarchical or double hierarchical generalized linear model analysis (R.W. Payne, Y. Lee, J.A. Nelder & M. Noh).

Options

MODELTYPE = string token Type of model from which to save information (mean, dispersion); default mean
RMETHOD = string token Type of residuals to save using the RESIDUALS parameter (deviance, Pearson, simple); default devi
DMETHOD = string token Method to use for the adjusted profile likelihood when calculating the likelihood statistics (automatic, choleski, lrv); default auto
IGNOREFAILURE = string token Whether to save information even if the fitting of the HGLM failed to converge (yes, no); default no
SAVE = pointer Save structure (from HGANALYSE) to provide details of the analysis; if omitted, information is saved from the most recent analysis

Parameters

RANDOMTERM = formula Random model terms from whose analysis the information is to be saved
DHGRANDOMTERM = formula Random model terms in a DHGLM from whose (HGLM) analysis the information is to be saved
RESIDUALS = variates Residuals
FITTEDVALUES = variates Fitted values
LEVERAGES = variates Leverages
ESTIMATES = variates Estimates of parameters
SE = variates Standard errors of the estimates
VCOVARIANCE = symmetric matrices Variance-covariance matrix of each set of estimates
DEVIANCE = scalars or tables Scaled deviances (in a table) for a mean model, or residual deviance (in a scalar) for a dispersion model
DF = scalars or tables Residual degrees of freedom
ITERATIVEWEIGHTS = variates Iterative weights
LINEARPREDICTOR = variates Linear predictors
YADJUSTED = variates Adjusted responses
LIKELIHOODSTATISTICS = variates Likelihood statistics
LDF = variates Numbers of fixed and random parameters in the mean and dispersion models

Description

HGKEEP is one of several procedures with the prefix HG, which provide tools for fitting the hierarchical and double hierarchical generalized linear models (HGLMs and DHGLMs) defined by Lee & Nelder (1996, 2001, 2006) and described by Lee, Nelder & Pawitan (2006). The models are defined by the HGFIXEDMODEL, HGRANDOMMODEL and HGDRANDOMMODEL procedures, and fitted by the HGANALYSE procedure. HGKEEP allows you to copy information from the output into standard Genstat data structures.

The MODELTYPE option indicates the model (mean or dispersion) from which the information is to be saved; by default this is the model for the mean (i.e. the main HGLM). The RANDOMTERM parameter specifies the random term from whose analysis the information is to be saved; if this is omitted the information is for the residual term (phi). If a DHGLM has been fitted, you can save information from the HGLM that is being used as a dispersion model by setting the DHGRANDOMTERM parameter to the random term concerned. The LIKELIHOODSTATISTICS parameter saves the likelihood statistics (as given by the likelihoodstatistics setting of the PRINT option of HGANALYSE and HGDISPLAY). The DMETHOD option controls the method used to calculate the adjusted profile likelihood during the calculation of the likelihood statistics. The choleski method is fastest, while the lrv method provides a more robust alternative to use if choleski fails. The default setting, automatic, tries choleski first and then, if that fails, uses lrv nstead. The LDF parameter saves the numbers of fixed and random parameters in the mean and dispersion models. (These accompany the likelihood statistics in the output, and indicate the numbers of parameters represented by the various statistics.) The other parameters operate as in the RKEEP directive except that, for a mean model, DEVIANCE saves tables of scaled deviances and DF saves a table with the corresponding degrees of freedom. Similarly, as in the RKEEP directive, the RMETHOD option indicates the type of residual to form.

By default, HGKEEP will give a warning (and nothing will be saved) if the fitting of the HGLM failed to converge. Alternatively, you can set option IGNOREFAILURE=yes to save information from the final iteration.

Options: MODELTYPE, RMETHOD, DMETHOD, IGNOREFAILURE, SAVE.

Parameters: RANDOMTERM, DHGRANDOMTERM, RESIDUALS, FITTEDVALUES, LEVERAGES, ESTIMATES, SE, VCOVARIANCE, DEVIANCE, DF, ITERATIVEWEIGHTS, LINEARPREDICTOR, YADJUSTED, LIKELIHOODSTATISTICS.

Method

HGKEEP mainly uses the RKEEP directive.

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. (2001). 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. (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 and Hall, Boca Raton.

See also

Procedures: HGANALYSE, HGDISPLAY, HGDRANDOMMODEL, HGFIXEDMODEL, HGFTEST, HGGRAPH, HGNONLINEAR, HGPLOT, HGPREDICT, HGRANDOMMODEL, HGRTEST, HGSTATUS, HGTOBITPOISSON, HGWALD.

Commands for: Regression analysis.

Example

CAPTION  'HGKEEP example',!t(\
         'Breaking angles of cake baked from 3 recipes at 10 temperatures',\
         '(Cochran & Cox, 1957, Experimental Designs, page 300).');\
         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
HGKEEP        RESIDUALS=Residual; FITTEDVALUES=Fitted; LEVERAGES=Leverage;\
              ESTIMATES=Estimate; SE=se;\
              VCOVARIANCE=Vcovariance; DEVIANCE=Deviance; DF=df;\
              ITERATIVEWEIGHTS=Iweight; LINEARPREDICTOR=Lpredictor;\
              YADJUSTED=Yadjusted
PRINT         Angle,Residual,Fitted,Leverage,Yadjusted,Lpredictor,Iweight;\
              FIELD=11
&             Estimate,se
&             Vcovariance; FIELD=14
&             Deviance,df
HGKEEP        RANDOMTERM=Replicate;\
              RESIDUALS=Residual; FITTEDVALUES=Fitted; LEVERAGES=Leverage;\
              ESTIMATES=Estimate; SE=se;\
              ITERATIVEWEIGHTS=Iweight; LINEARPREDICTOR=Lpredictor;\
              YADJUSTED=Yadjusted
PRINT         Residual,Fitted,Leverage,Yadjusted,Lpredictor,Iweight;\
              FIELD=11
&             Estimate,se
&             Deviance,df
Updated on February 7, 2023

Was this article helpful?