*! version 1.0.0 21aug2018

ucgof -- Univariate categorical goodness-of-fit tests

Syntax

ucgof varname
[,
options]

Main
model(# # ...) proportions (as percentages) specified by the model, 0 < P < 100; default model is for equal proportions in all categories (100 divided by number of categories)

freq use this option if the input data are given as a frequency table rather than individual observations. The variable in the data file that shows frequencies needs to be named _freq.

Description

ucgof displays the conventional chi-squared goodness-of-fit tests for a single categorical variable--namely, Pearson (χ²) and likelihood-ratio (G). Standardized residuals and their Bonferroni-adjusted p-values are also computed.

Note: ucgof was designed to be used on raw data--i.e., data that are stored as individual observations rather than aggregated frequencies. However, there is an option to use frequencies if needed.

Examples

Setup

. sysuse nlsw88

Compute the GOF tests for race; since no model was specified, the default model of equal proportions is used (in this instance, race has three levels, so 33.3% for all categories)

. ucgof race

Compute the GOF tests for race using the model 70% white, 25% black, and 5% other

. ucgof race, model(70 25 5)

Acknowledgment

This program was adapted from the following packages:

- tab_chi/chitest (N. J. Cox, 1999)

- csgof (Statistical Consulting Group - UCLA, 2015)