Announcement

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

  • e() results

    I'm running the loneway command and looking at the e() results. Some things surprise me:
    (1) I run loneway once and look at the e() results. Then I run loneway again on a different subset of data. The e() results haven't changed; they are the results from my first loneway run, not my second run.
    (2) Concerned, I run "eresults clear" and then run loneway again. Now the e() results are empty, which surprises me because I expected them to reflect my last loneway run.

    What's going on? Is this normal behavior? I haven't used e() results before, so I don't know if I'm seeing a bug or just not understanding how e() results are supposed to work.

    Many thanks.

    Best,
    Paul

  • #2
    Loneway doesn't ereturn anything. See -help loneway-. You probably saw the e() results left over from some earlier estimation command.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      No, the e() results that I saw were from loneway. They matched what I saw in the Results window.

      Comment


      • #4
        Oh, no, wait, you're right. The e() results that I saw were leftover from an earlier anova command.
        Mystery solved -- thanks.

        Comment


        • #5
          You sure they weren't r() results? The first two lines of loneway are

          Code:
          *! version 3.1.6  15may2009
          program define loneway, rclass byable(recall) sort
          It is an R class command, not E class. And the help for it says

          Code:
          Stored results
          
              loneway stores the following in r():
          
              Scalars   
                r(N)           number of observations
                r(rho)         intraclass correlation
                r(lb)          lower bound of 95% CI for rho
                r(ub)          upper bound of 95% CI for rho
                r(rho_t)       estimated reliability
                r(se)          asymp. SE of intraclass correlation
                r(sd_w)        estimated SD within group
                r(sd_b)        estimated SD of group effect
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            A followup question, as long as we're here...
            loneway reports the reliability of an average, "evaluated at n=5.38" for example. How is that value, 5.38, calculated?
            I have to recreate it because it's not in the r() results!

            Comment


            • #7
              On p. 1099. there is a formula for something called g, and on p. 1101 it says loneway uses t = g. I suspect that is it but I haven't calculated it. If that isn't it, then the answer may be buried elsewhere in the formula and methods section.
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://www3.nd.edu/~rwilliam

              Comment


              • #8
                Ok, I think I was right. See the pages I gave before or this won't make any sense:

                Code:
                . webuse nhanes2f, clear
                
                . loneway height race
                
                              One-way Analysis of Variance for height: height (cm)
                
                                                              Number of obs =     10337
                                                                  R-squared =    0.0071
                
                    Source                SS         df      MS            F     Prob > F
                -------------------------------------------------------------------------
                Between race           6883.2221      2     3441.611     37.14     0.0000
                Within race            957629.15  10334     92.66781
                -------------------------------------------------------------------------
                Total                  964512.37  10336    93.315826
                
                         Intraclass       Asy.        
                         correlation      S.E.       [95% Conf. Interval]
                         ------------------------------------------------
                            0.03054     0.03772       0.00000     0.10448
                
                         Estimated SD of race effect             1.708707
                         Estimated SD within race                9.626412
                         Est. reliability of a race mean          0.97307
                              (evaluated at n=1147.02)
                
                . tab1 race
                
                -> tabulation of race  
                
                   1=white, |
                   2=black, |
                    3=other |      Freq.     Percent        Cum.
                ------------+-----------------------------------
                      White |      9,051       87.56       87.56
                      Black |      1,086       10.51       98.07
                      Other |        200        1.93      100.00
                ------------+-----------------------------------
                      Total |     10,337      100.00
                
                . di (10337 - (9051^2 + 1086^2 + 200^2)/10337)/2
                1147.0239
                
                .
                The display command at the end gives the formula for "evaluated at n="
                Last edited by Richard Williams; 21 Jul 2014, 17:30.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Here is some all purpose code (assuming no weighting). If you had some mad desire to constantly double-check Stata, you could probably make this more generalizable.

                  Code:
                  capture program drop cloneway
                  program cloneway
                      args y x
                      loneway `y' `x'
                      quietly tab1 `x' if !missing(`y'), matcell(freq)
                      mat cloneway = (r(N)  - ( freq' * freq)/r(N))/(r(r) - 1)
                      mat list cloneway
                  end
                  
                  * Examples
                  webuse auto7, clear
                  cloneway mpg manufacturer_grp
                  
                  webuse nhanes2f, clear
                  cloneway height health
                  Here is the output:

                  Code:
                  . capture program drop cloneway
                  
                  . program cloneway
                    1.         args y x
                    2.         loneway `y' `x'
                    3.         quietly tab1 `x' if !missing(`y'), matcell(freq)
                    4.         mat cloneway = (r(N)  - ( freq' * freq)/r(N))/(r(r) - 1)
                    5.         mat list cloneway
                    6. end
                  
                  .
                  . * Examples
                  . webuse auto7, clear
                  (1978 Automobile Data)
                  
                  . cloneway mpg manufacturer_grp
                  
                                One-way Analysis of Variance for mpg: Mileage (mpg)
                  
                                                                Number of obs =        74
                                                                    R-squared =    0.5507
                  
                      Source                SS         df      MS            F     Prob > F
                  -------------------------------------------------------------------------
                  Between manufactur~p    1345.588     22    61.163092      2.84     0.0011
                  Within manufactur~p    1097.8714     51    21.526891
                  -------------------------------------------------------------------------
                  Total                  2443.4595     73    33.472047
                  
                           Intraclass       Asy.        
                           correlation      S.E.       [95% Conf. Interval]
                           ------------------------------------------------
                              0.36827     0.13679       0.10017     0.63636
                  
                           Estimated SD of manufactur~p effect     3.542478
                           Estimated SD within manufactur~p        4.639708
                           Est. reliability of a manufactur~p mean  0.64804
                                (evaluated at n=3.16)
                  
                  symmetric cloneway[1,1]
                             c1
                  r1  3.1584767
                  
                  .
                  . webuse nhanes2f, clear
                  
                  . cloneway height health
                  
                                One-way Analysis of Variance for height: height (cm)
                  
                                                                Number of obs =     10335
                                                                    R-squared =    0.0245
                  
                      Source                SS         df      MS            F     Prob > F
                  -------------------------------------------------------------------------
                  Between health         23584.908      4     5896.227     64.75     0.0000
                  Within health          940695.15  10330     91.06439
                  -------------------------------------------------------------------------
                  Total                  964280.06  10334    93.311405
                  
                           Intraclass       Asy.        
                           correlation      S.E.       [95% Conf. Interval]
                           ------------------------------------------------
                              0.03101     0.02301       0.00000     0.07611
                  
                           Estimated SD of health effect           1.707074
                           Estimated SD within health              9.542766
                           Est. reliability of a health mean        0.98456
                                (evaluated at n=1992.09)
                  
                  symmetric cloneway[1,1]
                             c1
                  r1  1992.0926
                  Last edited by Richard Williams; 21 Jul 2014, 19:56.
                  -------------------------------------------
                  Richard Williams, Notre Dame Dept of Sociology
                  StataNow Version: 19.5 MP (2 processor)

                  EMAIL: [email protected]
                  WWW: https://www3.nd.edu/~rwilliam

                  Comment

                  Working...
                  X