Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chi Square goodness of fit Test: Output interpretation with CSGOF

    Hello,

    I did a Chi Square goodness of fit Test (with csgof) and I am having trouble to interprete the output.

    My code: csgof categories_one_to_five, expperc(17.20, 33.33, 30.11, 12.90, 6.45)
    Result: chisq(4) is 0, p = 1

    I also used a chi square calculator: http://www.quantpsy.org/chisq/chisq.htm

    I guess (4) is my degree of Freedom (DF). but chisq=0 ? is it possible? what does it mean? and p=1 so p >0.05 I guess.... what p ist used for csgof? P=0.05 or p=0.001 or else?
    According to the ouput:

    There is a significant difference between obs. and expected value for my 5 categories? right?

    Thanks in advance.


  • #2
    Please show more detail. csgof is community-contributed as from

    Code:
    net describe csgof, from(https://stats.oarc.ucla.edu/stat/stata/ado/analysis)
    as you are asked to explain (FAQ Advice #12).

    A chi-square statistic of 0 implies a P-value of 1, as the command is showing you.

    I agree that a perfect fit sounds unlikely, but perhaps the expected percents you supplied are really the observed percents, which then would explain that result.

    Otherwise please show the results of

    Code:
    tab categories_one_to_five
    and state what hypothesis you are testing.

    Comment


    • #3
      Thanks Nick for your reply. This is my tab categories_one_to_five


      Group 1-5 | Freq. Percent Cum.
      ------------+-----------------------------------
      A| 16 17.20 17.20
      B| 31 33.33 50.54
      C| 28 30.11 80.65
      D| 12 12.90 93.55
      E| 6 6.45 100.00
      ------------+-----------------------------------
      Total | 93 100.00


      the null-hypothesis would be: There is no significant difference between observed values in group A, B, C etc and the expected value.
      alternative hypothesis: There is a significant difference between obs. and expected values.
      Details: The groups are stratified for individuals with special features for example A= Living in Germany, Köln B= living in Germany, Münich, C=Germany, Berlin D=Germany Dresden E= Germany, Bremen

      Thanks for helping.

      Comment


      • #4
        You've thus answered the question: feeding observed percents to chi-square as if expected leads inevitably to the result you got.

        Sorry, but I can't see a meaning to your problem formulation otherwise. For example, it is possible to test a hypothesis that the 5 answers occur with equal frequency. Here I use chitesti from tab_chi on SSC:

        .
        Code:
         chitesti 16 31 28 12 6
        
        observed frequencies from keyboard; expected frequencies equal
        
                 Pearson chi2(4) =  24.2581   Pr =  0.000
        likelihood-ratio chi2(4) =  25.6643   Pr =  0.000
        
          +-------------------------------------------+
          | observed   expected   obs - exp   Pearson |
          |-------------------------------------------|
          |       16     18.600      -2.600    -0.603 |
          |       31     18.600      12.400     2.875 |
          |       28     18.600       9.400     2.180 |
          |       12     18.600      -6.600    -1.530 |
          |        6     18.600     -12.600    -2.922 |
          +-------------------------------------------+
        
        . ret li
        
        scalars:
                          r(k) =  5
                         r(df) =  4
                       r(chi2) =  24.25806451612903
                          r(p) =  .0000709023998155
                    r(chi2_lr) =  25.66431757144921
                       r(p_lr) =  .0000369789192453
                      r(emean) =  18.6
        .
        On the face of it, however, that hypothesis is without substantive interest and you need a better one. If your illustration for A B C D E was arbitrary and a reference distribution with equal frequencies is indeed a benchmark, then the above is one way to do it,
        Last edited by Nick Cox; 25 Aug 2022, 07:04.

        Comment

        Working...
        X