#1 thermo<-read.delim("clipboard") summary(thermo) t.test(temp~manufacturer, data=thermo) # Welch Two Sample t-test # # data: temp by manufacturer # t = 0.11962, df = 11.888, p-value = 0.9068 # alternative hypothesis: true difference in means between group celsimet and group termom is not equal to 0 # 95 percent confidence interval: # -1.72338 1.92338 # sample estimates: # mean in group celsimet mean in group termom # 18.0 17.9 var.test(temp~manufacturer, data=thermo) # F test to compare two variances # # data: temp by manufacturer # F = 6.0674, num df = 9, denom df = 9, p-value = 0.01302 # alternative hypothesis: true ratio of variances is not equal to 1 # 95 percent confidence interval: # 1.50706 24.42738 # sample estimates: # ratio of variances # 6.067416 #Computing variances of the two groups tapply(thermo$temp, thermo$manufacturer, var) # celsimet termom # 6.0000000 0.9888889 library(ggplot2) ggplot(thermo, aes(x=manufacturer, y=temp))+geom_boxplot(fill="grey")+ theme_classic() # Dotchart with standard deviation is a btter option here ggplot(thermo, aes(x=manufacturer, y=temp))+ stat_summary(fun.data="mean_sdl") # 2 plants<-read.delim("clipboard") summary(plants) aov.1<-aov(Biomass~Fertilizer, data=plants) summary(aov.1) # Df Sum Sq Mean Sq F value Pr(>F) # Fertilizer 4 26740 6685 45.96 3.6e-11 *** # Residuals 25 3636 145 # --- # Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 plot(aov.1)# ANOVA diagnostic plots TukeyHSD(aov.1) # diff lwr upr p adj # Mineral-Control 69.83333 49.383672 90.282994 0.0000000 # MinSlow-Control 86.00000 65.550339 106.449661 0.0000000 # NitrateAmm-Control 47.16667 26.717006 67.616328 0.0000040 # OrganicManure-Control 68.83333 48.383672 89.282994 0.0000000 # MinSlow-Mineral 16.16667 -4.282994 36.616328 0.1713159 # NitrateAmm-Mineral -22.66667 -43.116328 -2.217006 0.0245596 # OrganicManure-Mineral -1.00000 -21.449661 19.449661 0.9998971 # NitrateAmm-MinSlow -38.83333 -59.282994 -18.383672 0.0000769 # OrganicManure-MinSlow -17.16667 -37.616328 3.282994 0.1311420 # OrganicManure-NitrateAmm 21.66667 1.217006 42.116328 0.0340129 #Plotting ggplot(plants, aes(x=Fertilizer, y=Biomass))+geom_boxplot(fill="grey")+ theme_classic() library(Hmisc) ggplot(plants, aes(x=Fertilizer, y=Biomass))+ stat_summary(fun.data="mean_cl_normal")