Announcement

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

  • How to? Chi test of homogeneity for categorial variables

    Hi guys,

    Below i have included a sample of my two categorial variables. How do i perform a Chi^2 test to check if the distribution of the three exit types (Buyback, Sale, IPO) are the same between the three investor types (Foreign, local, mixed).
    A test of homogeneity i think it is? The chi^2 pearson test i found in Stata is testing if they are independent another as far as i can tell..

    Regards

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str7(var1 var2)
    "Foreign" "Buyback"
    "Local"   "Buyback"
    "Foreign" "Sale"   
    "Local"   "Sale"   
    "Foreign" "IPO"    
    "Local"   "Sale"   
    "Local"   "IPO"    
    "Foreign" "Buyback"
    "Foreign" "IPO"    
    "Mixed"   "Sale"   
    "Mixed"   "Sale"   
    "Mixed"   "IPO"    
    end

  • #2
    tabulate does what you want.

    Comment


    • #3
      Hi Nick

      Thanks for the answer. Can you explain more how i can perform the test using tabulate? Are you referring to the two-way table with measures of association? Which test will give me the test of homogeneity?

      Comment


      • #4
        I don't use that jargon personally. As I understand it, you are asking whether your two variables are associated, and tabulate gives you that test. With your data example (thanks!) I get

        Code:
        . tabulate var?, chi2 
        
                  |               var2
              var1 |   Buyback        IPO       Sale |     Total
        -----------+---------------------------------+----------
           Foreign |         2          2          1 |         5 
             Local |         1          1          2 |         4 
             Mixed |         0          1          2 |         3 
        -----------+---------------------------------+----------
             Total |         3          4          5 |        12 
        
                  Pearson chi2(4) =   2.4300   Pr = 0.657
        For a further command with some more bells and whistles, see tabchi from tab_chi (SSC).

        Comment


        • #5
          Hi Nick

          Thanks a lot! I am not sure however, that this is the test that i am looking for. I want to test if Buyback, IPO and Sale are distributed equally between Foreign, Local And Mixed with some statistical significance. As far as i understand, the Pearson Chi^2 is a goodness of fit test, that tests if the two categorial variables are independant - is this correct? Mabye a Chi^2 test is not the test i am looking for?

          Best
          Dennis

          Comment


          • #6
            When you say distributed equally, I think you mean that the proportions of Buyback etc. don't vary according to whether you have Foreign, Local or Mixed. That independence (lack of association) is precisely what is being tested in the example.

            Chi-squared tests of goodness of fit are quite different and in Stata require different commands. Oddly, although such tests often feature in introductory texts or courses, they don't feature nearly so much in research practice and there isn't an official command that supports them generally, although chitest from the package mentioned in #4 is one such command. For example, some introductions mention testing normality of distribution by chopping the range of a measured variable into bins and comparing observed and expected frequencies in those bins. That is a lousy test and long since superseded by better procedures, yet still sometimes seen.

            A test of whether two categorical variables are independent wouldn't usually be called a goodness of fit test, at least not by me. That is convention more than logic.

            If you remain unsure about this, there is no good remedy other than a suitable text. Despite its apparent age,

            Mosteller, F. and Rourke, R.E.R. 1973. Sturdy Statistics. Reading, MA: Addison-Wesley.

            is one I recall as very thorough, but there are many others.

            Comment

            Working...
            X