CHI SQUARE TEST (X2 - TEST)
                                 (Goodness of fit)

     The test involves the calculation of a quantity, called chi-square from the Greek letter
(X) and pronounced "kye." This test has the following common applications in medical

1.    As an alternative test to find the significance of difference in two or more than two

2. As a test of association between two events. It measures the probability of association
      between two discrete attributes. Two events can often be related such as smoking and
      cancer; treatment and outcome of disease; vaccination and immunity; nutrition and
      intelligence; cholesterol and coronary heart disease; contraceptives and breast or
      endometrial cancer in women; alcohol and gastric ulcer; and so on. There are two

This test is used to provide a quantitative test of the discrepancies between the observed
and the expected frequencies (or proportions). The symbol X2 (Chi square) is a measure
of the deviations of a number of observed frequencies from expectation; it is defined by the
following equation:

                                            f o  f e 2
where,                               


f o = observed frequency

fe = expected frequency

k = number of classes

The degree of freedom for this test is given by the following formula:
                                         Df = (k-1)

The fictional disease Bohamga Bora is usually treated by the imaginary drug
cyclobachlocine. Six months following the treatment with this drug, we found that the
probability for death, paralysis, minor effects, and complete recovery is 0.2, 0.3, 0.4, 0.1
respectively. A slight modification in the treatment procedure was tried on 200 patients
with the same symptoms. The outcome of the new treatment is shown in the table below:

                        Result                         No. of patients
                        Death                                 30
                        Paralysis                             40
                        Minor effects                         90
                        Complete recovery                     40
                        Total                                200

Use Chi square test to see if the outcome for the new treatment is different from that for the
old treatment.


Null Hypothesis (Ho):
There is no difference in the outcomes as a result of the new treatment.

              No. of patients
     Death       30
     Paralysis    40
     Minor effects 90
     Complete      40
     recovery            (20) k=4
     TOTAL         200
    X2          (fo - fe)2
          i=1    fe

    X2     = (30-40)2 + (40-60)2 + (90-80)2 + (40-20)2
            40     60     80      20

         X2 = 2.5 + 6.67 + 1.25 + 20.0 = 30.42

    DF = 4 - 1 = 3

from the table of probabilities for X2, the value listed for (DF
   =3) in the column headed 0.05 is 7.81.
We reject the null hypothesis if the computed X2 value is equal
   to or greater than the tabled X2 value:

    30.42 > 7.81      .. Reject


o   This test may be used for comparing two or more populations
      on a characteristic for which there are two or more

o   The same formula applies here.

o   The expected frequency in each cell can be calculated by
      multiplying the corresponding column and row totals
      then dividing by the grand total.

    fe = (row total) (column total)
            (grand total)

o   The degrees of freedom:
  DF =       (R-1) (C-1)


             Poison victims               Others

Hospital A          2               48             50
                  (10)             (40)

Hospital B         6               69          75 R=4
                  (15)             (60)        C=2

Hospital C         16               84             100
                  (20)             (80)

Hospital D        56        119      175
                (35)       (140)

TOTAL              80               320             400

  X2      = (2-10)2 + (48-40)2 + (6-15)2 + (69-60)2
           10        40       15      60

         + (16-20)2 + (84-80)2
             20          80
       = 6.4 + 1.6 + 5.4 + 1.35 + 0.8 + 0.2 = 15.75

DF =     (4-1) (2-1)      =   3
  X2 (from table) (DF = 3, P = 0.05) = 7.82

  X2 Calc. > X2 Table
  The four hospitals do not admit the same proportion of
  poison victims in their emergency room. The difference is
  statistically significant.

NB:   In case of a two-by-two contingency table, there is another
  formula that gives the same results while eliminating the
  need to compute expected values:

  Drug A     (a)     (b)

  Drug B     (c)     (d)

         ( ³ad - bc³ - N )2 .N
         (a+b) (c+d) (a+c)(b+d)

  This modification in the formula is a correction for
  continuity since we have 1 DF.


1. All male patients admitted to KKUH with the diagnosis of
  acute myocardial infarction were included in a study on the
  evaluation of an anticoagulant, Warfarin sodium. The 147
  patients who met the criteria of admission were divided into
  two groups by whether their hospital unit number was odd or
  even. The mortality observed in the two groups is given in
  the table below:

                  No            Anticoagulation
                  Anticoagulation    Therapy.

No. of patients          70             77
No. of Deaths             15             12

   Is there any evidence of difference in mortality between the

2. A question is raised concerning the possibility of a
   relationship between smoking history and the severity of a
   first heart attack. In a retrospective study, 1000 patients
   are chosen at random from a coronary registry. Severity of
   attack is categorized as mild, moderate, or severe. Smoking
   history is categorized on the basis of usage during the year
   preceding the attack. Four classes are used: (a) Not
   smokers, (b) Intermittent smokers, (c) Moderate smokers, and
   (d) heavy smokers (see table). Compute X2 as a test of the
   hypothesis that there is no association between the two
   variables for the patients in the registry.

             a      b     c      d
   Mild      ³ 140 ³ 120 ³      80 ³ 60 ³
      Moderate ³ 40 ³         10 ³ 100 ³ 250 ³
Severe ³ 20 ³   20 ³   70 ³ 90 ³

To top