Announcement

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

  • How do I compare the means/ standard deviations of 4 datasets without full datasets to access sig difference please?

    I have tried the below, but I get why there is no p value. Any ideas please? Thank you in advance.

    clear
    input group mean sd n
    1 62.5  16.1  111
    2 33.5  7.7   115
    3 42.3  8.3   2891
    4 46.2  11.6  245
    end


    . gen se = sd/sqrt(n)

    . oneway mean group, tabulate



  • #2
    sorry assess sig dif, not access

    Comment


    • #3
      Please ignore. On reflection. I can see this is not possible to do without all complete datasets. An advisor had mentioned a "formal comparison" and so I thought it was worth a try initially.

      Comment


      • #4
        Code:
        ttesti 111 62.5 16.1 115 33.5 7.7 , unequal

        Comment


        • #5
          Code:
          clear all
          clear
          input group mean sd n
          1 62.5  16.1  111
          2 33.5  7.7   115
          3 42.3  8.3   2891
          4 46.2  11.6  245
          end
          
          g compare = ""
          g tstat = .
          g se = .
          g prob = .
          
          set obs 6
          
          local c = 1
          forv i = 1/3 {
              local ii = `i'+1
              forv j = `ii'/4 {
              local n1 = n[`i']
              local m1 = mean[`i']
              local s1 = sd[`i']
              local n2 = n[`j']
              local m2 = mean[`j']
              local s2 = sd[`j']
              ttesti `n1' `m1' `s1'  `n2' `m2' `s2', unequal
              replace compare = "`i' to `j'" in `c'
              replace tstat = r(t) in `c'
              replace se = r(se) in `c'
              replace prob = r(p) in `c'
              local c = `c' + 1
          }
          }
          list  compare tstat se prob

          Comment


          • #6
            Thank you so much. I was going to try a welch test of comparing 4 groups? I just need to know if my sample (n=111) above, differs significantly from the others. Thanks again.

            Comment


            • #7
              A crude but perhaps not crazy approximation here would be that SD is proportional to the mean, which would imply analysis on a logarithmic scale. Unfortunately that is even more elusive without the real data!

              Comment


              • #8
                You want to test whether the sample sizes are different?

                Comment


                • #9
                  I was trying to determine if there is a significant difference between the mean of my sample (group 1 below e.g., 62.5  16.1  111) and the other groups 2, 3 and 4.
                  input group mean sd n 1 62.5  16.1  111
                  2 33.5  7.7   115
                  3 42.3  8.3   2891
                  4 46.2  11.6  245

                  I now don't think this is possible, but thank you.

                  Comment


                  • #10
                    My code tells you if there's a means difference.

                    Comment


                    • #11
                      Wonderful thank you, don't know how I missed this... apologies.

                      Comment


                      • #12
                        Also, see pwmc (SSC or GitHub).

                        It yields the same results as the code in #3, but optionally adjusts for multiple comparisons*
                        Code:
                        . pwmci               ///
                        >     (111 62.5 16.1) ///
                        >     (115 33.5 7.7)  ///
                        >     (2891 42.3 8.3) ///
                        >     (245 46.2 11.6) ///
                        >      , noadjust pvalues
                        
                        Pairwise comparisons of means with unequal variances
                        -----------------------------------------------------
                                     |               Robust        Unadjusted
                                     |       Diff.  Std. Err.      t    P>|t|
                        -------------+---------------------------------------
                             2 vs 1  |        -29   1.688428   -17.18   0.000
                             3 vs 1  |      -20.2   1.535921   -13.15   0.000
                             4 vs 1  |      -16.3   1.698367    -9.60   0.000
                             3 vs 2  |        8.8   .7344347    11.98   0.000
                             4 vs 2  |       12.7   1.031886    12.31   0.000
                             4 vs 3  |        3.9    .757003     5.15   0.000
                        -----------------------------------------------------

                        * Actually, pwmc adjusts for multiple comparisons by default; you can optionally turn those adjustments off.

                        Comment


                        • #13
                          That’s cool.

                          Comment

                          Working...
                          X