Announcement

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

  • Proportions in stata between 4 groups

    Hello All,

    I am trying to calculate proportions along with their difference, P value and CI's between 4 groups. I am not sure how to calculate, i tried to use table1_mc which given me pairwise comparison but between 3 groups not 4and no CI and differences. can any one suggest me how to do that in stata? or any one share syntax or any packages with codes.
    Last edited by Ameer Muhammad; 19 Aug 2021, 11:00.

  • #2
    You do not provide enough information here to get a useful answer. Please show example data, using the -dataex- command. Then explain what proportions you need to calculate and which differences among them, and what are the four groups.

    If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment


    • #3
      Thank you for your reply, I am analyzing one of the randomized controlled trial data which include 4 arms and wanted to see impact of intervention on stillbirths (coded as 0 and 1) . So i wanted to analyze the data, and need to compare proportion of stillbirths in each arm.

      Comment


      • #4
        Code:
        tab stillbirth arm, col chi2
        will give you the numbers and percentages of stillbirths in each arm, as well as a chi square test of the null hypothesis that all four arms have equal probabilities of stillbirth.

        Another approach that will give you differences in probabilities and confidence intervals around those would be:
        Code:
        logit stillbirth i.arm
        margins arm, pwcompare

        Comment


        • #5
          Originally posted by Clyde Schechter View Post
          Code:
          tab stillbirth arm, col chi2
          will give you the numbers and percentages of stillbirths in each arm, as well as a chi square test of the null hypothesis that all four arms have equal probabilities of stillbirth.

          Another approach that will give you differences in probabilities and confidence intervals around those would be:
          Code:
          logit stillbirth i.arm
          margins arm, pwcompare
          Thank you so much i worked perfectly fine. One thing is bothering me, why my odds ratios are in minus after regression? Can you comment on that please?
          Click image for larger version

Name:	odds.JPG
Views:	1
Size:	274.0 KB
ID:	1624103





          Comment


          • #6
            those are not odds ratios - the -logit- command leaves coefficients in log odds form by default; see the help file; on the other hand, the -logistic- command produces odds ratios by default

            Comment


            • #7
              Because they are not odds ratios, but log odds ratios. To see the odds ratios you need to add the or option to the logit command.
              ---------------------------------
              Maarten L. Buis
              University of Konstanz
              Department of history and sociology
              box 40
              78457 Konstanz
              Germany
              http://www.maartenbuis.nl
              ---------------------------------

              Comment


              • #8
                Yeah i got thank you Maarten Buis and Rich Goldstein

                Comment


                • #9
                  And if you want to see both the coefficients and the corresponding odds ratios, you can "replay" the -logit- command with the or and noheader options added.

                  Code:
                  logit stillbirth i.arm
                  // Replay the -logit- command with the or and noheader options
                  logit, or noheader

                  --
                  Bruce Weaver
                  Email: [email protected]
                  Version: Stata/MP 18.5 (Windows)

                  Comment

                  Working...
                  X