Beomsu Kim 01803839 Hyochan Heo 01916195 Onyoo Kim 02014799 Hyeon Woo Lee 02014984
The following code displays the mean, median, minimum and maximum values for the Ovine Dataset:
# Summary Table of the Ovine Dataset.
ovine <- read.csv("ovine.csv", header = TRUE, sep = ",") # Call in the csv file.
antibiotics_ovine <- unique(ovine$Antibiotic) # separate each per_bound value to its corresponding antibiotic.
summary_ovine <- data.frame(
Antibiotic = character(),
Mean = numeric(),
Median = numeric(),
Min = numeric(),
Max = numeric(),
stringsAsFactors = FALSE
)
for (ab in antibiotics_ovine) {
subset_data <- ovine[ovine$Antibiotic == ab, ]
summary_ovine <- rbind(summary_ovine, data.frame(
Antibiotic = ab,
Mean = mean(subset_data$Per_bound),
Median = median(subset_data$Per_bound),
Min = min(subset_data$Per_bound),
Max = max(subset_data$Per_bound)
)) # iterate over each per_bound value for the corresponding antibiotic.
}
print(summary_ovine)
## Antibiotic Mean Median Min Max
## 1 Cloxa 74.375 74.40 70.7 78.0
## 2 Doxy 85.225 85.00 82.7 88.2
## 3 Novo 95.375 95.55 93.6 96.8
## 4 Amp 13.675 13.60 13.0 14.5
## 5 Ceph 10.550 8.40 3.0 22.4
## 6 Strep 12.825 12.85 11.0 14.6
The following code displays the mean, median, minimum and maximum values for the Bovine Dataset:
# Summary Table of the Bovine Dataset.
bovine <- read.csv("bovine.csv", header = TRUE, sep = ",") # separate each per_bound value to its corresponding antibiotic.
antibiotics_bovine <- unique(bovine$Antibiotic) # separate each per_bound value to its corresponding antibiotic.
summary_bovine <- data.frame(
Antibiotic = character(),
Mean = numeric(),
Median = numeric(),
Min = numeric(),
Max = numeric(),
stringsAsFactors = FALSE
)
for (ab in antibiotics_bovine) {
subset_data <- bovine[bovine$Antibiotic == ab, ]
summary_bovine <- rbind(summary_bovine, data.frame(
Antibiotic = ab,
Mean = mean(subset_data$Per_bound),
Median = median(subset_data$Per_bound),
Min = min(subset_data$Per_bound),
Max = max(subset_data$Per_bound)
)) # iterate over each per_bound value for the corresponding antibiotic.
}
print(summary_bovine)
## Antibiotic Mean Median Min Max
## 1 Penic 28.600 29.05 24.3 32.0
## 2 Tetra 31.375 31.70 27.3 34.8
## 3 Strep 7.825 7.25 5.8 11.0
## 4 Eryth 19.075 18.65 17.4 21.6
## 5 Chlora 27.800 27.10 24.2 32.8
Hence, by following the codes above, we are capable of getting two 4x2 tables for each of bovine and ovine values.
library(ggplot2) # install the ggplot2 package to create boxplots.
# Box plot of the Bovine's Percentage Bound.
ggplot(bovine, aes(x = Antibiotic, y = Per_bound)) +
geom_boxplot() +
theme_minimal() +
labs(title = "Bovine Antibiotic Binding Percentage", x = "Antibiotic", y = "Percentage Bound")
# Box plot of the Ovine's Percentage Bound.
ggplot(ovine, aes(x = Antibiotic, y = Per_bound)) +
geom_boxplot() +
theme_minimal() +
labs(title = "Ovine Antibiotic Binding Percentage", x = "Antibiotic", y = "Percentage Bound")
The percentage bound varies among the different kinds of antiobiotics. In the Ovine Dataset, Novo, Doxy, and Cola demonstrate the highest percentages whereas, Amp, Strep, and Ceph represent noticeably lower percentages. Among the six antibiotics, Ceph stands out for its relatively wide range in distribution. In the Bovine Dataset, the overall distribution is broader than the Ovine Dataset. Chlora, Tetra, and Penicillin show relatively high percentage bound values, Erythromycin falls in the mid-range, and Strep is positioned at a lower percentage bound.
There are not enough data points per antibiotic which makes it difficult to evaluate the normality of the data. The distribution has been represented as a bloxplot in the figure above. Notice that, except Doxy of the Ovine Dataset, the mean of percentage bound lies approximately at the midpoint of the interquartile range. If there were a sufficient number of data points, it would have been safe to say that percentage bound is normally distributed.
ggplot(ovine, aes(x = Conc, y = Per_bound, color = Antibiotic)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "blue", size = 0.5) +
facet_grid(~Antibiotic, scales = "free_y") +
labs(title = "Scatter Plot of Concentration vs Percentage Bound by Antibiotic",
x = "Concentration (Conc)",
y = "Percentage Bound (Per_bound)")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `geom_smooth()` using formula = 'y ~ x'
# We have provided a scatter plot with lines of linear regression. A pearson correlation test was also performed because it is visually challenging to interpret with the scatter plot alone.
library(dplyr) # install dplyr and broom to obtain a graph that demonstrate the correlation between the concentration and percentage bound.
##
## Attaching package: 'dplyr'
##
## The following objects are masked from 'package:stats':
##
## filter, lag
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(broom)
results <- ovine %>%
group_by(Antibiotic) %>%
do(tidy(cor.test(.$Conc, .$Per_bound)))
print(results) # the outcome of the scatter plot and the Pearson Correlation Test.
## # A tibble: 6 × 9
## # Groups: Antibiotic [6]
## Antibiotic estimate statistic p.value parameter conf.low conf.high method
## <chr> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <chr>
## 1 Amp 0.616 1.11 0.384 2 -0.846 0.991 Pearson's …
## 2 Ceph -0.834 -2.14 0.166 2 -0.996 0.640 Pearson's …
## 3 Cloxa -0.967 -5.41 0.0325 2 -0.999 -0.0914 Pearson's …
## 4 Doxy -0.868 -2.47 0.132 2 -0.997 0.562 Pearson's …
## 5 Novo -0.971 -5.73 0.0291 2 -0.999 -0.147 Pearson's …
## 6 Strep -0.00403 -0.00570 0.996 2 -0.961 0.961 Pearson's …
## # ℹ 1 more variable: alternative <chr>
From the table provided above, Cloxa and Noxa presents a negative correlation between the concentration and percentage bound (estimate = -0.967 and estimate = -0.971 respectively). Excluding Strep, the remaining (Amp, Ceph, Doxy), also demonstrate a negative correlation, however due to their high p-values, there is not enough evidence to claim that their correlation is valid.
The medians of the “percentage_bound” variable are equal across all groups (antibiotic_names) which indicates that there is no significant difference in the distribution of “percentage_bound” among different antibiotic groups.
The medians of the “percentage_bound” variable are not equal across all groups (antibiotic_names), indicating that there is a significant difference in the distribution of “percentage_bound” among different antibiotic groups.
The Kruskal-Wallis test is a non-parametric test used to determine whether there are any statistically significant differences between the medians of three or more independent groups. Kruskal-Wallis test can also be used to tell if the data describes non-normality. It is a test mainly used when the assumption of normality is violated. If the data does not follow a normal distribution even with transformations, non-parametric tests like Kruskal-Wallis can be more robust.
To perform the test, assume independence, random sampling.
# The Kruskal-Wallis test for Ovine.
# Assign a data frame of the Ovine Dataset.
data <- data.frame(
antibiotic_names = rep(c("Penic", "Tetra", "Strep", "Eryth", "Chlora"), each = 4),
percentage_bound = c(29.6, 24.3, 28.5, 32, 27.3, 32.6, 30.8, 34.8, 5.8, 6.2, 11, 8.3, 21.6, 17.4, 18.3, 19, 29.2, 32.8, 25, 24.2)
)
library(stats) # Install the stats package for the Kruskal-Wallis test.
kruskal.test(percentage_bound ~ antibiotic_names, data = data) # Perform the Kruskal-Wallis test for each antibiotic.
##
## Kruskal-Wallis rank sum test
##
## data: percentage_bound by antibiotic_names
## Kruskal-Wallis chi-squared = 15.329, df = 4, p-value = 0.004066
The Kruskal-Wallis test statistic is 15.329 with 4 degrees of freedom, and the p-value is 0.004066. The p-value of 0.004066 is less than our significance level of 0.05, and thus we will reject the null hypothesis. There is a significant difference in the distribution of the “percentage_bound” variable across different antibiotic groups.
We rejected the null hypothesis with the Kruskal-Wallis test and there is a significant difference somewhere. However, we don’t know which specific groups differ. So we will perform a post-hoc test. When conducting multiple comparisons, the chance of making Type I error (when you reject a null hypothesis that is actually true) increases. The Bonferroni correction adjusts the Dunn’s test by controlling overall alpha level and reduces false positives.
The p-value compared 0.004066 should be 0.05/10 = 0.005 because this is a total of 10 pairwise tests. The p-value of 0.004066 is less than our significance level of 0.005, and thus we will reject the null hypothesis.
library(dunn.test) # Install the Dunn's test for the post-hoc test.
# Perform Dunn's test for multiple comparisons with Bonferroni correction
dunn_result <- dunn.test(data$percentage_bound, g = data$antibiotic_names, method = "bonferroni")
## Kruskal-Wallis rank sum test
##
## data: x and group
## Kruskal-Wallis chi-squared = 15.3286, df = 4, p-value = 0
##
##
## Comparison of x by group
## (Bonferroni)
## Col Mean-|
## Row Mean | Chlora Eryth Penic Strep
## ---------+--------------------------------------------
## Eryth | 1.613558
## | 0.5331
## |
## Penic | -0.119522 -1.733081
## | 1.0000 0.4154
## |
## Strep | 2.569741 0.956182 2.689264
## | 0.0509 1.0000 0.0358
## |
## Tetra | -0.776898 -2.390457 -0.657375 -3.346640
## | 1.0000 0.0841 1.0000 0.0041*
##
## alpha = 0.05
## Reject Ho if p <= alpha/2
Chlora vs Eryth: p-value: 0.5331 Conclusion: Fail to reject H0 (p > 0.005)
Chlora vs Penic: p-value: 1.0000 Conclusion: Fail to reject H0 (p > 0.005)
Chlora vs Strep: p-value: 0.0509 Conclusion: Fail to reject H0 (p > 0.005)
Chlora vs Tetra: p-value: 1.0000 Conclusion: Fail to reject H0 (p > 0.005)
Eryth vs Penic: p-value: 0.4154 Conclusion: Fail to reject H0 (p > 0.005)
Eryth vs Strep: p-value: 1.0000 Conclusion: Fail to reject H0 (p > 0.005)
Eryth vs Tetra: p-value: 0.0841 Conclusion: Fail to reject H0 (p > 0.005)
Penic vs Strep: p-value: 0.0358 Conclusion: Fail to reject H0 (p > 0.005)
Penic vs Tetra: p-value: 1.0000 Conclusion: Fail to reject H0 (p > 0.005)
Strep vs Tetra: p-value: 0.0041 Conclusion: Reject H0 (p ≤ 0.005)
The Kruskal-Wallis test yields a chi-squared statistic of 15.329 with 4 degrees of freedom and a p-value of 0.004066. The null hypothesis (H_0) is that there are no differences between the groups. Since the p-value of 0.004066 is less than the significance level set at 0.005, we reject the null hypothesis. This suggests that there are significant differences in the percentage_bound among the antibiotic groups. After rejecting the null hypothesis in the Kruskal-Wallis test, we performed Dunn’s test to identify which specific groups differ from each other. Risk information loss because we have unpaired tests among paired tests. Use Kruskal-Wallis Test.
Based on the Bonferroni-corrected alpha level of 0.005, the only statistically significant difference observed is between Strep and Tetra antibiotics. For all other pairwise comparisons, there is not enough evidence to suggest a significant difference in the percentage bound.
cor.test(ovine$Conc, ovine$Per_bound)
##
## Pearson's product-moment correlation
##
## data: ovine$Conc and ovine$Per_bound
## t = 0.48069, df = 22, p-value = 0.6355
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.3143772 0.4853835
## sample estimates:
## cor
## 0.1019485
The correlation value is 0.102 which indicates that the relationship is insignificant because it is closer to 0. The null hypothesis claims that true correlation between concentrations of all antibiotics (not for each antibiotic) and Per_bound is equal to 0. On the other hand, the alternative hypothesis claims that true correlation between concentrations of all antibiotics (not for each antibiotic) and Per_bound is not equal to 0. In addition, the p-value is 0.6355 that is bigger than 0.05, we do not have enough evidence to reject the null hypothesis. Therefore, we do not consider the relationship between the Conc and Per_bound to be statistically significant in this dataset.
Multiple testing, which yields specific results indicating whether there is an association or not, is not suitable for this test because it does not allow us to pinpoint exactly which antibiotic is responsible for the observed effect. Analyzing each antibiotic separately is not aligned with our objective.
3-1. Do different antibiotics bind at different rates to serum proteins?
To determine this question we must have a better understanding of what it means to be “different”. In the point of view of statistics, it will be said that two variables are different when its distribution is different. We should then perform a test to validate whether the distribution of the variables are the same or not. In the Bovine Dataset, the variables are percentage_bound values for each antibiotic. There are statistical tools for analyzing it such as, the Kruskal-Wallis test. This was our choice of selection, and the reasons were as aforementioned above; the Kruskal-Wallis Test is suitable when needed to compare the difference in medians between three or more samples. The null hypothesis states,
“There is no significant difference in the distribution of percentage bound among the different antibiotic groups”.
On the other hand, the alternative hypothesis states,
“There is a significant difference in the distribution of percentage bound among the different antibiotic groups”.
From the Kruskal-Wallis Test, we arrived at the conclusion that the rate at which antibiotics bind to serum proteins is significantly different; given the p-value of 0.004066. This indicates that the probability of such difference in percentage bound between antibiotic groups to occur is 0.004066. Thus, it reasonable to say that these values are from different distribution, in other words, we reject the null hypothesis. Especially, we observed that there was a significant different between Strep and Tetra through the post-hoc test. Since we are not dealing with a large sample size, one must be aware that our conclusion might have been the case where we cannot reject the null hypothesis due to insufficient data. ie, a Type II Error (failing to reject the null hypothesis). Then, one must seek more pairs (more data) of antibiotics that would show different distribution of percent bounds.
3-2. For the ovine dataset, is there an association between the concentration of antibiotic that was administered, and the percentage that is bound to the serum?
According to our response above, we have concluded that different antibiotics bind at different rates to serum proteins using the Bovine Dataset. It is then also safe to say that this will be the case for the Ovine Dataset. Keeping this in mind, a Pearson Correlation Test was performed in section 4.2 without separating the dataset by antibiotic. Apparently, this does not provide sufficient information since the percentage bound values differ by antibiotics; just as concentration. We executed the Pearson Correlation test section 4.1.4 for each antibiotic. As a result, Cloxa (-0.967) and Novo (-0.971) both have a strong negative correlation (correlation coefficient very close to -1) between concentration and percentage bound with a significantly small p-value (p = 0.032 < 0.05 and p = 0.029 < 0.05 respectively). This asserts that such correlation would not have had occurred purely by chance. The others such as, Ceph and Doxy respectively have negative correlations of -0.834 and -0.868 respectively, but according to their corresponding p-values (p = 0.166 > 0.05 and p = 0.132 > 0.05 respectively), there is not enough evidence to claim that there is an association between the percentage bound and antibiotic. It could have happened purely by chance. One can consider that the perhaps increasing the sample size can provide more evidence to claim that the negative correlation is valid.
We have observed that the same cow was used for each Penic-Strep (in here 1,2,3,4) and Tetra-Eryth samples (in here 5,6,7,8), which means it is a paired situation, not independent. Nevertheless, considering the entire sample, not all samples are dependent to one another, thus it would be much better to compare the mean differences through an unpaired test even at the cost of losing information on the data. Moreover, all the post-hoc test is done by an unpaired test, even though Penic-Strep and Tetra-Eryth are paired samples. If we were to have performed a paired test, the post-hoc test should be paired as well. One could prepare a alternative study design to resolve this issue in selecting the appropriate test and minimizing loss of information by distinguishing the paired and unpaired samples and executing them as separate tests. The best scenario, if possible, would be to run a multiple test that can consider paired and unpaired situation together. One must also note, that injecting more than one antibiotics for the same cow could interfere the binding rate of another antibiotic, resulting in a confounder. To improvise, it would rather be feasible to use other cows for other antibiotics.