Go to content ALT+c

Intro to Computational BioStatistics with R  (Fall 2020) (Old site; new site is at https://scinet.courses)

Friday May 31, 2024 - 01:30
Reply
  • Post-hoc analysis

      Wed Nov 25 00:15

    Hi Erik and Marcelo,

    I was just wondering if the post-hoc test (for example TukeyHSD) should be in the Driver script (that calls a separate TukeyHSD function) or within the anova function?

    In addition, should we always be loading libraries in the Driver script?

    Thanks!

 

  • Re: Post-hoc analysis

      Wed Nov 25 01:18

    I'd suggest either on the fn carrying out the anova or in its own fn (for the sake of modularity).
    WRT loading libraries I'd recommend doing it in your utilities file, or more specifically, where the actual library is being used, ie. within the corresponding fn using it.

  • Re: Post-hoc analysis

      Wed Nov 25 22:29

    For TukeyHSD, I kept getting the error: Error in TukeyHSD.aov(results.aov, conf.level = 0.95) :
    no factors in the fitted model
    Calls: anova.test.p -> tukey.test -> TukeyHSD -> TukeyHSD.aov
    In addition: Warning message:
    In replications(paste("~", xx), data = mf) : non-factors ignored: id.name
    Execution halted

    When I looked online, it suggested to add my_data <- aov(y~as.factor(x), data=my.data)

    When I did this it worked, is this an okay approach? Why did it not work in the first place and it worked right now?

    The example from class did not have any problem while doing it.

    Thank you!

  • Re: Post-hoc analysis

      Thu Nov 26 00:53

    That's the right way of doing it , yes... the reason is that the anova requires to have factors so that it can build/identify categorical variables, i.e. categories.
    In the example in class, the drug was given by a string (or a character) which can be easily casted into factors (by the aov fn) but when you are using numbers is not always clear that this can be done so you need to be explicit about it.

Page: 1
  • You must be logged in to post.


Content Navigation


Course Calendar


Forum Posts


Related



Questions? Contact Support.
Web site engine's code is copyright © ATutor®.
Modifications and code of added modules are copyright of SciNet.