Title: Effect of supplements on tooth growth
Author:tgjoen
In this project the effect of dietary supplement OJ and VC on tooth growth will be compared at tree different dose levels (0.5, 1 and 2). The hypothesis that there is no difference in growth at equal dose levels is analysed using T-test (if output interval does not contain 0, the growth is different at a p-level of 5%)
library(datasets); data(ToothGrowth); library(ggplot2)
Summary statistics of raw data showing a box plot of length of growth (y-axis) against dose and supplement.
g <- ggplot(ToothGrowth, aes(x = supp, y = len,
colour = supp, group = supp))
g <- g + geom_boxplot()
g <- g + facet_grid(. ~ dose)
g

This plot indicates that OJ supports faster growth at the two lowest dose levels, but this will be tested using manually calculated CI 95% (first line) and T-test (second line)
Results of T-test dose level 0.5:
g1 <- ToothGrowth$len[1 : 10]; g2 <- ToothGrowth$len[31 : 40]
difference_05<- g2 - g1
mn05 <- mean(difference_05); s05 <- sd(difference_05); n <- 10
rbind(mn05 + c(-1, 1) * qt(.975, n-1) * s05 / sqrt(n),
t.test(g2, g1, paired = FALSE, var.equal = TRUE)$conf)
## [,1] [,2]
## [1,] 1.263458 9.236542
## [2,] 1.770262 8.729738
Results of T-test dose level 1:
g3 <- ToothGrowth$len[11 : 20]; g4 <- ToothGrowth$len[41 : 50]
difference_1<- g4 - g3
mn1 <- mean(difference_1); s1 <- sd(difference_1); n <- 10
rbind(mn1 + c(-1, 1) * qt(.975, n-1) * s1 / sqrt(n),
t.test(g4, g3, paired = FALSE, var.equal = TRUE)$conf)
## [,1] [,2]
## [1,] 1.951911 9.908089
## [2,] 2.840692 9.019308
Results of T-test dose level 2:
g5 <- ToothGrowth$len[21 : 30]; g6 <- ToothGrowth$len[51 : 60]
difference_2<- g6 - g5
mn2 <- mean(difference_2); s2 <- sd(difference_2); n <- 10
rbind(
mn2 + c(-1, 1) * qt(.975, n-1) * s2 / sqrt(n),
t.test(g6, g5, paired = FALSE, var.equal = TRUE)$conf)
## [,1] [,2]
## [1,] -4.328976 4.168976
## [2,] -3.722999 3.562999
The results shows that (assuming equal variance in the groups compared) at dose level 0.5 and 1 the CI 95% does not contain zero. This means that at these levels the supplement OJ promotes better growth of the teeth. At dose level 2, the CI 95% contains zero, meaning there is no difference between the supplements