This is a presentation on Hypothesis Testing, using the dataset Trees
01February24
This is a presentation on Hypothesis Testing, using the dataset Trees
Step 1:
Determine the Research Question/Hypotheses
-What is you null hypothesis (Ho), and your alternative hypothesis (Ha)
Step 2:
Preform an appropriate statistical test
Step 3:
Decide whether to reject or fail to reject null hypothesis
Step 4:
Report your conclusion with context to the problem
-Ho: There is no correlation between a tree’s girth and volume.
-Ha: There is a correlation between a tree’s girth and volume.
We test the null hypothesis to determine if there is enough evidence to reject it, and if there is, we favor the alternative hypothesis. Rejecting the null hypothesis suggests the alternative hypothesis may be correct.
mod = lm(Volume ~ Girth, data=trees)
x = trees$Girth; y = trees$Volume
xax <- list(
title ="Girth",
titlefont = list(family="Modern Computer Roman"))
yax <- list(
title = "Volume",
titlefont = list(family="Modern Computer Roman"),
range = c(0,80))
fig <- plot_ly(x=x, y=y, type="scatter", mode="markers", name="data point",
width=800, height=430) %>%
add_lines(x = x, y = fitted(mod), name="line of best fit") %>%
layout(xaxis = xax, yaxis = yax) %>%
layout(margin=list(
l=150,
r=50,
b=20,
t=40 ))
config(fig, displaylogo=FALSE)
\({r = {{\sum(Xi - \bar{x}) (Yi - \bar{y})} \over \sqrt{\sum(Xi - \bar{x})^2 (Yi - \bar{y})^2}}}\)
X Values
\(\sum = 410.7\)
\(\bar{X} = 13.248\)
\(\sum(x-\bar{x})^2 = SSx = 295.437\)
Y Values
\(\sum = 935.3\)
\(\bar{Y} = 30.171\)
\(\sum(y-\bar{y})^2 = SSy = 8106.084\)
X and Y combined
\(N = 31\)
\(\sum(X-\bar{X})(Y-\bar{Y})=1496.644\)
The value of our correlation coefficient is
\(R = 0.9671\)
This means there is a strong positive correlation between a tree’s girth and its volume.
Thus, we reject the null hypothesis.
## `geom_smooth()` using formula = 'y ~ x'
With our R value being so close to one, we can confidently say that there is a strong positive correlation between a tree’s girth and its volume. So we reject our null hypothesis.