*! version 1.1.3 15dec2022

Title

chisqi -- Goodness of fit Chi-squared test

Syntax

chisqi #1 #2 [...] \ #o11 #o12 [...] [\ #o21 #o22 ... \ ....][, labels(string) nst(string)]

Description

Immediate command to compute the goodness of fit Chi-squared test for several samples.

The command uses the specified values. First numlist #1 #2 is the theoretical distribution of the categories.
Observed cases of each sample come after, each sample separated by '\'. The number of elements of each sample
must be the same, and equal to the number of elements of the theoretical distribution. At least one sample is required.

The labels option receives a list of labels to label each category in the output table.

The nst option receives the name of the study to label the output.

Execute net from http://metodo.uab.cat/stata for install.

It is important to keep the commands updated. Execute adoupdate chisqi, update to update the chisqi command.

Execute adoupdate, update to update all the user-written commands.

If you find any bugs or want to suggest any improvements, please send an e-mail to: leam@uab.cat.

Examples

. chisqi 2 3 2 \ 19 41 31

. chisqi 2 3 2 \ 19 41 31 \ 6 23 20

. chisqi 2 3 2 \ 19 41 31 \ 6 23 20, labels(AA Aa aa)

Stored results

The command stores the following scalars in r():

One sample

r(chi2) Pearson's chi-squared

r(p) significance of Pearson's chi-squared

Two or more samples

r(chi2_i) Pearson's chi-squared for sample i

r(p_i) significance of Pearson's chi-squared for sample i

r(chi2) overall Pearson's chi-squared

r(p) overall significance of Pearson's chi-squared

Version

Version 1.1.3 -- 15 December 2022

Authors

JM.Doménech

Programmer: R.Sesma

Laboratori d'Estadística Aplicada

Universitat Autònoma de Barcelona

leam@uab.cat

Vancouver reference

Doménech JM. Goodness of fit Chi-squared test: User-written command chisqi for Stata [computer program].

V1.1.3. Bellaterra: Universitat Autònoma de Barcelona; 2022.

Available executing from Stata: net from http://metodo.uab.cat/stata

References

Doménech JM. Fundamentos de Diseño y Estadística. UD 10. Relación entre dos variables categóricas. Pruebas
de X2. 15ª ed. Barcelona: Signo; 2014.

Fisher RA. Statistical methods, experimental design and scientific inference. Oxford: Oxford University Press; 1991.