------------------------------------------------------------------------------- help forxglm(Roger Newson) -------------------------------------------------------------------------------

Extended version ofglm

xglm[varlist] [if] [in] [weight] [,glm_options]where

glm_optionsis a list of options used byglm.

Description

xglmis an extended version ofglm, designed mostly for use with theparmbymodule of theparmestpackage, downloadable from SSC.

Remarks

xglmcurrently saves only 2 extra results,e(depvarsum)ande(msum), containing the sum of the dependent variable specified ine(depvar)and the sum of the binomial total specified ine(m), respectively, limited to the estimation sample specified ine(sample). This allows users of theparmbymodule of theparmestpackage to output these sums to the output dataset (or resultsset) as an additional variable. This is especially useful for models with a binomial or Poisson variance function, because the user can then use these extra variables to produce diagnostic variables, such as the number of events or non-events per estimated parameter, which can then inform the user regarding whether the Central Limit Theorem is likely to work for a binomial or Poisson generalized linear model in an estimation sample of the size available.

ExamplesThe following example illustrates the use of

e(depvarsum)to store an event count in aparmbyresultsset containing the parameters of 2 logistic regression models of non-US origin with respect to repair record, one in even-numbered models, one in odd-numbered models. In the resultsset, the diagnostic indicator variableepparmcontains the number of events or nonevents (whichever is smaller) per estimated parameter. The values of this diagnostic variable are well below 5, indicate that the Central Limit Theorem will not work very well for the parameter estimates. Note that the number of estimated parameters is stored ine(df_m), because we are using thenoconstoption, and the variablebaseline, to cause the baseline odds to be displayed byglmwith theeformoption.Set-up:

.sysuse auto, clear.gene byte odd=mod(_n,2).lab var odd "Oddness of model sequence number".lab def odd 0 "Even" 1 "Odd".lab val odd odd.gene byte baseline=1.lab var baseline "Baseline".describeEstimation and diagnostics:

.parmby "xglm foreign baseline i.rep78, family(bin) link(logit) eformnoconst robust", eform omit escal(df_m N depvarsum) rename(es_1Nparm es_2 N es_3 Nforeign) by(odd) norestore.gene enevents=min(Nforeign,N-Nforeign).gene nepparm=enevents/Nparm.lab var enevents "Events or non-events".lab var nepparm "Events or non-events per parameter".describe.by odd: list parm N Nparm Nforeign enevents nepparm omit estimatemin* max* p

AuthorRoger Newson, National Heart and Lung Institute, Imperial College London, UK. Email: r.newson@imperial.ac.uk

Saved results

xglmsaves ine()all results saved byglm, and also the following:Scalars

e(depvarsum)sum of dependent variable in estimation samplee(msum)sum of binomial trialse(m)in estimation sample

Also seeManual:

[R] glmHelp:

[R] glmparmest,parmbyif installed