Choosing test?
# Analysis of Variance Example (ANOVA)
# MyBookSucks.Com "PartyMoreStudyLess
Group1 <- c(2,3,7,2,6)
Group2 <- c(10,8,7,5,10)
Group3 <- c(10,13,14,13,15)
Combined_Groups <- data.frame(cbind(Group1, Group2, Group3)) # combines the data into a single data set.
Combined_Groups # shows spreadsheet like results
summary(Combined_Groups) # min, median, mean, max
Stacked_Groups <- stack(Combined_Groups)
Stacked_Groups #shows the table Stacked_Groups
Anova_Results <- aov(values ~ ind, data = Stacked_Groups)
summary(Anova_Results) # shows Anova_Results
Group1 | Group2 | Group3 |
---|---|---|
2 | 10 | 10 |
3 | 8 | 13 |
7 | 7 | 14 |
2 | 5 | 13 |
6 | 10 | 15 |
Group1 Group2 Group3 Min. :2 Min. : 5 Min. :10 1st Qu.:2 1st Qu.: 7 1st Qu.:13 Median :3 Median : 8 Median :13 Mean :4 Mean : 8 Mean :13 3rd Qu.:6 3rd Qu.:10 3rd Qu.:14 Max. :7 Max. :10 Max. :15
values | ind |
---|---|
2 | Group1 |
3 | Group1 |
7 | Group1 |
2 | Group1 |
6 | Group1 |
10 | Group2 |
8 | Group2 |
7 | Group2 |
5 | Group2 |
10 | Group2 |
10 | Group3 |
13 | Group3 |
14 | Group3 |
13 | Group3 |
15 | Group3 |
Df Sum Sq Mean Sq F value Pr(>F) ind 2 203.3 101.7 22.59 8.54e-05 *** Residuals 12 54.0 4.5 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# bartlett.test(values~groups, dataset)
# bartlett.test(list(dataset$sample1, dataset$sample2, dataset$sample3))
PlantGrowth
bartlett.test(weight~group, PlantGrowth)
weight | group |
---|---|
4.17 | ctrl |
5.58 | ctrl |
5.18 | ctrl |
6.11 | ctrl |
4.50 | ctrl |
4.61 | ctrl |
5.17 | ctrl |
4.53 | ctrl |
5.33 | ctrl |
5.14 | ctrl |
4.81 | trt1 |
4.17 | trt1 |
4.41 | trt1 |
3.59 | trt1 |
5.87 | trt1 |
3.83 | trt1 |
6.03 | trt1 |
4.89 | trt1 |
4.32 | trt1 |
4.69 | trt1 |
6.31 | trt2 |
5.12 | trt2 |
5.54 | trt2 |
5.50 | trt2 |
5.37 | trt2 |
5.29 | trt2 |
4.92 | trt2 |
6.15 | trt2 |
5.80 | trt2 |
5.26 | trt2 |
Bartlett test of homogeneity of variances data: weight by group Bartlett's K-squared = 2.8786, df = 2, p-value = 0.2371
http://www.socscistatistics.com/tests/what_stats_test_wizard.aspx