A hypothesis is a suggested explanation for a question or problem that could be tested
Hypothesis testing is the act of testing whether the hypothesis is true
2024-03-20
A hypothesis is a suggested explanation for a question or problem that could be tested
Hypothesis testing is the act of testing whether the hypothesis is true
A null Hypothesis (\(H_0\)) is a hypothesis that states there is no differences or relationship between two groups or variables
A alternative hypothesis (\(H_a\)) is a hypothesis that states the prediction propsed to the research question
We have a database of NBA players statistics since 1980 on Kaggle
## X Player height weight collage born ## 1 0 Curly Armstrong 180 77 Indiana University 1918 ## 2 1 Cliff Barker 188 83 University of Kentucky 1921 ## 3 2 Leo Barnhorst 193 86 University of Notre Dame 1924 ## 4 3 Ed Bartels 196 88 North Carolina State University 1925 ## 5 4 Ralph Beard 178 79 University of Kentucky 1927 ## 6 5 Gene Berce 180 79 Marquette University 1926 ## birth_city birth_state ## 1 ## 2 Yorktown Indiana ## 3 ## 4 ## 5 Hardinsburg Kentucky ## 6
## [1] 3
\(H_0: \text{There is no relationship between height and weight}\) \(H_a: \text{Weight and Height positively correlate }\)
To answer the question, Data about weight and heights of a population could be collect and we could propose a linear regression between weight and height to test our hypothesis
Use plotply to plot a scatter plot and add a line to see linear relationship between height and weight
fig<-plot_ly(data=NBA,x=~weight,y=~height,
type="scatter",
mode="markers") %>%
layout(title="Weight vs. Height",xaxis=list(title="Weight(kg)"),
yaxis=list(title="Height(cm)")) %>%
add_lines(x=~weight,
y=lm(height~weight,
data=NBA)$fitted.values,line=list(color="red"))
By posing a question and seeking for the answer and explanation for it, biologist study the living world around us.
The scientific process typically start with a observation which leads to the question then testable hypothesises. Then, experiments will be design to test the hypothesis
Scenerio: Brand A advertise that their fertilizer will help to produce twice as many tomtoes as usual. Should we use brand A ?
Purchase 10 tomatoes and divide it into two groups
Control group: no fertilizer
Experimental group: fertilize with brand A
After 10 weeks, calculate the number of tomatoes produced
Hypothesis: Brand A will produce more tomatoes
Brand A produce 20 tomatoes while group with no fertilizer produce 30 tomatoes. This is a sufficient evidence to reject the hypothesis
Action: Using fertilizer may not produce larger yield.Future experiment could be conducted with more fertilizer brands and larger sample size to have a more valid conlusion
Disclaimer: This is just a basis example to go over the concept of hypothesis testing. In fact, to decide whether to reject the null hypothesis or not, a statistic test such as t-test, z-test, chi square test …. may be conducted. At the end, there will be a value called p-value will help to make the decision
Context: A experiment was conducted to test if the cross of two plants follow the thereotical proprtion
## Phenotype Observed Expected ## 1 Round, Yellow 315 312.75 ## 2 Round, Green 108 104.25 ## 3 Wrinkled, Yellow 101 104.25 ## 4 Wrinkled, Green 32 34.75
Hypothesis: The cross follow the theoretical proportion 9:3:3:1
\(\chi^2=\frac{(315-312.75)^2}{312.75} + \frac{(108-104.25)^2}{104.25}+\frac{(101-104.25)^2}{104.25}+\frac{(32-34.75)^2}{34.75}=0.47\)
After having Chi-Square value, we will use chi-square table to find p-value and compare with 0.05. If it is greater than 0.05, we accept the hypothesis
Result: p-value > 0.9 -> do not reject the hypothesis
By visualizing the data, we could also observe that the expected values and observed values are really close to each other
## Using Phenotype as id variables