18
Stata Technical Bulletin
STB-8
smv5.1 Loglinear analysis of cross classifications, update
D. H. Judson, DecisionQuest, 1013 James St., Newberg, OR 97132
I have made several changes to the Ioglin command (Judson 1992) to improve its operation and make it act like other
estimation commands. See [4] estimate (vol. 1, p. 263) for a description of features common to estimation commands. The new
syntax for the command is
Ioglin depvar varlist Wweihht∖ [if exp∖ [in range, Ht (margins to befitted)
[ anova keep resid collapse Itol(#) iter(#) offset (#) level(#) irr ]
The changes to the Ioglin command include
1. It now works appropriately with version 3.0;
2. you can recall the results of the previous loglinear analysis by typing Ioglin without arguments;
3. tests can be performed using the test command;
4. weights are handled as frequency weights in version 3.0 syntax;
5. you can use predict after estimation to generate the log of the expected cell frequencies, if you specify the keep option;
6. you can obtain the variance-covariance matrix of the estimators using correlate, _coef;
7. you can refer to coefficients and standard errors in expressions, if you specify the keep option;
8. your data set is now protected from change in the event of an error or if you press the Break key (see [4] program-fragments,
vol. 1, p. 305);
9. the resid option no longer leaves resid, stresid, and cellhat in your data. Instead, it just prints out the list of cell
frequencies, expected cell frequencies, residuals, and standardized residuals;
10. Ioglin no longer calls poilog for estimation. Instead, it creates the design matrix and passes that matrix to poisson;
11. two options from poisson, the irr and level options, are now options for Ioglin;
12. and finally, a substantive change:
In the previous version, if you did not specify a method for constraints, regression-like constraints were assumed, which dropped
the first level of each indicator variable for each margin. If you specified the anova option, ANOVA-like constraints were
assumed, and the first level was set to be equal to —1 times the sum of all other levels.
There are no changes to the regression-like constraints. For ANOVA-like constraints, however, the new version is modified
to drop the last level and set the last level equal to —1 times the sum of all other levels. It is nonstandard, although perfectly
legal, to drop the first level. This change will make the results more comparable to other packages. At this point, I have not
implemented any method to choose which level to drop, so if you prefer dropping the first level, you are (temporarily) out of
luck. I’d be happy to hear any debate in the STB regarding which method is preferable.
References
Judson, D. H. 1992. smv5: Performing loglinear analysis of cross classifications. Stata Technical Bulletin 6: 7-17.
sqv4 Calculation of the deviance goodness-of-fit statistic after logistic
Joseph Hilbe, Editor, STB, FAX 602-860-1446
The deviance goodness-of-fit, DEV, is a summary statistic based on deviance residuals. It is interpreted in a manner similar
to the Pearson χ2 goodness-of-fit statistic (see [5s] logistic). Mathematically, DEV is calculated
j
DEV = V/
J = I
where d is the deviance residual value.
It is possible to generate this statistic by hand after logistic:
. !predict num, number
. !predict dev, deviance