897bhgy

Untitled

Jul 13th, 2023
609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.68 KB | Source Code | 0 0
  1. mu <- 200 # mean value
  2. sigma <- 20 # standard deviation
  3. n <- 50 # sample size
  4. x_bar <- 195 # sample mean
  5.  
  6. # 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.
  7. # 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.
  8.  
  9.  
  10. z <- (x_bar - mu) / (sigma / sqrt(n)) # calculate z-score
  11.  
  12. p_value <- 2*(1 - pnorm(abs(z))) # two-tailed test
  13. print(p_value)
  14.  
Advertisement
Add Comment
Please, Sign In to add comment