Agriculture Reference
In-Depth Information
and make the following modification:
quietly gen `chi1' = (abs( obsfreq - expfreq )-0.5)^2/ expfreq
This then has incorporated Yates' correction. In this particular case,
it has not changed the outcome, but there will be cases where the
outcome will be different. The original program (csgof) stands for chi-
square goodness of fit and in the modified file adding y is to indicate
Yates' correction has been added. At this point, you would want to
save the file under the new name, csgofy.ado.
As you might expect, there can be more than two categories in a
goodness-of-fit test. Davis (2000, p. 150) has an example for tractor
repairs. In his example, there are five different makes of tractor for
which data were collected on the types of repairs. The repairs were
cataloged as either electrical, fuel supply, or other. Open the data-
set Tractor Repair.dta, which encompasses these data. There are two
variables: tractor, which are the five makes of tractors labeled 1-5, and
repair, which indicates the repairs for each tractor (1: electrical, 2: fuel
supply, or 3: other). Enter the following command:
tabulate tractor repair , chi2 expected
This results in the following output:
+--------------------+
| Key |
|--------------------|
| frequency |
| expected frequency |
+--------------------+
Five |
different | Repairs: 1=Electrical, 2=Fuel supply,
makes of | 3=Other
tractor | 1 2 3 | Total
-----------+---------------------------------+----------
1 | 17 19 7 | 43
| 14.4 18.7 9.9 | 43.0
-----------+---------------------------------+----------
2 | 14 7 9 | 30
| 10.0 13.0 6.9 | 30.0
-----------+---------------------------------+----------
3 | 6 21 12 | 39
| 13.1 17.0 9.0 | 39.0
-----------+---------------------------------+----------
Search WWH ::




Custom Search