Announcement

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

  • comparing outcome variable (dummy) over group

    Dear community,

    May anyone suggest a way to compare the distribution of the outcome variable(which is a dummy) over a group? I know vioplot does it for continuous outcome variables over a group. Is there any way to do that?

    regards,
    ajay
    Last edited by ajay pasi; 17 Jan 2023, 06:13.

  • #2
    The Pearson's χ2 test--> I believe is a test for that.

    Comment


    • #3
      What's a group here? The answer could be many things, depending, but if group means a categorical variable, a chi-square test could make sense, or a test comparing proportions.

      Comment


      • #4
        Thank you sir. Group is a categorical variable.

        Comment


        • #5
          Ajai:
          do you mean something along the lines of the following toy-example?
          Code:
          . sysuse auto.dta
          (1978 automobile data)
          
          . g wanted=0 if rep78<=2
          
          . replace wanted=1 if wanted==.
          
          . tabulate wanted foreign, chi2
          
                     |      Car origin
              wanted |  Domestic    Foreign |     Total
          -----------+----------------------+----------
                   0 |        10          0 |        10 
                   1 |        42         22 |        64 
          -----------+----------------------+----------
               Total |        52         22 |        74 
          
                    Pearson chi2(1) =   4.8918   Pr = 0.027
          
          .
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Hi Carlo, is my interpretation correct for chi square test for auto.dta ?

            Result implies, distributions are not statistically different between who want a domestic and who want a foreign car. As the null hypothesis is rejected because chi2 p<0.05, where the null hypothesis is both distributions are independent.

            regards,
            ajay

            Comment


            • #7
              Correct.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Thank you sir.

                Comment

                Working...
                X