Announcement

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

  • bootstrap oneway - ANOVA multiple comparisons

    Hi,

    I am trying to use bootstrapping for my ANOVA, however I cannot figure out how to do multiple comparsions with bootstrapping as it comes up with an error:
    Code:
    sysuse cancer 
    bootstrap, reps(2000) seed(2): oneway _t drug, bonferroni
    Is there a way to overcome this?

    Thank you very much,
    Wendy

  • #2
    You need to tell bootstrap what it is that you're bootstrapping, that is, it needs an expression list:
    Code:
    bootstrap exp_list [, options eform_option] : command

    Comment


    • #3
      Hello,

      I want to bootstrap my mean since data is non-normal distributed, to run a Sidak multiple-comparison test.
      I have tried the following code, but get
      'r(mean)' evaluated to missing in full sample
      r(322);


      Code example:
      use https://www.stata-press.com/data/r18/apple
      set seed 1234
      bootstrap weight_2=r(mean), reps(1000): oneway treatment weight , sidak




      Thank you for your help

      /Anne
      Last edited by Anne Ahrens; 08 Dec 2023, 02:13.

      Comment


      • #4
        Anne:
        as -oneway- does not return -r(mean)-, Stata is obviously right in throwing -r(322)-:
        Code:
        . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
        (1978 automobile data)
        
        . oneway price rep78, sidak
        
                                Analysis of variance
            Source              SS         df      MS            F     Prob > F
        ------------------------------------------------------------------------
        Between groups      8360542.63      4   2090135.66      0.24     0.9174
         Within groups       568436416     64      8881819
        ------------------------------------------------------------------------
            Total            576796959     68   8482308.22
        
        Bartlett's equal-variances test: chi2(4) =  11.4252    Prob>chi2 = 0.022
        
                          Comparison of Price by Repair record 1978
                                           (Sidak)
        Row Mean-|
        Col Mean |          1          2          3          4
        ---------+--------------------------------------------
               2 |    1,403.1
                 |      1.000
                 |
               3 |    1,864.7    461.608
                 |      0.993      1.000
                 |
               4 |      1,507    103.875   -357.733
                 |      0.999      1.000      1.000
                 |
               5 |    1,348.5    -54.625   -516.233     -158.5
                 |      1.000      1.000      1.000      1.000
        
        . return list
        
        scalars:
                          r(N) =  69
                        r(mss) =  8360542.627898574
                       r(df_m) =  4
                        r(rss) =  568436416.2416667
                       r(df_r) =  64
                          r(F) =  .235327431924253
                   r(chi2bart) =  11.42516013277495
                    r(df_bart) =  4
        
        .

        That said, the normality of the mean should not be an issue.
        I addition, I would go -regress- that can handle heteroskedastcity and other relevant stuff that are not considered by -oneway-.
        Last edited by Carlo Lazzaro; 08 Dec 2023, 02:52.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hi Carlo

          Thank you for explaining why r(mean) did not work with oneway.

          Do you have another suggestion for how I can obtain multiple-comparison test for non-parametrical data?

          /Anne

          Comment


          • #6
            Well, I have absolutely no idea whether this is statistically sound, but you could bootstrap adjusted p-values (if this has any benefit for your research...).


            Code:
            clear all
            use https://www.stata-press.com/data/r18/apple
            expand 2         //Make sample bigger for bootstrap approach to run properly
            
            
            cap program drop comparer
            program define comparer, rclass
                reg weight i.treatment
                margins treatment, pwcompare(pveffects) mcompare(sidak)
                return scalar comp2_1 = r(table_vs)[4,1]
                return scalar comp3_1 = r(table_vs)[4,2]
                return scalar comp4_1 = r(table_vs)[4,3]
                return scalar comp3_2 = r(table_vs)[4,4]
                return scalar comp4_2 = r(table_vs)[4,5]
                return scalar comp4_3 = r(table_vs)[4,6]
            end
            
            comparer
            return list
            
            
            
            bootstrap r(comp2_1) r(comp3_1) r(comp4_1) ///
                r(comp3_2) r(comp4_2) r(comp4_3), reps(500): comparer
            estat bootstrap, bc

            Best wishes

            Stata 18.0 MP | ORCID | Google Scholar

            Comment

            Working...
            X