- Hypothesis testing is a statistical method used to make decisions based on data.
- It involves testing an assumption about a population parameter.
- Example: Does a new drug improve patient outcomes?
2025-03-16
\(H_0: \mu = 50\) (Mean is 50) - \(H_A: \mu \neq 50\) (Mean is different from 50)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
set.seed(123) data <- data.frame(values = rnorm(30, mean=50, sd=10)) test_result <- t.test(data$values, mu=50) test_result
## ## One Sample t-test ## ## data: data$values ## t = -0.26299, df = 29, p-value = 0.7944 ## alternative hypothesis: true mean is not equal to 50 ## 95 percent confidence interval: ## 45.86573 53.19219 ## sample estimates: ## mean of x ## 49.52896
ggplot(data, aes(x=values)) + geom_histogram(binwidth=5, fill="blue", alpha=0.5, color="black") + geom_vline(xintercept=50, linetype="dashed", color="red") + ggtitle("Histogram of Sample Data")