.- help on ^gof^ (STB-36: sg68) .- Goodness of fit statistics for multinomial distributions -------------------------------------------------------- ^gof^ obs exp [^if^ exp] [^in^ range] [^,^ ^x2 cr g2 lr ft kl x2n la^mbda^(^numeric-list^) by(^varlist^)^ ^df(^#^) li^st ^n(^#^) p^lot ^sc^ale ^sa^ving^(^filename^)^ ] See help for @numlist@ (if installed) for a description of a numeric-list. Description ----------- ^gof^ computes goodness-of-fit (gof) statistics between observed (^obs^) and expected (^exp^) values from a multinomial distribution. The statistics ^CR(obs,exp,L)^ belong to the Cressie-Read family of discrepancy measures, ^CR(obs,exp,L) = 2 sum obs*((obs/exp)^^L-1) / (L*(L+1))^ with L(ambda) some real parameter, and summation is over all "cells" (catego- ries). Well-known special cases are: L description abbrev. formula ------------------------------------------------------------------------------ ^1.0^ Pearson's X2 X2 sum (obs-exp) ^^2/exp ^2/3^ C & R's recommended statistic CR ^0.0^ log-likelihood ratio (deviance) LR=G2 2 sum obs log(obs/exp) ^-0.5^ Freeman-Tukey's statistic FT 4 sum (sqrt(obs)-srqt(exp))^^2 ^-1.0^ Kullbach-Leibner information KL 2 sum exp log(exp/obs) ^-2.0^ Neyman's modified X2 X2N sum (obs-exp)^^2/obs If the estimate ^exp^ are efficient, the ^CR^ statistics are asymptotically first-order equivalent, and chi square distributed ^df^ degrees of freedom, with df = #cells - #constraints. Options to select ^L^ ------------------- ^x2 cr g2 lr ft kl x2n^ specify that the respective tests are displayed. ^lambda(^numeric-lists^)^ specifies a range of powers L for the Cressie-Read statistics. We advise to restrict lambda to values between -2 and 2. See below for an example of a numeric-list. Specifying none of these options implies all of ^x2 cr lr ft kl x2n^, or, stated differently, ^lambda(-2 -1 -.5 0 .667 1)^. Other options ------------- ^by(^varlist^)^ specifies a list of variables on which to aggregate ^obs^ and ^exp^ (join "cells" with the same values on varlist) before computing the goodness-of-fit statistics. ^df^(#^)^ specifies the degrees of freedom used in the computations of chi square based approximate significance levels. ^list^ specifies that the table with statistic values is displayed. This option is effective only in combination with ^plot^. ^n(^#^)^ specifies that the variables obs and exp are expressed as proportions with the total number of observations equal to #. ^plot^ specifies that a statistic-by-lambda plot is displayed. If ^df^ is speci- fied, horizontal lines at the 90%, 95%, and 99% critical values of the (central) chi square distribution are shown. The usual output table is suppressed in this case. ^saving(^filename^)^ specifies the name of a file for the statistic-by-lambda plot. ^scale^ specifies that the expected values may be scaled so that they sum to the number of observations. Otherwise obs and exp should have equal sums (within a .001 multiplicative margin). Examples -------- . ^gof obs exp^ . ^gof obs exp, df(3)^ (specify degrees of freedom) . ^gof obs exp, df(3) lr x2 by(educate)^ (specify stats and aggregation) . ^gof obs exp, df(4) la(-2-2/0.25)^ (specify stats with numlist) . ^gof obs exp, df(5) l(-2-2/0.10) plot saving(gof)^ (plot stats) Author ------ Jeroen Weesie Utrecht University Netherlands weesie@@weesie.fsw.ruu.nl References ---------- Cressie, N. A. C. & T. R. C. Read. 1984, Multinomial Goodness-of-Fit Tests, Journal of the Royal Statistical Society, Series B, 46, 440-464. Read, T. R. C & N. A. C. Cressie. 1988, Goodness-of-Fit Statistics for Discrete Multivariate Data, New York, Springer Verlag. Technical remarks ----------------- For ^L^ << 0, the CR-statistic is particularly sensitive for observed values that are much smaller than the expected values. For ^L^ >> 0, the CR-statistic is particularly sensitive for observed values that are much larger than the expected values. Of course, obs and exp should be >= 0. Moreover, ^L^ < 0 requires that all obs > 0, while ^L^ > 0 requires that all exp > 0. Also see -------- STB: STB-36 sg68 On-line: help for @numlist@ (if installed)