Section 1: Introduction

In this project, I will be observing the relationship between calories and sugar in 36 different cereals. I will: 1. Provide a scatterplot displaying calories vs. sugar. 2. Conduct a test of the null hypothesis that there is no relationship between calories and sugar. I will provide the p-value and 95% confidence interval resulting from this test. 3. Using the BayesianFirstAid package, I will perform a Bayesian correlation test to estimate the true population correlation coefficient and the uncertainty of this estimate. 4. Compare the p-value from my hypothesis test with the Bayesian probability that the true correlation is negative. 5. Compare the 95% cofidence interval from my hypothesis test with the Bayesian 95% credible interval.

Section 2: Scatterplot of Calories VS Sugar

## `geom_smooth()` using formula = 'y ~ x'

The correlation coefficient for the relationship between calories and sugar is:

## [1] 0.5154008

Section 3: Hypothesis Test

## 
##  Pearson's product-moment correlation
## 
## data:  cerealData$Sugar and cerealData$Calories
## t = 3.5069, df = 34, p-value = 0.001296
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2249563 0.7217280
## sample estimates:
##       cor 
## 0.5154008

Based on this test of the null hypothesis that there is no relationship between calories and sugar, it appears the P-value is 0.001296, meaning there is a very low chance that the null hypothesis is true. The 95% confidence interval is 0.2249563 to 0.7217280, meaning we are 95% sure that the true correlation bewteen the variables lies within these bounds.

Section 4: Bayesian Correlation Test

## Loading required package: usethis
## Loading required package: rjags
## Loading required package: coda
## Linked to JAGS 4.3.2
## Loaded modules: basemod,bugs
## 
##  Bayesian First Aid Pearson's Correlation Coefficient Test
## 
## data: Sugar and Calories (n = 36)
## Estimated correlation:
##   0.49 
## 95% credible interval:
##   0.21 0.73 
## The correlation is more than 0 by a probability of 0.998 
## and less than 0 by a probability of 0.002

Section 5: P-Value Comparison

The P-value from my hypothesis test was 0.001296, and the Bayesian probability the the true correlation is negative was 0.002. Becuase these values are so similar, we can assume the true probability of the null hypothesis being true is approximately 0.2%.

Section 6: Confidence Interval Comparison

The confidence interval from my hypothesis test was 0.2249563 to 0.7217280, and the Bayesian 95% credible interval was 0.21 to 0.73. Again, because these values are so similar, we can assume the true 95% confidence interval is approximately 0.21 to 0.73.