Last active
October 12, 2017 01:51
-
-
Save mbk0asis/0b47779466531cc03fe3ac1c57f669c4 to your computer and use it in GitHub Desktop.
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
| # data loading | |
| dta <- read.csv("file:///C:/Users/bk/Desktop/test2.csv",header = T) | |
| dta | |
| # boxplot data | |
| library(ggplot2) | |
| ggplot(dta, aes(x=group,y=count)) + | |
| geom_boxplot() | |
| # linear regression model for data | |
| dta.mod1 <- lm(count ~ group,data = dta) | |
| # One-way ANOVA test | |
| res.aov <- aov(count ~ group, dta) | |
| summary(res.aov) | |
| # post-hoc test | |
| TukeyHSD(res.aov) | |
| ## TEST Assumptions | |
| # Homogeneity of variance (when p > 0.05, cannot reject null hypothesis: all variances are equal) | |
| bartlett.test(count ~ group,data = dta) | |
| # Normality test (when p > 0.05, cannot reject null hypothesis: data is normally distributed) | |
| aov_residuals <- residuals(object = res.aov) # extract residuals | |
| shapiro.test(x = aov_residuals) # run Shapiro-Wilk test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment