Announcement

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

  • Dunntest results are half those in python

    So I did a dunntest in Stata with Bonferroni correction and did a similar test in Python to plot a heatmap. I realise that the results in python are double that in Stata. I am thinking two-tail and one-tail issues but the documentation says they are two-tailed by default. Is there anyway to figure that out in Stata?

  • #2
    Reproducible examples, please!

    Comment


    • #3
      Originally posted by Hassan Yakubu View Post
      So I did a dunntest in Stata with Bonferroni correction and did a similar test in Python to plot a heatmap. I realise that the results in python are double that in Stata. I am thinking two-tail and one-tail issues but the documentation says they are two-tailed by default. Is there anyway to figure that out in Stata?
      From the documentation to dunntest:
      altp directs dunntest to express p-values in alternative format. The default is to express p = P(Z >= |z|), and reject Ho if p >= alpha\2. When the altp option is used, p-values are instead expressed as p = P(|Z| >= |z|), and reject Ho if p <= alpha. These two expressions give identical test results. Use of altp is therefore merely a semantic choice.
      These are just two different ways of expressing p-values for two-sided tests (the absolute value bars around z are what makes this a two-sided test).

      Aside: The default expression of p-values by dunntest corresponds to the way Olive Jean Dunn expressed p-values in her seminal article.
      Last edited by Alexis Dinno; 04 Nov 2024, 13:07.

      Comment


      • #4
        I have attached screenshots and the dta as well
        Attached Files

        Comment


        • #5
          Hello Hassan Yakubu. If you follow the advice in the FAQ (see especially point 12), you'll be much more likely to receive some good help.
          --
          Bruce Weaver
          Email: [email protected]
          Version: Stata/MP 18.5 (Windows)

          Comment


          • #6
            Originally posted by Hassan Yakubu View Post
            I have attached . . . the dta as well
            Thanks.

            Be sure to download the latest version of dunntest from Alexis's personal website, which search dunntest will bring up (scroll down). The version at the Stata Journal website is older and doesn't have the altp option.

            The output from the most recent version (run the code below) matches what you show for Python above in #4. (Complete do-file and log file attached for your convenience.)
            Code:
            version 18.0
            
            clear *
            
            // Fetching most recent version of -dunntest-
            foreach suffix in ado sthlp {
                copy "https://alexisdinno.com/stata/dunntest.`suffix'" ///
                    `c(pwd)'`c(dirsep)'dunntest.`suffix'
            }
            
            // Trial
            copy "https://www.statalist.org/forums/filedata/fetch?id=1766994" ///
                `c(pwd)'`c(dirsep)'trial.dta
            
            use trial
            dunntest hh_eeff_knowledge, by(urban_form) altp
            
            exit
            Attached Files

            Comment


            • #7
              Originally posted by Alexis Dinno View Post

              From the documentation to dunntest:
              altp directs dunntest to express p-values in alternative format. The default is to express p = P(Z >= |z|), and reject Ho if p >= alpha\2. When the altp option is used, p-values are instead expressed as p = P(|Z| >= |z|), and reject Ho if p <= alpha. These two expressions give identical test results. Use of altp is therefore merely a semantic choice.
              These are just two different ways of expressing p-values for two-sided tests (the absolute value bars around z are what makes this a two-sided test).

              Aside: The default expression of p-values by dunntest corresponds to the way Olive Jean Dunn expressed p-values in her seminal article.
              Thanks for the reply and info, Alexis. I installed your package and that resolved it.

              Comment


              • #8
                Originally posted by Joseph Coveney View Post
                Thanks.

                Be sure to download the latest version of dunntest from Alexis's personal website, which search dunntest will bring up (scroll down). The version at the Stata Journal website is older and doesn't have the altp option.

                The output from the most recent version (run the code below) matches what you show for Python above in #4. (Complete do-file and log file attached for your convenience.)
                Code:
                version 18.0
                
                clear *
                
                // Fetching most recent version of -dunntest-
                foreach suffix in ado sthlp {
                copy "https://alexisdinno.com/stata/dunntest.`suffix'" ///
                `c(pwd)'`c(dirsep)'dunntest.`suffix'
                }
                
                // Trial
                copy "https://www.statalist.org/forums/filedata/fetch?id=1766994" ///
                `c(pwd)'`c(dirsep)'trial.dta
                
                use trial
                dunntest hh_eeff_knowledge, by(urban_form) altp
                
                exit
                Thanks Joseph, that's a saver!! It worked.

                Comment

                Working...
                X