Announcement

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

  • Root Mean Squared Error in xtreg

    Dear all,

    I want to compare Mean-Group estimators with pooled estimators obtained by xtreg. However, the mean group estimator give me the Rood Mean Squared Error while xtreg provides measures for R squared (overall, between, within). How can I get the RMSE for the FE estimator by xtreg?

    Best,

    Korbinian

  • #2
    -xtreg- returns the root mean squared error in e(rmse).

    Code:
    xtreg whatever
    local RMSE = e(rmse)

    Comment


    • #3
      When I do this local RMSE = e(rmse) after the xtreg, it does not return anything. it just executes the command and I see nothing. How do I see the value?

      Comment


      • #4
        Originally posted by Joe Korkey View Post
        When I do this local RMSE = e(rmse) after the xtreg, it does not return anything. it just executes the command and I see nothing. How do I see the value?
        That only assigns the value; in order to see it you'd have to follow that with something like the following.
        Code:
        display `RMSE'
        I illustrate it below (at the "Here" comment).

        .ÿ
        .ÿversionÿ17.0

        .ÿ
        .ÿclearÿ*

        .ÿ
        .ÿ//ÿseedem
        .ÿsetÿseedÿ1708559278

        .ÿ
        .ÿquietlyÿsysuseÿauto

        .ÿ
        .ÿsummarizeÿrep78,ÿmeanonly

        .ÿquietlyÿreplaceÿrep78ÿ=ÿruniformint(r(min),ÿr(max))ÿifÿmi(rep78)

        .ÿ
        .ÿxtregÿpriceÿi.foreignÿc.mpg,ÿi(rep78)ÿfe

        Fixed-effectsÿ(within)ÿregressionÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿÿÿÿ74
        Groupÿvariable:ÿrep78ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿgroupsÿÿ=ÿÿÿÿÿÿÿÿÿÿ5

        R-squared:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿObsÿperÿgroup:
        ÿÿÿÿÿWithinÿÿ=ÿ0.2909ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿminÿ=ÿÿÿÿÿÿÿÿÿÿ3
        ÿÿÿÿÿBetweenÿ=ÿ0.2855ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavgÿ=ÿÿÿÿÿÿÿ14.8
        ÿÿÿÿÿOverallÿ=ÿ0.2816ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿmaxÿ=ÿÿÿÿÿÿÿÿÿ30

        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿF(2,67)ÿÿÿÿÿÿÿÿÿÿÿ=ÿÿÿÿÿÿ13.75
        corr(u_i,ÿXb)ÿ=ÿ-0.2240ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿProbÿ>ÿFÿÿÿÿÿÿÿÿÿÿ=ÿÿÿÿÿ0.0000

        ------------------------------------------------------------------------------
        ÿÿÿÿÿÿÿpriceÿ|ÿCoefficientÿÿStd.ÿerr.ÿÿÿÿÿÿtÿÿÿÿP>|t|ÿÿÿÿÿ[95%ÿconf.ÿinterval]
        -------------+----------------------------------------------------------------
        ÿÿÿÿÿforeignÿ|
        ÿÿÿÿForeignÿÿ|ÿÿÿ1572.385ÿÿÿ785.2305ÿÿÿÿÿ2.00ÿÿÿ0.049ÿÿÿÿÿ5.057904ÿÿÿÿ3139.711
        ÿÿÿÿÿÿÿÿÿmpgÿ|ÿÿ-315.8967ÿÿÿ61.23027ÿÿÿÿ-5.16ÿÿÿ0.000ÿÿÿÿ-438.1128ÿÿÿ-193.6806
        ÿÿÿÿÿÿÿ_consÿ|ÿÿÿ12425.54ÿÿÿ1309.532ÿÿÿÿÿ9.49ÿÿÿ0.000ÿÿÿÿÿ9811.701ÿÿÿÿ15039.37
        -------------+----------------------------------------------------------------
        ÿÿÿÿÿsigma_uÿ|ÿÿ825.04818
        ÿÿÿÿÿsigma_eÿ|ÿÿ2556.6422
        ÿÿÿÿÿÿÿÿÿrhoÿ|ÿÿ.09431798ÿÿÿ(fractionÿofÿvarianceÿdueÿtoÿu_i)
        ------------------------------------------------------------------------------
        Fÿtestÿthatÿallÿu_i=0:ÿF(4,ÿ67)ÿ=ÿ0.64ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿProbÿ>ÿFÿ=ÿ0.6323

        .ÿlocalÿRMSEÿ=ÿe(rmse)

        .ÿ
        .ÿ//ÿHere
        .ÿdisplayÿinÿsmclÿasÿtextÿ`RMSE'
        2556.6422

        .ÿ
        .ÿexit

        endÿofÿdo-file


        .

        Comment


        • #5
          Korbinian:
          another approach might be:
          Code:
          se "https://www.stata-press.com/data/r17/nlswork.dta"
          . xtreg ln_wage age, fe
          
          Fixed-effects (within) regression               Number of obs     =     28,510
          Group variable: idcode                          Number of groups  =      4,710
          
          R-squared:                                      Obs per group:
               Within  = 0.1026                                         min =          1
               Between = 0.0877                                         avg =        6.1
               Overall = 0.0774                                         max =         15
          
                                                          F(1,23799)        =    2720.20
          corr(u_i, Xb) = 0.0314                          Prob > F          =     0.0000
          
          ------------------------------------------------------------------------------
               ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                   age |   .0181349   .0003477    52.16   0.000     .0174534    .0188164
                 _cons |   1.148214   .0102579   111.93   0.000     1.128107     1.16832
          -------------+----------------------------------------------------------------
               sigma_u |  .40635023
               sigma_e |  .30349389
                   rho |  .64192015   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          F test that all u_i=0: F(4709, 23799) = 8.81                 Prob > F = 0.0000
          
          . di e(rmse)
          .30349389
          
          .
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment

          Working...
          X