knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)

Hamstring QQ Plots

library(car)
library(tidyverse)
library(readr)
library(readxl)
data_hamstring <- read_excel("/Users/ihsanbuker/Desktop/BioAllograft/Data/MRI Data Cleaned.xlsx", 
    sheet = "Hamstring")

data_hamstring %>%
  select(-1,-3,-8,-13) -> data_hamstring 
qqPlot(data_hamstring$`3 Month Volume mm^3.`, ylim = c(1000,5000))

## [1] 6 8
qqPlot(data_hamstring$`6 MonthVolume mm^3.`, ylim = c(1000,5000))

## [1] 7 8
qqPlot(data_hamstring$`9 Month Volume mm^3.`, ylim = c(1000,5000))

## [1] 10  8
qqPlot(data_hamstring$`12 Month Volume mm^3.`, ylim = c(1000,5000))

## [1] 9 8
qqPlot(data_hamstring$`3 Month T2ms.`, ylim = c(15,55))

## [1] 10  3
qqPlot(data_hamstring$`6 Month T2ms.`, ylim = c(15,55))

## [1] 6 3
qqPlot(data_hamstring$`9 Month T2ms.`, ylim = c(15,55))

## [1] 6 1
qqPlot(data_hamstring$`12 Month T2ms.`, ylim = c(15,55))

## [1] 4 6
qqPlot(data_hamstring$`3 Month T2*ms.`, ylim = c(5,15))

## [1] 10 12
qqPlot(data_hamstring$`6 Month T2*ms.`, ylim = c(5,15))

## [1]  3 12
qqPlot(data_hamstring$`9 Month T2*ms.`, ylim = c(5,15))

## [1] 10  6
qqPlot(data_hamstring$`12 Month T2*ms.`, ylim = c(5,15))

## [1] 2 5

BTB QQ Plots

library(car)
library(tidyverse)
library(readr)
library(readxl)
data_BTB <- read_excel("/Users/ihsanbuker/Desktop/BioAllograft/Data/MRI Data Cleaned.xlsx", 
    sheet = "BTB")

qqPlot(data_BTB$`3 Month Volume mm^3.`, ylim = c(1000,5000))

## [1] 6 3
qqPlot(data_BTB$`6 Month Volume mm^3.`, ylim = c(1000,5000))

## [1] 6 3
qqPlot(data_BTB$`9 Month Volume mm^3.`, ylim = c(1000,5000))

## [1] 3 6
qqPlot(data_BTB$`12 Month Volume mm^3.`, ylim = c(1000,5000))

## [1] 3 6
qqPlot(data_BTB$`3 Months T2ms.`, ylim = c(15,55))

## [1] 8 3
qqPlot(data_BTB$`6 Months T2ms.`, ylim = c(15,55))

## [1]  2 10
qqPlot(data_BTB$`9 Months T2ms.`, ylim = c(15,55))

## [1]  4 10
qqPlot(data_BTB$`12 Months T2ms.`, ylim = c(15,55))

## [1] 2 5
qqPlot(data_BTB$`3 Months T2*ms.` , ylim = c(5,15) )

## [1] 1 9
qqPlot(data_BTB$`6 Months T2*ms.` , ylim = c(5,15) )

## [1] 1 5
qqPlot(data_BTB$`9 Months T2*ms.` , ylim = c(5,15) )

## [1] 1 5
qqPlot(data_BTB$`12 Months T2*ms.`, ylim = c(5,15) )

## [1] 10  5

Hamstring Analyses

Volume

library(rlist)
library(readxl)
library(readr)
library(car)
library(tidyverse)
data_hamstring <- read_excel("/Users/ihsanbuker/Desktop/BioAllograft/Data/MRI Data Cleaned.xlsx", 
    sheet = "Hamstring")

data_hamstring %>%
  select(-1,-3,-8,-13) -> data_hamstring 

# Volume Data 
data_hamstring %>%
  select(1,2:5) %>%
  group_by(data_hamstring$Group, .add = TRUE) %>%
  group_split() -> x
x[[1]] %>%
  select(-6) -> df_volume_control
control <- as.data.frame(colMeans(df_volume_control %>% select(-1)))
control$Group <- "Control"
control$Month <- row.names(control)
row.names(control) <- NULL
colnames(control) <- c("Mean Volume", "Group", "Month")

x[[2]] %>%
  select(-6) -> df_volume_intervention
intervention <- as.data.frame(colMeans(df_volume_intervention %>% select(-1)))
intervention$Group <- "Intervention"
intervention$Month <- row.names(intervention)
row.names(intervention) <- NULL
colnames(intervention) <- c("Mean Volume", "Group", "Month")

df_volume <- rbind(intervention,control)
df_volume %>%
  group_by(Month) %>%
  group_split() -> y

y[[2]] %>% select(-3,-2) -> three_months
y[[3]] %>% select(-3,-2) -> six_months
y[[4]] %>% select(-3,-2) -> nine_months
y[[1]] %>% select(-3,-2) -> twelve_months

z <- cbind(three_months, six_months, nine_months, twelve_months)
z$Group <- c("Intervention", "Control")
colnames(z) <- c("3 Months", "6 Months", "9 Months", "12 Months", "Group")

# 3 Month
var.test(unlist(df_volume_control %>% select(2)), unlist(df_volume_intervention %>% select(2)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(2)) and unlist(df_volume_intervention %>% select(2))
## F = 0.12759, num df = 3, denom df = 7, p-value = 0.1186
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.0216625 1.8659006
## sample estimates:
## ratio of variances 
##          0.1275882
t.test(df_volume_control%>% select(2),df_volume_intervention %>% select(2), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(2) and df_volume_intervention %>% select(2)
## t = 0.26935, df = 10, p-value = 0.7931
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1015.828  1295.198
## sample estimates:
## mean of x mean of y 
##  2969.378  2829.693
# 6 Months 
var.test(unlist(df_volume_control %>% select(3)), unlist(df_volume_intervention %>% select(3)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(3)) and unlist(df_volume_intervention %>% select(3))
## F = 0.14871, num df = 3, denom df = 7, p-value = 0.1455
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.02524797 2.17473519
## sample estimates:
## ratio of variances 
##           0.148706
t.test(df_volume_control%>% select(3),df_volume_intervention %>% select(3), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(3) and df_volume_intervention %>% select(3)
## t = 0.32522, df = 10, p-value = 0.7517
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1226.186  1645.308
## sample estimates:
## mean of x mean of y 
##  3082.194  2872.634
# 9 Months 
var.test(unlist(df_volume_control %>% select(4)), unlist(df_volume_intervention %>% select(4)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(4)) and unlist(df_volume_intervention %>% select(4))
## F = 0.69474, num df = 3, denom df = 7, p-value = 0.8321
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.1179564 10.1601797
## sample estimates:
## ratio of variances 
##          0.6947419
t.test(df_volume_control%>% select(4),df_volume_intervention %>% select(4), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(4) and df_volume_intervention %>% select(4)
## t = 0.97357, df = 10, p-value = 0.3532
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -523.5596 1336.1508
## sample estimates:
## mean of x mean of y 
##  3283.119  2876.823
# 12 Months 
var.test(unlist(df_volume_control %>% select(5)), unlist(df_volume_intervention %>% select(5)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(5)) and unlist(df_volume_intervention %>% select(5))
## F = 0.13098, num df = 3, denom df = 7, p-value = 0.1228
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.02223907 1.91556289
## sample estimates:
## ratio of variances 
##          0.1309841
t.test(df_volume_control%>% select(5),df_volume_intervention %>% select(5), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(5) and df_volume_intervention %>% select(5)
## t = 0.57465, df = 10, p-value = 0.5782
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1054.477  1787.426
## sample estimates:
## mean of x mean of y 
##  3246.608  2880.133

T2

data_hamstring %>% 
  select(1,6:9) %>%
  group_by(data_hamstring$Group, .add = TRUE) %>%
  group_split() -> x
x[[1]] %>%
  select(-6) -> df_T2_control
control <- as.data.frame(colMeans(df_T2_control %>% select(-1)))
control$Group <- "Control"
control$Month <- row.names(control)
row.names(control) <- NULL
colnames(control) <- c("Mean T2", "Group", "Month")

x[[2]] %>%
  select(-6) -> df_T2_intervention
intervention <- as.data.frame(colMeans(df_T2_intervention %>% select(-1)))
intervention$Group <- "Intervention"
intervention$Month <- row.names(intervention)
row.names(intervention) <- NULL
colnames(intervention) <- c("Mean T2", "Group", "Month")

df_volume <- rbind(intervention,control)
df_volume %>%
  group_by(Month) %>%
  group_split() -> y

y[[2]] %>% select(-3,-2) -> three_months
y[[3]] %>% select(-3,-2) -> six_months
y[[4]] %>% select(-3,-2) -> nine_months
y[[1]] %>% select(-3,-2) -> twelve_months

z <- cbind(three_months, six_months, nine_months, twelve_months)
z$Group <- c("Intervention", "Control")
colnames(z) <- c("3 Months", "6 Months", "9 Months", "12 Months", "Group")

# 3 Month
var.test(unlist(df_T2_control %>% select(2)), unlist(df_T2_intervention %>% select(2)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(2)) and unlist(df_T2_intervention %>% select(2))
## F = 0.91804, num df = 3, denom df = 7, p-value = 0.9598
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.1558695 13.4258248
## sample estimates:
## ratio of variances 
##          0.9180431
t.test(df_T2_control%>% select(2),df_T2_intervention %>% select(2), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(2) and df_T2_intervention %>% select(2)
## t = -0.050508, df = 10, p-value = 0.9607
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -8.513511  8.136097
## sample estimates:
## mean of x mean of y 
##  30.98045  31.16916
# 6 Months 
var.test(unlist(df_T2_control %>% select(3)), unlist(df_T2_intervention %>% select(3)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(3)) and unlist(df_T2_intervention %>% select(3))
## F = 1.217, num df = 3, denom df = 7, p-value = 0.7442
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.206633 17.798340
## sample estimates:
## ratio of variances 
##           1.217031
t.test(df_T2_control%>% select(3),df_T2_intervention %>% select(3), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(3) and df_T2_intervention %>% select(3)
## t = 0.36457, df = 10, p-value = 0.723
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -7.339388 10.211008
## sample estimates:
## mean of x mean of y 
##  35.27540  33.83959
# 9 Months 
var.test(unlist(df_T2_control %>% select(4)), unlist(df_T2_intervention %>% select(4)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(4)) and unlist(df_T2_intervention %>% select(4))
## F = 1.1738, num df = 3, denom df = 7, p-value = 0.7715
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.1993007 17.1667747
## sample estimates:
## ratio of variances 
##           1.173845
t.test(df_T2_control%>% select(4),df_T2_intervention %>% select(4), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(4) and df_T2_intervention %>% select(4)
## t = 1.2455, df = 10, p-value = 0.2414
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -4.893738 17.298327
## sample estimates:
## mean of x mean of y 
##  38.42132  32.21903
# 12 Months 
var.test(unlist(df_T2_control %>% select(5)), unlist(df_T2_intervention %>% select(5)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(5)) and unlist(df_T2_intervention %>% select(5))
## F = 2.0179, num df = 3, denom df = 7, p-value = 0.4002
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.3426038 29.5101894
## sample estimates:
## ratio of variances 
##           2.017874
t.test(df_T2_control%>% select(5),df_T2_intervention %>% select(5), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(5) and df_T2_intervention %>% select(5)
## t = 1.2532, df = 10, p-value = 0.2386
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -4.674051 16.691099
## sample estimates:
## mean of x mean of y 
##  39.93986  33.93134

T2*

data_hamstring %>%
  select(1,10:13) %>%
  group_by(data_hamstring$Group, .add = TRUE) %>%
  group_split() -> x
x[[1]] %>%
  select(-6) -> df_T2_star_control
control <- as.data.frame(colMeans(df_T2_star_control %>% select(-1)))
control$Group <- "Control"
control$Month <- row.names(control)
row.names(control) <- NULL
colnames(control) <- c("Mean T2_star", "Group", "Month")

x[[2]] %>%
  select(-6) -> df_T2_star_intervention
intervention <- as.data.frame(colMeans(df_T2_star_intervention %>% select(-1)))
intervention$Group <- "Intervention"
intervention$Month <- row.names(intervention)
row.names(intervention) <- NULL
colnames(intervention) <- c("Mean T2_star", "Group", "Month")

df_volume <- rbind(intervention,control)
df_volume %>%
  group_by(Month) %>%
  group_split() -> y

y[[2]] %>% select(-3,-2) -> three_months
y[[3]] %>% select(-3,-2) -> six_months
y[[4]] %>% select(-3,-2) -> nine_months
y[[1]] %>% select(-3,-2) -> twelve_months

z <- cbind(three_months, six_months, nine_months, twelve_months)
z$Group <- c("Intervention", "Control")
colnames(z) <- c("3 Months", "6 Months", "9 Months", "12 Months", "Group")

# 3 Month
var.test(unlist(df_T2_star_control %>% select(2)), unlist(df_T2_star_intervention %>% select(2)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(2)) and unlist(df_T2_star_intervention %>% select(2))
## F = 0.50395, num df = 3, denom df = 7, p-value = 0.6168
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.08556258 7.36993642
## sample estimates:
## ratio of variances 
##          0.5039481
t.test(df_T2_star_control%>% select(2),df_T2_star_intervention %>% select(2), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(2) and df_T2_star_intervention %>% select(2)
## t = 1.1496, df = 10, p-value = 0.2771
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.022730  3.202938
## sample estimates:
## mean of x mean of y 
## 10.565812  9.475708
# 6 Months 
var.test(unlist(df_T2_star_control %>% select(3)), unlist(df_T2_star_intervention %>% select(3)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(3)) and unlist(df_T2_star_intervention %>% select(3))
## F = 2.9573, num df = 3, denom df = 7, p-value = 0.2146
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.5021058 43.2488999
## sample estimates:
## ratio of variances 
##           2.957312
t.test(df_T2_star_control%>% select(3),df_T2_star_intervention %>% select(3), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(3) and df_T2_star_intervention %>% select(3)
## t = 1.0863, df = 10, p-value = 0.3028
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.8885895  2.5794524
## sample estimates:
## mean of x mean of y 
##  11.44090  10.59547
# 9 Months 
var.test(unlist(df_T2_star_control %>% select(4)), unlist(df_T2_star_intervention %>% select(4)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(4)) and unlist(df_T2_star_intervention %>% select(4))
## F = 0.50132, num df = 3, denom df = 7, p-value = 0.6135
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.08511699 7.33155582
## sample estimates:
## ratio of variances 
##          0.5013237
t.test(df_T2_star_control%>% select(4),df_T2_star_intervention %>% select(4), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(4) and df_T2_star_intervention %>% select(4)
## t = 0.20223, df = 10, p-value = 0.8438
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -2.268875  2.721853
## sample estimates:
## mean of x mean of y 
##  11.46764  11.24115
# 12 Months 
var.test(unlist(df_T2_star_control %>% select(5)), unlist(df_T2_star_intervention %>% select(5)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(5)) and unlist(df_T2_star_intervention %>% select(5))
## F = 2.1177, num df = 3, denom df = 7, p-value = 0.3727
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.3595529 30.9701003
## sample estimates:
## ratio of variances 
##           2.117701
t.test(df_T2_star_control%>% select(5),df_T2_star_intervention %>% select(5), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(5) and df_T2_star_intervention %>% select(5)
## t = 1.1895, df = 10, p-value = 0.2617
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.8961925  2.9488537
## sample estimates:
## mean of x mean of y 
##  11.54672  10.52039

BTB Analyses

Volume

library(readxl)
library(tidyverse)
data_BTB <- read_excel("/Users/ihsanbuker/Desktop/BioAllograft/Data/MRI Data Cleaned.xlsx", 
    sheet = "BTB")

data_BTB %>%
  select(-1,-3,-8,-13) -> data_BTB

# Volume Data
data_BTB %>%
  select(1,2:5) %>%
  group_by(data_BTB$Group, .add = TRUE) %>%
  group_split() -> x
x[[1]] %>%
  select(-6) -> df_volume_control
control <- as.data.frame(colMeans(df_volume_control %>% select(-1)))
control$Group <- "Control"
control$Month <- row.names(control)
row.names(control) <- NULL
colnames(control) <- c("Mean volume", "Group", "Month")

x[[2]] %>%
  select(-6) -> df_volume_intervention
intervention <- as.data.frame(colMeans(df_volume_intervention %>% select(-1)))
intervention$Group <- "Intervention"
intervention$Month <- row.names(intervention)
row.names(intervention) <- NULL
colnames(intervention) <- c("Mean volume", "Group", "Month")

df_volume <- rbind(intervention,control)
df_volume %>%
  group_by(Month) %>%
  group_split() -> y

y[[2]] %>% select(-3,-2) -> three_months
y[[3]] %>% select(-3,-2) -> six_months
y[[4]] %>% select(-3,-2) -> nine_months
y[[1]] %>% select(-3,-2) -> twelve_months

z <- cbind(three_months, six_months, nine_months, twelve_months)
z$Group <- c("Intervention", "Control")
colnames(z) <- c("3 Months", "6 Months", "9 Months", "12 Months", "Group")

# 3 Month
var.test(unlist(df_volume_control %>% select(2)), unlist(df_volume_intervention %>% select(2)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(2)) and unlist(df_volume_intervention %>% select(2))
## F = 1.1658, num df = 3, denom df = 5, p-value = 0.8193
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.1501585 17.3522594
## sample estimates:
## ratio of variances 
##           1.165769
t.test(df_volume_control%>% select(2),df_volume_intervention %>% select(2), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(2) and df_volume_intervention %>% select(2)
## t = 1.622, df = 8, p-value = 0.1435
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -263.577 1513.725
## sample estimates:
## mean of x mean of y 
##  2694.752  2069.678
# 6 Months 
var.test(unlist(df_volume_control %>% select(3)), unlist(df_volume_intervention %>% select(3)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(3)) and unlist(df_volume_intervention %>% select(3))
## F = 1.0588, num df = 3, denom df = 5, p-value = 0.8885
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.136375 15.759448
## sample estimates:
## ratio of variances 
##            1.05876
t.test(df_volume_control%>% select(3),df_volume_intervention %>% select(3), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(3) and df_volume_intervention %>% select(3)
## t = 0.88497, df = 8, p-value = 0.402
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -725.2147 1628.4834
## sample estimates:
## mean of x mean of y 
##  2798.174  2346.540
# 9 Months 
var.test(unlist(df_volume_control %>% select(4)), unlist(df_volume_intervention %>% select(4)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(4)) and unlist(df_volume_intervention %>% select(4))
## F = 2.3647, num df = 3, denom df = 5, p-value = 0.3752
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.3045908 35.1984089
## sample estimates:
## ratio of variances 
##           2.364718
t.test(df_volume_control%>% select(4),df_volume_intervention %>% select(4), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(4) and df_volume_intervention %>% select(4)
## t = 1.0637, df = 8, p-value = 0.3185
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -613.6386 1664.5411
## sample estimates:
## mean of x mean of y 
##  2734.795  2209.344
# 12 Months 
var.test(unlist(df_volume_control %>% select(5)), unlist(df_volume_intervention %>% select(5)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_volume_control %>% select(5)) and unlist(df_volume_intervention %>% select(5))
## F = 2.3631, num df = 3, denom df = 5, p-value = 0.3755
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.304378 35.173819
## sample estimates:
## ratio of variances 
##           2.363066
t.test(df_volume_control%>% select(5),df_volume_intervention %>% select(5), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_volume_control %>% select(5) and df_volume_intervention %>% select(5)
## t = 0.36343, df = 8, p-value = 0.7257
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1441.155  1980.400
## sample estimates:
## mean of x mean of y 
##  2822.108  2552.486

T2

data_BTB %>%
  select(1,6:9)  %>%
  group_by(data_BTB$Group, .add = TRUE) %>%
  group_split() -> x
x[[1]] %>%
  select(-6) -> df_T2_control
control <- as.data.frame(colMeans(df_T2_control %>% select(-1)))
control$Group <- "Control"
control$Month <- row.names(control)
row.names(control) <- NULL
colnames(control) <- c("Mean T2", "Group", "Month")

x[[2]] %>%
  select(-6) -> df_T2_intervention
intervention <- as.data.frame(colMeans(df_T2_intervention %>% select(-1)))
intervention$Group <- "Intervention"
intervention$Month <- row.names(intervention)
row.names(intervention) <- NULL
colnames(intervention) <- c("Mean T2", "Group", "Month")

df_T2 <- rbind(intervention,control)
df_T2 %>%
  group_by(Month) %>%
  group_split() -> y

y[[2]] %>% select(-3,-2) -> three_months
y[[3]] %>% select(-3,-2) -> six_months
y[[4]] %>% select(-3,-2) -> nine_months
y[[1]] %>% select(-3,-2) -> twelve_months

z <- cbind(three_months, six_months, nine_months, twelve_months)
z$Group <- c("Intervention", "Control")
colnames(z) <- c("3 Months", "6 Months", "9 Months", "12 Months", "Group")

# 3 Month
var.test(unlist(df_T2_control %>% select(2)), unlist(df_T2_intervention %>% select(2)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(2)) and unlist(df_T2_intervention %>% select(2))
## F = 1.4515, num df = 3, denom df = 5, p-value = 0.6664
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.1869668 21.6058185
## sample estimates:
## ratio of variances 
##           1.451533
t.test(df_T2_control%>% select(2),df_T2_intervention %>% select(2), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(2) and df_T2_intervention %>% select(2)
## t = 0.69344, df = 8, p-value = 0.5077
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -4.674112  8.694035
## sample estimates:
## mean of x mean of y 
##  35.38170  33.37174
# 6 Months 
var.test(unlist(df_T2_control %>% select(3)), unlist(df_T2_intervention %>% select(3)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(3)) and unlist(df_T2_intervention %>% select(3))
## F = 1.0747, num df = 3, denom df = 5, p-value = 0.8777
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.1384326 15.9972234
## sample estimates:
## ratio of variances 
##           1.074734
t.test(df_T2_control%>% select(3),df_T2_intervention %>% select(3), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(3) and df_T2_intervention %>% select(3)
## t = -1.0955, df = 8, p-value = 0.3052
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -12.860023   4.576419
## sample estimates:
## mean of x mean of y 
##  33.23141  37.37321
# 9 Months 
var.test(unlist(df_T2_control %>% select(4)), unlist(df_T2_intervention %>% select(4)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(4)) and unlist(df_T2_intervention %>% select(4))
## F = 2.185, num df = 3, denom df = 5, p-value = 0.4162
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.2814432 32.5234847
## sample estimates:
## ratio of variances 
##            2.18501
t.test(df_T2_control%>% select(4),df_T2_intervention %>% select(4), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(4) and df_T2_intervention %>% select(4)
## t = 0.58953, df = 8, p-value = 0.5718
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -6.256537 10.554168
## sample estimates:
## mean of x mean of y 
##  33.55064  31.40182
# 12 Months 
var.test(unlist(df_T2_control %>% select(5)), unlist(df_T2_intervention %>% select(5)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_control %>% select(5)) and unlist(df_T2_intervention %>% select(5))
## F = 2.9878, num df = 3, denom df = 5, p-value = 0.2693
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.3848437 44.4724063
## sample estimates:
## ratio of variances 
##           2.987769
t.test(df_T2_control%>% select(5),df_T2_intervention %>% select(5), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_control %>% select(5) and df_T2_intervention %>% select(5)
## t = 0.30921, df = 8, p-value = 0.7651
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -7.627242  9.989406
## sample estimates:
## mean of x mean of y 
##  37.78614  36.60506

T2*

data_BTB %>%
  select(1,10:13) %>%
  group_by(data_BTB$Group, .add = TRUE) %>%
  group_split() -> x
x[[1]] %>%
  select(-6) -> df_T2_star_control
control <- as.data.frame(colMeans(df_T2_star_control %>% select(-1)))
control$Group <- "Control"
control$Month <- row.names(control)
row.names(control) <- NULL
colnames(control) <- c("Mean T2_star", "Group", "Month")

x[[2]] %>%
  select(-6) -> df_T2_star_intervention
intervention <- as.data.frame(colMeans(df_T2_star_intervention %>% select(-1)))
intervention$Group <- "Intervention"
intervention$Month <- row.names(intervention)
row.names(intervention) <- NULL
colnames(intervention) <- c("Mean T2_star", "Group", "Month")

df_T2_star <- rbind(intervention,control)
df_T2_star %>%
  group_by(Month) %>%
  group_split() -> y

y[[2]] %>% select(-3,-2) -> three_months
y[[3]] %>% select(-3,-2) -> six_months
y[[4]] %>% select(-3,-2) -> nine_months
y[[1]] %>% select(-3,-2) -> twelve_months

z <- cbind(three_months, six_months, nine_months, twelve_months)
z$Group <- c("Intervention", "Control")
colnames(z) <- c("3 Months", "6 Months", "9 Months", "12 Months", "Group")

# 3 Month
var.test(unlist(df_T2_star_control %>% select(2)), unlist(df_T2_star_intervention %>% select(2)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(2)) and unlist(df_T2_star_intervention %>% select(2))
## F = 1.593, num df = 3, denom df = 5, p-value = 0.6047
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.2051865 23.7112863
## sample estimates:
## ratio of variances 
##           1.592984
t.test(df_T2_star_control%>% select(2),df_T2_star_intervention %>% select(2), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(2) and df_T2_star_intervention %>% select(2)
## t = 1.9358, df = 8, p-value = 0.08892
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1829454  2.0961494
## sample estimates:
## mean of x mean of y 
##  9.997340  9.040738
# 6 Months 
var.test(unlist(df_T2_star_control %>% select(3)), unlist(df_T2_star_intervention %>% select(3)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(3)) and unlist(df_T2_star_intervention %>% select(3))
## F = 1.6192, num df = 3, denom df = 5, p-value = 0.5941
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.2085613 24.1012693
## sample estimates:
## ratio of variances 
##           1.619184
t.test(df_T2_star_control%>% select(3),df_T2_star_intervention %>% select(3), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(3) and df_T2_star_intervention %>% select(3)
## t = 1.3857, df = 8, p-value = 0.2032
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.7996318  3.2077778
## sample estimates:
## mean of x mean of y 
## 10.711040  9.506967
# 9 Months 
var.test(unlist(df_T2_star_control %>% select(4)), unlist(df_T2_star_intervention %>% select(4)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(4)) and unlist(df_T2_star_intervention %>% select(4))
## F = 2.8131, num df = 3, denom df = 5, p-value = 0.2943
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   0.3623467 41.8726560
## sample estimates:
## ratio of variances 
##           2.813111
t.test(df_T2_star_control%>% select(4),df_T2_star_intervention %>% select(4), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(4) and df_T2_star_intervention %>% select(4)
## t = 1.8664, df = 8, p-value = 0.09895
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.4627076  4.3915917
## sample estimates:
## mean of x mean of y 
## 11.540215  9.575773
# 12 Months 
var.test(unlist(df_T2_star_control %>% select(5)), unlist(df_T2_star_intervention %>% select(5)))
## 
##  F test to compare two variances
## 
## data:  unlist(df_T2_star_control %>% select(5)) and unlist(df_T2_star_intervention %>% select(5))
## F = 0.28017, num df = 3, denom df = 5, p-value = 0.324
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.03608714 4.17021758
## sample estimates:
## ratio of variances 
##          0.2801657
t.test(df_T2_star_control%>% select(5),df_T2_star_intervention %>% select(5), var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  df_T2_star_control %>% select(5) and df_T2_star_intervention %>% select(5)
## t = 0.76549, df = 8, p-value = 0.466
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.543085  3.076627
## sample estimates:
## mean of x mean of y 
## 10.723335  9.956564