Announcement

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

  • Comparison of the data

    Hello room,
    Am struggling to do variation comparison between variables.

    What is the best method to use to do this action?

    The data are as follows.

    I want to compare wk1 upto wk8 in one equation. How do i go about this using STATA?
    Treatments wk1 wk2 wk3 wk4 wk5 wk6 wk7 wk8
    TA 27.1 28.1 28.8 29.88 27.89 28 28.1 27.11
    TA 27.4 27.14 28.4 28.79 27.87 26.9 27.12 26.12
    TA 26.81 28.32 29.4 30.12 28.34 29 28.32 28
    TA 26.78 28.1 28.5 26.39 27.96 27 29 26.81
    TA 26.37 27.68 28.9 27.32 27.87 26.25 27.12 26.11
    TA 26.51 27.2 28.7 28.92 28.92 27.56 30.17 27.89
    TA 27.2 29.1 30.4 30.11 28.54 28.32 28.3 26.81
    TA 27.12 29.24 31.1 29.07 27.81 27.11 26.81 26.11
    TA 26.8 28.9 29.6 31.29 27.41 28.92 29.11 27.84
    TA 27.9 28.3 32.92 29.26 28.8 29 26 27
    TA 27.6 28.1 30.46 28.97 28.7 27.14 25.19 26.54
    TA 27.8 28 33.12 29.74 29.3 29.46 27 27.88
    TA 28.12 27.33 30.32 29.13 26.91 28.17 27 27.81
    TA 28.04 28.1 29.42 28.12 26.25 27 26.34 26.8
    TA 28.4 28.37 30.47 28.66 27.82 28.45 28.45 27.44
    TA 26.39 28.1 29.6 27.11 27.4 28.14 29.1 28.1
    TA 26.88 27.12 29.72 26.98 27.2 26.11 29.12 26.81
    TA 27.94 28.32 29.95 28.49 28.22 28.89 28.71 28.11
    TA 27.33 28.39 29.91 29.16 27.31 29.33 28.12 27.1
    TA 26.81 28.11 29.98 28.94 28.4 27.01 27.81 26.1
    TA 27.98 28.17 30.16 32.49 27.82 28.99 27.43 28.16
    TB 27.3 27 28.97 28.98 26.87 27 27.88 27.9
    TB 27 26.97 29.68 27.87 26.46 26.8 26.88 28.04
    TB 27.1 28.66 28.9 30.46 27.14 29 28.84 27.57
    TB 26.9 28.1 28.72 27.92 27.1 26.82 28.6 26.17
    TB 26.4 27.9 28.6 27.11 26.53 26.4 26.98 26.19
    TB 26.2 28.1 28.7 28.8 29.12 27.44 29.89 27.14
    TB 27 29.4 28.44 30 26.81 26.98 27 26.84
    TB 26.9 29 29.22 28.54 27.09 26.2 26.89 27.18
    TB 27.2 28.91 29.62 31.82 27.61 28.98 29.68 27.44
    TB 27.4 29.2 28.96 32.12 27.8 27.28 26.15 26.84
    TB 27.1 28.65 29.14 29 27.9 27.12 25.81 26.1
    TB 26.9 28.4 28.97 33.47 27.9 29.11 26.39 27.88
    TB 28.7 27.91 28.92 32.11 26.52 27.14 27.01 26.82
    TB 29 28.82 29.71 28.67 26.2 28.18 26.42 27.01
    TB 28.4 28.13 30.2 33.61 27.81 28.48 28.82 27.01
    TB 28.12 27.86 29.87 26.98 27.6 27 28.91 28
    TB 27.39 26.98 30.33 26.76 26.9 26.89 29.14 27
    TB 28.32 28.84 29.94 28.39 27.84 28.38 28.97 28.13
    TB 27 28.81 29.82 28.32 26.51 27.38 28.12 27.5
    TB 26.37 27.87 30.22 27.89 26.41 27.11 27.87 27.9
    TB 27.92 28.9 30.09 33 27.88 29.89 28.18 26.98
    TC 27.4 27.11 28.91 28.76 26.88 27.34 28.31 27.1
    TC 27.1 26.81 28.64 27.37 26.41 26.6 28.88 26.89
    TC 27.1 27.75 29.54 29.39 27.89 28.1 28.78 27.12
    TC 26.8 27.9 28.66 27 27.24 26.3 28 26.88
    TC 26.3 28.1 28.12 26.89 26.98 27.01 27.16 26.04
    TC 26.8 27.2 28.53 27.88 27.04 27.89 30.88 27.18
    TC 27 28.47 29.92 29.12 26.61 27.81 27.6 26.56
    TC 26.8 28.36 30.14 27.14 26.91 26.32 26.81 27.88
    TC 26.12 28.81 29.87 30.26 27.2 29.31 29.6 27.84
    TC 27.6 28 28.91 28.16 27.5 27 26.83 26.88
    TC 27.2 29.3 29.31 28.99 27.1 26.89 26 27
    TC 27.8 29.1 29.24 33.66 28.2 28.16 27.81 27.43
    TC 28.4 27.7 29.8 28.32 26.81 27.17 27.13 26.84
    TC 29.3 28.51 28.76 27.14 26.24 26.87 26.81 26.49
    TC 29.08 29.01 29.8 27.81 27.13 28.46 28.19 27.88
    TC 28.11 28.31 27.69 27.41 26.52 27 28.91 27.11
    TC 26.98 28.58 31.12 26.36 26.21 26.48 29.31 26.88
    TC 27.84 28.78 29.31 28.89 27.2 28.89 29 27.81
    TC 26.91 28.1 28.27 28.14 26.41 28.16 28.4 27.2
    TC 26.81 27.69 28.82 28.82 26.44 27.89 27.65 26.93
    TC 27.91 27.98 29.38 33.46 27.82 29.87 27.8 27.41
    TD 27.5 27.41 30.02 28.27 26.84 26.9 27.91 27.18
    TD 27.1 27.23 30.25 28.11 27.24 27 27.23 26.81
    TD 27.2 27.87 30.21 30.17 27.49 28.36 28.36 27.01
    TD 26.8 28.4 29.03 27.5 26.58 26.37 27.8 26.04
    TD 26.3 28.3 28.81 27.31 29.44 26.01 26.88 26.43
    TD 26.7 28.1 28.73 27.88 29.33 27.93 29.29 27.91
    TD 27 28.14 29.65 28.98 27.41 27 27.5 26.56
    TD 26.9 28.23 28.57 27.17 26.79 26 27.12 27.88
    TD 26.12 28.46 29.64 32.28 27.53 28.92 28.61 27.11
    TD 27.9 29.03 29.91 30.86 28.08 27.11 26.11 26.88
    TD 27.4 29.17 29.94 29.14 28.13 26.55 26.09 27.83
    TD 27.3 29 29.91 33.16 28.1 29.13 27.14 27.88
    TD 29 27.14 28.7 27.88 26.93 27 27.16 26.44
    TD 28.52 28.46 29.6 27.54 26.42 26.81 26.49 26.23
    TD 29.2 29.19 30.6 27.14 27.86 27.89 28.43 27.81
    TD 27.14 27.61 30.33 26.91 26.34 27.02 29.91 28
    TD 26.89 27.23 31.34 27.88 26.11 26.89 29.94 27.81
    TD 27.98 28.36 28.93 28.76 27.81 28.99 29.91 27.8
    TD 26.84 29.29 28.87 30.12 27.31 26.88 28.35 27.17
    TD 26.96 29.24 29.91 28.28 26.82 26.33 27.7 28.07
    TD 27.48 28.48 28.98 33.05 27.81 27.99 28.8 27.76

  • #2
    Agape:
    as you do not provide enough details about what you have in mind, a guess-work is mandatory, hoping that the following code is in line with your expectations:
    Code:
    encode Treatment, g(Treatment_Num)
    . foreach var of varlist wk1 - wk8{
      2. oneway `var' Treatment_Num, bonferroni
      3.  }
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      .107155631      3   .035718544      0.06     0.9794
     Within groups      45.7450513     80   .571813141
    ------------------------------------------------------------------------
        Total           45.8522069     83   .552436227
    
    Bartlett's test for equal variances:  chi2(3) =   1.8904  Prob>chi2 = 0.595
    
                          Comparison of wk1 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |     .06381
             |      1.000
             |
          TC |    .099047    .035238
             |      1.000      1.000
             |
          TD |    .045238   -.018572   -.053809
             |      1.000      1.000      1.000
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      .627126017      3   .209042006      0.47     0.7031
     Within groups      35.4755619     80   .443444524
    ------------------------------------------------------------------------
        Total            36.102688     83   .434972144
    
    Bartlett's test for equal variances:  chi2(3) =   1.0166  Prob>chi2 = 0.797
    
                          Comparison of wk2 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |    .200952
             |      1.000
             |
          TC |    .065714   -.135238
             |      1.000      1.000
             |
          TD |    .197619   -.003333    .131905
             |      1.000      1.000      1.000
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      7.68400498      3   2.56133499      3.37     0.0225
     Within groups      60.8318682     80   .760398353
    ------------------------------------------------------------------------
        Total           68.5158732     83   .825492448
    
    Bartlett's test for equal variances:  chi2(3) =  11.7419  Prob>chi2 = 0.008
    
                          Comparison of wk3 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |       -.61
             |      0.157
             |
          TC |   -.813809   -.203809
             |      0.020      1.000
             |
          TD |    -.37619     .23381    .437619
             |      0.996      1.000      0.647
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      10.7126418      3   3.57088059      1.00     0.3953
     Within groups        284.4049     80   3.55506125
    ------------------------------------------------------------------------
        Total           295.117542     83   3.55563304
    
    Bartlett's test for equal variances:  chi2(3) =   3.8449  Prob>chi2 = 0.279
    
                          Comparison of wk4 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |    .613333
             |      1.000
             |
          TC |   -.379524   -.992857
             |      1.000      0.551
             |
          TD |   -.026191   -.639524    .353333
             |      1.000      1.000      1.000
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      10.2893539      3   3.42978464      6.46     0.0006
     Within groups      42.5009972     80   .531262466
    ------------------------------------------------------------------------
        Total           52.7903512     83   .636028327
    
    Bartlett's test for equal variances:  chi2(3) =   4.3619  Prob>chi2 = 0.225
    
                          Comparison of wk5 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |   -.701905
             |      0.015
             |
          TC |   -.952381   -.250476
             |      0.000      1.000
             |
          TD |   -.493809    .208095    .458571
             |      0.186      1.000      0.269
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      4.45568936      3   1.48522979      1.50     0.2204
     Within groups      79.1048557     80   .988810697
    ------------------------------------------------------------------------
        Total           83.5605451     83   1.00675356
    
    Bartlett's test for equal variances:  chi2(3) =   0.1473  Prob>chi2 = 0.986
    
                          Comparison of wk6 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |   -.341429
             |      1.000
             |
          TC |   -.344286   -.002857
             |      1.000      1.000
             |
          TD |   -.650952   -.309524   -.306667
             |      0.222      1.000      1.000
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      .965279254      3   .321759751      0.23     0.8770
     Within groups      113.130483     80   1.41413104
    ------------------------------------------------------------------------
        Total           114.095763     83   1.37464774
    
    Bartlett's test for equal variances:  chi2(3) =   0.1122  Prob>chi2 = 0.990
    
                          Comparison of wk7 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |    .005238
             |      1.000
             |
          TC |    .263809    .258571
             |      1.000      1.000
             |
          TD |    .114762    .109524   -.149047
             |      1.000      1.000      1.000
    
                            Analysis of Variance
        Source              SS         df      MS            F     Prob > F
    ------------------------------------------------------------------------
    Between groups      .277669921      3    .09255664      0.23     0.8737
     Within groups      31.8960106     80   .398700132
    ------------------------------------------------------------------------
        Total           32.1736805     83   .387634705
    
    Bartlett's test for equal variances:  chi2(3) =   3.6430  Prob>chi2 = 0.303
    
                          Comparison of wk8 by Treatment_~m
                                    (Bonferroni)
    Row Mean-|
    Col Mean |         TA         TB         TC
    ---------+---------------------------------
          TB |    .047143
             |      1.000
             |
          TC |   -.061905   -.109048
             |      1.000      1.000
             |
          TD |    .093333     .04619    .155238
             |      1.000      1.000      1.000
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      WOW! Thank you so much Carlo. I have actually got the solution using Turkey's method though i get a problem of transferring the output into word.

      Like when we use regression analysis inorder to transfer the output we use outreg2...so what way are we supposed to use in this aspect of turkey method

      my results are;



      Tukey Tukey
      age Contrast Std. Err. t P>t [95% Conf. Interval]

      I_1
      Agree vs Strongly Agree -.0014245 .1282362 -0.01 1.000 -.3061334 .3032844
      Neutral vs Strongly Agree .2645688 .1203182 2.20 0.076 -.0213259 .5504634
      Neutral vs Agree .2659933 .140287 1.90 0.145 -.0673502 .5993368


      Comment


      • #4
        Agape:
        sorry but I cannot help on this.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          It is well thank you so much Sir. Appreciate your help much. Be blessed.

          Comment

          Working...
          X