Part 2: Basic Inferential Data Analysis

Effect of Vitamin C on Tooth Growth in Guinea Pigs

In this study, the effect of Vitamine C on tooth growth estimated by the length of odontoblasts (cells responsible for tooth growth) in 60 guinea pig is evaluated. Each animal received one of three dose levels of vitamin C (0.5, 1, and 2 mg/day) by one of two delivery methods, orange juice or ascorbic acid (a form of vitamin C and coded as VC). Analyze is base on ToothGrowth data from R datasets package

Exploratory analysis

In this part of the analysis, the size, structure and content of ToothGrowth dataset is investigated.

## 'data.frame':    60 obs. of  3 variables:
##  $ len : num  4.2 11.5 7.3 5.8 6.4 10 11.2 11.2 5.2 7 ...
##  $ supp: Factor w/ 2 levels "OJ","VC": 2 2 2 2 2 2 2 2 2 2 ...
##  $ dose: num  0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
## 
## OJ VC 
## 30 30
## 
## 0.5   1   2 
##  20  20  20

Data are grouped by delivery method (orange juice (OJ) or ascorbic acid (VC)), and by dose to analyze the length of odontoblasts.

Data summary

Mean and standard deviation are evaluated for each combinations of delivery method and dose.

Characteristic N Overall, N = 201 OJ, N = 101 VC, N = 101
0.5 mg/day 20 10.61 (4.50) 13.23 (4.46) 7.98 (2.75)
1.0 mg/day 20 19.74 (4.42) 22.70 (3.91) 16.77 (2.52)
2.0 mg/day 20 26.10 (3.77) 26.06 (2.66) 26.14 (4.80)

1 Mean (SD)

Comparison of tooth growth by dose of Vitamin C and delivery method

Based on summary data, relevance of difference between delivery method and dose is investigated. To avoid covariance biais on results and to stay focus on the subject of this assignment, t-test is used to compare separately each subgroups for the following hypothesis: H0 = no effect (difference in means equal to 0), two sided, alpha risk = 0.05 / conf.level = 0.95

Delivery method

Characteristic OJ, N = 101 VC, N = 101 p-value2
0.5 mg/day 13.23 (4.46) 7.98 (2.75) 0.006
1.0 mg/day 22.70 (3.91) 16.77 (2.52) 0.001
2.0 mg/day 26.06 (2.66) 26.14 (4.80) >0.9

1 Mean (SD)

2 Welch Two Sample t-test

95% Confidence interval highlight the significance of observed differences.

## [1] "95% Confidence interval of difference in Tooth length means"
## [1] "Method difference, 0.5 mg/day"
## [1] 1.72 8.78
## [1] "Method difference, 1.0 mg/day"
## [1] 2.80 9.06
## [1] "Method difference, 2.0 mg/day"
## [1] -3.80  3.64

Dose effect

Characteristic 0.5, N = 101 1, N = 101 p-value2
Orange juice 13.23 (4.46) 22.70 (3.91) <0.001
Ascorbic acid 7.98 (2.75) 16.77 (2.52) <0.001

1 Mean (SD)

2 Welch Two Sample t-test

## [1] "95% CI of difference in Tooth length means OJ and VC, 1.0 vs 0.5 mg/day" ## [1] 5.52 13.42 ## [1] 6.31 11.27
Characteristic 0.5, N = 101 2, N = 101 p-value2
Orange juice 13.23 (4.46) 26.06 (2.66) <0.001
Ascorbic acid 7.98 (2.75) 26.14 (4.80) <0.001

1 Mean (SD)

2 Welch Two Sample t-test

## [1] "95% CI of difference in Tooth length means OJ and VC, 2.0 vs 0.5 mg/day" ## [1] 9.32 16.34 ## [1] 14.42 21.90
Characteristic 1, N = 101 2, N = 101 p-value2
Orange juice 22.70 (3.91) 26.06 (2.66) 0.039
Ascorbic acid 16.77 (2.52) 26.14 (4.80) <0.001

1 Mean (SD)

2 Welch Two Sample t-test

## [1] "95% CI of difference in Tooth length means OJ and VC, 2.0 vs 1.0 mg/day" ## [1] 0.19 6.53 ## [1] 5.69 13.05

Conclusions

Analysis performed in the field of this assignment highlight a significant effect of the dose and the delivery method.

Increase in Vitamin C dose has a significant impact upon tooth growth.

Also, delivery method of Vitamin C appear to have a significant impact when lowest dose are administered (0.5 and 1.0) but not at 2.0 mg/day.

However, other method should be interesting to apply as multiple comparison tests with Bonferroni correction and ANCOVA.

Appendix code

Effect of Vitamin C on Tooth Growth in Guinea Pigs

data(ToothGrowth)

Exploratory analysis

# Size and Structure of ToothGrowth
str(ToothGrowth)

# Content of ToothGrowth
table(ToothGrowth$supp)
table(ToothGrowth$dose)

# Plot with by delivery method groups and by dose
library(ggplot2)
g <- ggplot(data = ToothGrowth, aes(x = as.factor(dose), y = len))
g + 
  geom_boxplot(aes(fill=-dose)) + 
  facet_grid(.~supp) +
  theme(legend.position = "none") +
  labs(title = "Overview of ToothGrowth data",
       x = "Dose (mg/day)",
       y = "Tooth length")

Data summary

library(dplyr)
library(gtsummary)

#test (ajouter titre gpe)
dose_0.5 <- ToothGrowth[ToothGrowth$dose == 0.5, c(1,2)] %>%
  group_by(supp) %>%
  tbl_summary(by = supp,
              label = len ~ "0.5 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_overall() %>%
              add_n()

dose_1.0 <- ToothGrowth[ToothGrowth$dose == 1.0, c(1,2)] %>%
  group_by(supp) %>%
  tbl_summary(by = supp,
              label = len ~ "1.0 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_overall() %>%
              add_n()

dose_2.0 <- ToothGrowth[ToothGrowth$dose == 2.0, c(1,2)] %>%
  group_by(supp) %>%
  tbl_summary(by = supp,
              label = len ~ "2.0 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_overall() %>%
              add_n()

tbl_stack(list(dose_0.5, dose_1.0, dose_2.0)) 

Comparison of tooth growth by dose of Vitamin C and delivery method

library(dplyr)
library(gtsummary)

#test (ajouter titre gpe)
dose_0.5 <- ToothGrowth[ToothGrowth$dose == 0.5, c(1,2)] %>%
  group_by(supp) %>%
  tbl_summary(by = supp,
              label = len ~ "0.5 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_overall() %>%
              add_n()

dose_1.0 <- ToothGrowth[ToothGrowth$dose == 1.0, c(1,2)] %>%
  group_by(supp) %>%
  tbl_summary(by = supp,
              label = len ~ "1.0 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_overall() %>%
              add_n()

dose_2.0 <- ToothGrowth[ToothGrowth$dose == 2.0, c(1,2)] %>%
  group_by(supp) %>%
  tbl_summary(by = supp,
              label = len ~ "2.0 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_overall() %>%
              add_n()

tbl_stack(list(dose_0.5, dose_1.0, dose_2.0)) 

# Delivery method
# Tooth length data at 0.5 mg/day: OJ vs VC
table1 <- ToothGrowth[ToothGrowth$dose == 0.5, c(1,2)] %>%
  tbl_summary(by = supp,
              label = len ~ "0.5 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

# Tooth length data at 1.0 mg/day: OJ vs VC
table2 <- ToothGrowth[ToothGrowth$dose == 1.0, c(1,2)] %>%
  tbl_summary(by = supp,
              label = len ~ "1.0 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

# Tooth length data at 2.0 mg/day: OJ vs VC
table3 <- ToothGrowth[ToothGrowth$dose == 2.0, c(1,2)] %>%
  tbl_summary(by = supp,
              label = len ~ "2.0 mg/day",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

tbl_stack(list(table1, table2, table3)) 

# 95% Confidence interval
# Tooth length data at 0.5 mg/day: OJ vs VC
OJ_0.5 <- ToothGrowth[ToothGrowth$supp == "OJ" & ToothGrowth$dose == 0.5, "len"]
VC_0.5 <- ToothGrowth[ToothGrowth$supp == "VC" & ToothGrowth$dose == 0.5, "len"]
result1 <- t.test(x = OJ_0.5, y = VC_0.5, alternative = "two.sided", conf.level = 0.95)

# Tooth length data at 1.0 mg/day: OJ vs VC
OJ_1.0 <- ToothGrowth[ToothGrowth$supp == "OJ" & ToothGrowth$dose == 1.0, "len"]
VC_1.0 <- ToothGrowth[ToothGrowth$supp == "VC" & ToothGrowth$dose == 1.0, "len"]
result2 <- t.test(x = OJ_1.0, y = VC_1.0, alternative = "two.sided", conf.level = 0.95)

# Tooth length data at 1.0 mg/day: OJ vs VC
OJ_2.0 <- ToothGrowth[ToothGrowth$supp == "OJ" & ToothGrowth$dose == 2.0, "len"]
VC_2.0 <- ToothGrowth[ToothGrowth$supp == "VC" & ToothGrowth$dose == 2.0, "len"]
result3 <- t.test(x = OJ_2.0, y = VC_2.0, alternative = "two.sided", conf.level = 0.95)

# Output
print("95% Confidence interval of difference in Tooth length means")
print("Method difference, 0.5 mg/day")
print(round(result1$conf.int[1:2],2))
print("Method difference, 1.0 mg/day")
print(round(result2$conf.int[1:2],2))
print("Method difference, 2.0 mg/day")
print(round(result3$conf.int[1:2],2))

#Dose effect
# "OJ", doses 0.5 and 1.0 mg/day
table4 <- ToothGrowth[ToothGrowth$supp == "OJ" &
                        ToothGrowth$dose == 0.5 |
                        ToothGrowth$supp == "OJ" &
                        ToothGrowth$dose == 1.0, c(1,3)] %>%
  tbl_summary(by = dose,
              label = len ~ "Orange juice",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

result4 <- t.test(x = OJ_1.0, y = OJ_0.5, alternative = "two.sided", conf.level = 0.95)

# "VC", doses 0.5 and 1.0 mg/day
table5 <- ToothGrowth[ToothGrowth$supp == "VC" &
                        ToothGrowth$dose == 0.5 |
                        ToothGrowth$supp == "VC" &
                        ToothGrowth$dose == 1.0, c(1,3)] %>%
  tbl_summary(by = dose,
              label = len ~ "Ascorbic acid",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

result5 <- t.test(x = VC_1.0, y = VC_0.5, alternative = "two.sided", conf.level = 0.95)

# "OJ", doses 0.5 and 2.0 mg/day
table6 <- ToothGrowth[ToothGrowth$supp == "OJ" &
                        ToothGrowth$dose == 0.5 |
                        ToothGrowth$supp == "OJ" &
                        ToothGrowth$dose == 2.0, c(1,3)] %>%
  tbl_summary(by = dose,
              label = len ~ "Orange juice",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

result6 <- t.test(x = OJ_2.0, y = OJ_0.5, alternative = "two.sided", conf.level = 0.95)

# "VC", doses 0.5 and 2.0 mg/day
table7 <- ToothGrowth[ToothGrowth$supp == "VC" &
                        ToothGrowth$dose == 0.5 |
                        ToothGrowth$supp == "VC" &
                        ToothGrowth$dose == 2.0, c(1,3)] %>%
  tbl_summary(by = dose,
              label = len ~ "Ascorbic acid",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

result7 <- t.test(x = VC_2.0, y = VC_0.5, alternative = "two.sided", conf.level = 0.95)

# "OJ", doses 1.0 and 2.0 mg/day
table8 <- ToothGrowth[ToothGrowth$supp == "OJ" &
                        ToothGrowth$dose == 1.0 |
                        ToothGrowth$supp == "OJ" &
                        ToothGrowth$dose == 2.0, c(1,3)] %>%
  tbl_summary(by = dose,
              label = len ~ "Orange juice",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

result8 <- t.test(x = OJ_2.0, y = OJ_1.0, alternative = "two.sided", conf.level = 0.95)

# "VC", doses 1.0 and 2.0 mg/day
table9 <- ToothGrowth[ToothGrowth$supp == "VC" &
                        ToothGrowth$dose == 1.0 |
                        ToothGrowth$supp == "VC" &
                        ToothGrowth$dose == 2.0, c(1,3)] %>%
  tbl_summary(by = dose,
              label = len ~ "Ascorbic acid",
              statistic = list(all_continuous() ~ "{mean} ({sd})"),
              digits = all_continuous() ~ 2) %>%
              bold_labels() %>%
              add_p(test = list(all_continuous() ~ "t.test"))

result9 <- t.test(x = VC_2.0, y = VC_1.0, alternative = "two.sided", conf.level = 0.95)

# Output
tbl_stack(list(table4, table5)) 
print("95% CI of difference in Tooth length means OJ and VC, 1.0 vs 0.5 mg/day")
print(round(result4$conf.int[1:2],2))
print(round(result5$conf.int[1:2],2))

tbl_stack(list(table6, table7))
print("95% CI of difference in Tooth length means OJ and VC, 2.0 vs 0.5 mg/day")
print(round(result6$conf.int[1:2],2))
print(round(result7$conf.int[1:2],2))

tbl_stack(list(table8, table9)) 
print("95% CI of difference in Tooth length means OJ and VC, 2.0 vs 1.0 mg/day")
print(round(result8$conf.int[1:2],2))
print(round(result9$conf.int[1:2],2))