Announcement

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

  • Problem to replicate anova with mvreg







    Dear Stata listers
    I'm a little confused. I want to calculate a manova with imputed data (mi estimate mvreg and mi test).

    On this road I encountered the following problem.

    I want to replicate the anova results with the mvreg-command.

    Code:
    sysuse auto, clear
    anova    price      rep78##foreign
    mvreg price = rep78##foreign
     
    test [price]1.foreign
    test [price]2.rep78 [price]3.rep78 [price]4.rep78 [price]5.rep78
    test [price]1.foreign#2.rep78 [price]1.foreign#3.rep78  [price]1.foreign#4.rep78  [price]1.foreign#5.rep78
    The f-values of the interaction term are equal in anova and test after mvreg. But the f-values of foreign and rep78 are different?
    Did I misunderstand something here or where's my fault?

    Thanks,
    Jörg









  • #2
    The contrasts with ANOVA are different from what you are expecting and show up in tests of main effects in factorial ANOVA with an interaction term in the presence of unbalanced data. You can see the contrast actually tested in anova with test foreign, symbolic and test rep78, symbolic afterward. The situation is explained in the Stata user's manual entry for anova, beginning with the Technical Note on Page 24.

    Comment


    • #3
      Dear Joseph,
      thanks a lot but I am still struggling with the thema. I read the text but I didn't found the solution to my problem. Without mi-data I can replicate the anova f-value with manova. But manova dosen`t work with mi-data, only with mvreg. How should the test-synatx (or mi test syntax) after mvreg (mi estimate mvreg) look like to replicat the f-value from anova or manova?
      Thanks, Jörg

      Comment


      • #4
        You hadn't mentioned mi before. I have never used it, don't have plans to and and don't know anything about it, sorry.

        Comment


        • #5
          Joerg:
          have you considered the
          -cmdok- option available for -mi estimate-?
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            I'm sorry Joseph. I thought if I could find a solution to the non-mi problem, I could find a solution to my mi problem.

            @Carlo:
            Yes, I've been thinking about it. But the output from the command: mi estimate, cmdok: manova are the same as from mi estimate: mvreg

            Code:
             use http://www.stata-press.com/data/r13/mheart1s20, clear
             preserve
             mi extract 5
             manova bmi = female##hsgrad
             mvreg
             restore
              mi estimate, cmdok: manova bmi = female##hsgrad
             mi estimate: mvreg bmi = female##hsgrad
            Maybe even clearer, I would like to compare the effect (F-value / Eta) of two categorial variables and their interaction using mi-data and a manova.
            Any ideas?
            Jörg

            Comment


            • #7
              Joerg:
              no other ideas.
              Sorry for that.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Dear Statalisters,

                i think, i have found a solution. The following code replicate a anova with mvreg in a single dataset:
                Code:
                use http://www.stata-press.com/data/r13/mheart1s20, clear
                preserve
                mi extract 5
                replace hsgrad=2 if smokes==1  
                
                anova bmi female##hsgrad
                estat esize
                
                mvreg  bmi= female##hsgrad
                margins , predict(equation(bmi)) dydx(female ) asbalanced post
                test 1.female 
                esizei `=r(df)' `=r(df_r)' `=r(F)'
                
                mvreg  bmi= female##hsgrad
                margins , predict(equation(bmi)) dydx(hsgrad ) asbalanced post
                test 1.hsgrad 2.hsgrad
                esizei `=r(df)' `=r(df_r)' `=r(F)'
                
                mvreg  bmi= female##hsgrad
                test [bmi]1.female#1.hsgrad [bmi]1.female#2.hsgrad  
                esizei `=r(df)' `=r(df_r)' `=r(F)'

                For mi-data the syntax is:


                Code:
                mi estimate : mvreg  bmi= female##hsgrad
                mimrgns , predict(equation(bmi)) dydx(hsgrad ) asbalanced post
                mi test [bmi]1.hsgrad [bmi]2.hsgrad
                Thank you so much for your help.
                Jörg

                Comment

                Working...
                X