Is Tukey the best way to test for differences in slopes after a mixed-effect ANCOVA?R, LME and Tukey Test produces error after sortingnegative coefficient of predictor in mixed-effects model produces positive slope in ggplot2Specify within-subjects and between-subjects ANOVA model using lme or lmer, as fixed-effectsGenerating similar estimates of interactions in afex, lsmeans, and lme4 packagesmodelling interaction terms in random effects and coding of daytime in growth models lme4Getting wrong p-values for Tukey test for one-way mixed effect ANOVATukey test only plot significant mean differencespost-hoc in r with more than one factorsTuckey correction for planned contrasts with emmeans and pairs() in RTukey test after LMM keeping contrasts

Informal question construction: "Anyone know what...", "Everyone finished?"

Is being an extrovert a necessary condition to be a manager?

One word for 'the thing that attracts me'?

How to tease a romance without a cat and mouse chase?

Is there a word for pant sleeves?

Why is a weak base more able to deprotonate a strong acid than a weak acid?

why "American-born", not "America-born"?

Is it normal to "extract a paper" from a master thesis?

Can diplomats be allowed on the flight deck of a commercial European airline?

Find this Unique UVC Palindrome ( ignoring signs and decimal) from Given Fractional Relationship

How can I reduce the size of matrix?

Computing elements of a 1000x60 matrix exhausts RAM

Way of refund if scammed?

What to call a small, open stone or cement reservoir that supplies fresh water from a spring or other natural source?

Which values for voltage divider

Why did Nick Fury not hesitate in blowing up the plane he thought was carrying a nuke?

Meaning of "half-crown enclosure"

Can a UK national work as a paid shop assistant in the USA?

Why the work done is positive when bringing 2 opposite charges together?

How do I write real-world stories separate from my country of origin?

Is a world with one country feeding everyone possible?

Island Perimeter

(For training purposes) Are there any openings with rook pawns that are more effective than others (and if so, what are they)?

What is the winged creature on the back of the Mordenkainen's Tome of Foes book?



Is Tukey the best way to test for differences in slopes after a mixed-effect ANCOVA?


R, LME and Tukey Test produces error after sortingnegative coefficient of predictor in mixed-effects model produces positive slope in ggplot2Specify within-subjects and between-subjects ANOVA model using lme or lmer, as fixed-effectsGenerating similar estimates of interactions in afex, lsmeans, and lme4 packagesmodelling interaction terms in random effects and coding of daytime in growth models lme4Getting wrong p-values for Tukey test for one-way mixed effect ANOVATukey test only plot significant mean differencespost-hoc in r with more than one factorsTuckey correction for planned contrasts with emmeans and pairs() in RTukey test after LMM keeping contrasts






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a fairly simple fitted model that looks like:



fm <- lmer(Height~Site*HW+(1|Plot))


where Height and HW are continuous variables and Site and Plot are categorical. Site has 3 levels (A, B, C) I ran a Type II Wald Chi square and it showed that the interaction term was significant, which I am interpreting as that sites differed in their Height vs HW slopes:



> Anova(fm)
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: Height
Chisq Df Pr(>Chisq)
Site 26.147 2 2.1e-06 ***
HW 91.089 1 < 2e-16 ***
Site:HW 13.775 2 0.00102 **


I'm interested in running a post-hoc to see which sites did and did not significantly differ in slope. I tried the following, but it doesn't look like a good match of what's going on visually when I plot the data. Is this the correct code?



leastsquare = lsmeans(fm,pairwise ~ Site:HW,adjust = "tukey")
leastsquare$contrasts

contrast estimate SE df t.ratio p.value
A - B 0.00206 0.0113 4.87 0.182 0.9819
A - C -0.04496 0.0101 4.88 -4.438 0.0163
B - C -0.04703 0.0113 4.87 -4.154 0.0212


So that's my first question: Is the above the correct way to test for slope differences among 3 levels of my categorical variable?



I am also interested in knowing how the means of the three site levels differ from one another (in addition to the slope question above). Can I just run a post-hoc tukey on Site? Is gives me warnings if I do this. Is there a better way to ask about main effects while taking into account the interaction?



Thank you in advance!










share|improve this question






























    0















    I have a fairly simple fitted model that looks like:



    fm <- lmer(Height~Site*HW+(1|Plot))


    where Height and HW are continuous variables and Site and Plot are categorical. Site has 3 levels (A, B, C) I ran a Type II Wald Chi square and it showed that the interaction term was significant, which I am interpreting as that sites differed in their Height vs HW slopes:



    > Anova(fm)
    Analysis of Deviance Table (Type II Wald chisquare tests)

    Response: Height
    Chisq Df Pr(>Chisq)
    Site 26.147 2 2.1e-06 ***
    HW 91.089 1 < 2e-16 ***
    Site:HW 13.775 2 0.00102 **


    I'm interested in running a post-hoc to see which sites did and did not significantly differ in slope. I tried the following, but it doesn't look like a good match of what's going on visually when I plot the data. Is this the correct code?



    leastsquare = lsmeans(fm,pairwise ~ Site:HW,adjust = "tukey")
    leastsquare$contrasts

    contrast estimate SE df t.ratio p.value
    A - B 0.00206 0.0113 4.87 0.182 0.9819
    A - C -0.04496 0.0101 4.88 -4.438 0.0163
    B - C -0.04703 0.0113 4.87 -4.154 0.0212


    So that's my first question: Is the above the correct way to test for slope differences among 3 levels of my categorical variable?



    I am also interested in knowing how the means of the three site levels differ from one another (in addition to the slope question above). Can I just run a post-hoc tukey on Site? Is gives me warnings if I do this. Is there a better way to ask about main effects while taking into account the interaction?



    Thank you in advance!










    share|improve this question


























      0












      0








      0








      I have a fairly simple fitted model that looks like:



      fm <- lmer(Height~Site*HW+(1|Plot))


      where Height and HW are continuous variables and Site and Plot are categorical. Site has 3 levels (A, B, C) I ran a Type II Wald Chi square and it showed that the interaction term was significant, which I am interpreting as that sites differed in their Height vs HW slopes:



      > Anova(fm)
      Analysis of Deviance Table (Type II Wald chisquare tests)

      Response: Height
      Chisq Df Pr(>Chisq)
      Site 26.147 2 2.1e-06 ***
      HW 91.089 1 < 2e-16 ***
      Site:HW 13.775 2 0.00102 **


      I'm interested in running a post-hoc to see which sites did and did not significantly differ in slope. I tried the following, but it doesn't look like a good match of what's going on visually when I plot the data. Is this the correct code?



      leastsquare = lsmeans(fm,pairwise ~ Site:HW,adjust = "tukey")
      leastsquare$contrasts

      contrast estimate SE df t.ratio p.value
      A - B 0.00206 0.0113 4.87 0.182 0.9819
      A - C -0.04496 0.0101 4.88 -4.438 0.0163
      B - C -0.04703 0.0113 4.87 -4.154 0.0212


      So that's my first question: Is the above the correct way to test for slope differences among 3 levels of my categorical variable?



      I am also interested in knowing how the means of the three site levels differ from one another (in addition to the slope question above). Can I just run a post-hoc tukey on Site? Is gives me warnings if I do this. Is there a better way to ask about main effects while taking into account the interaction?



      Thank you in advance!










      share|improve this question
















      I have a fairly simple fitted model that looks like:



      fm <- lmer(Height~Site*HW+(1|Plot))


      where Height and HW are continuous variables and Site and Plot are categorical. Site has 3 levels (A, B, C) I ran a Type II Wald Chi square and it showed that the interaction term was significant, which I am interpreting as that sites differed in their Height vs HW slopes:



      > Anova(fm)
      Analysis of Deviance Table (Type II Wald chisquare tests)

      Response: Height
      Chisq Df Pr(>Chisq)
      Site 26.147 2 2.1e-06 ***
      HW 91.089 1 < 2e-16 ***
      Site:HW 13.775 2 0.00102 **


      I'm interested in running a post-hoc to see which sites did and did not significantly differ in slope. I tried the following, but it doesn't look like a good match of what's going on visually when I plot the data. Is this the correct code?



      leastsquare = lsmeans(fm,pairwise ~ Site:HW,adjust = "tukey")
      leastsquare$contrasts

      contrast estimate SE df t.ratio p.value
      A - B 0.00206 0.0113 4.87 0.182 0.9819
      A - C -0.04496 0.0101 4.88 -4.438 0.0163
      B - C -0.04703 0.0113 4.87 -4.154 0.0212


      So that's my first question: Is the above the correct way to test for slope differences among 3 levels of my categorical variable?



      I am also interested in knowing how the means of the three site levels differ from one another (in addition to the slope question above). Can I just run a post-hoc tukey on Site? Is gives me warnings if I do this. Is there a better way to ask about main effects while taking into account the interaction?



      Thank you in advance!







      r






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 20:41







      doingmybest

















      asked Mar 23 at 20:29









      doingmybestdoingmybest

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0














          That’s because the code shown compares means, not slopes. Look at the emtrends (or lstrends) function. Both are documented in the emmeans package.



          emt = emtrends(fm, “Site”, var = HW)
          emt # estimated slopes
          pairs(emt) # pairwise comparisons





          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318075%2fis-tukey-the-best-way-to-test-for-differences-in-slopes-after-a-mixed-effect-anc%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            That’s because the code shown compares means, not slopes. Look at the emtrends (or lstrends) function. Both are documented in the emmeans package.



            emt = emtrends(fm, “Site”, var = HW)
            emt # estimated slopes
            pairs(emt) # pairwise comparisons





            share|improve this answer





























              0














              That’s because the code shown compares means, not slopes. Look at the emtrends (or lstrends) function. Both are documented in the emmeans package.



              emt = emtrends(fm, “Site”, var = HW)
              emt # estimated slopes
              pairs(emt) # pairwise comparisons





              share|improve this answer



























                0












                0








                0







                That’s because the code shown compares means, not slopes. Look at the emtrends (or lstrends) function. Both are documented in the emmeans package.



                emt = emtrends(fm, “Site”, var = HW)
                emt # estimated slopes
                pairs(emt) # pairwise comparisons





                share|improve this answer















                That’s because the code shown compares means, not slopes. Look at the emtrends (or lstrends) function. Both are documented in the emmeans package.



                emt = emtrends(fm, “Site”, var = HW)
                emt # estimated slopes
                pairs(emt) # pairwise comparisons






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 25 at 20:38

























                answered Mar 24 at 17:32









                rvlrvl

                2,1322613




                2,1322613





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318075%2fis-tukey-the-best-way-to-test-for-differences-in-slopes-after-a-mixed-effect-anc%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해