Created
January 6, 2020 10:58
-
-
Save lucidfrontier45/45ba3a3c9359118c5380fd1445bb8572 to your computer and use it in GitHub Desktop.
Testing Dunnett's test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(reshape2) | |
| library(multcomp) | |
| n <- 10 | |
| ctrl <- rnorm(n, 0, 0.5) | |
| a <- rnorm(n, 0.1, 0.5) | |
| b <- rnorm(n, 2, 0.5) | |
| df <- melt(data.frame(ctrl = ctrl, a = a, b=b)) | |
| names(df) <- c("cat", "val") | |
| df$cat <- factor(df$cat, levels=c("ctrl", "a", "b"), ordered=TRUE) | |
| res.aov <- aov(val~cat, data=df) | |
| res.glht <- glht(res.aov, linfct=mcp(cat="Dunnett")) | |
| summary(res.glht) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment