Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mu <- 200 # mean value
- sigma <- 20 # standard deviation
- n <- 50 # sample size
- x_bar <- 195 # sample mean
- # Null Hypothesis (H0): The mean volume of the energy drink per can is equal to 200 ml. This assumes that the company's claim is true. Mathematically, this can be denoted as μ = 200, where μ represents the mean volume of the energy drink per can.
- # Alternative Hypothesis (H1): The mean volume of the energy drink per can is not equal to 200 ml. This assumes that the company's claim is not true. Mathematically, this can be denoted as μ ≠ 200.
- z <- (x_bar - mu) / (sigma / sqrt(n)) # calculate z-score
- p_value <- 2*(1 - pnorm(abs(z))) # two-tailed test
- print(p_value)
Advertisement
Add Comment
Please, Sign In to add comment