Tests if a promotion mean \(\mu\) differ from a specific value \(\mu_0\).
\[Z = \frac{\bar{X} - \mu_0}{\sigma}\sqrt{n}\] with \[\bar{X} = \frac{1}{n}\sum_{i=1}^n X_i\]
Rejection \(H_0\) if for the observed value z of Z:
\(z \lt z_{\alpha/2}\) or \(z \gt z_{1-\alpha/2}\)
\(z \gt z_{1-\alpha}\)
\(z \lt z_\alpha\)
\(\rho = 2\phi(-|z|)\)
\(\rho = 1 - \phi(z)\)
\(\rho = \phi(z)\)
To test the hypothesis that the mean systolic blood pressure in a certain population equals 140 mmHg. The standard deviation has a known value of 20 and a data set of 55 patients is available.
#Blood_pressure dataset
no <- seq(1:55)
status <- c(rep(0, 25), rep(1, 30))
mmhg <- c(120,115,94,118,111,102,102,131,104,107,115,139,115,113,114,105,
115,134,109,109,93,118,109,106,125,150,142,119,127,141,149,144,
142,149,161,143,140,148,149,141,146,159,152,135,134,161,130,125,
141,148,153,145,137,147,169)
blood_pressure <-data.frame(no,status,mmhg)
# Calculate sample mean and total sample size
xbar<-mean(blood_pressure$mmhg)
n<-length(blood_pressure$mmhg)
# Set mean value under the nullhypothesis
mu0<-140
# Set known sigma
sigma<-20
# Calculate test statistic and p-values
z<-sqrt(n)*(xbar-mu0)/sigma
p_value_A=2*pnorm(-abs(z))
p_value_B=1-pnorm(z)
p_value_C=pnorm(z)
# Output results
z
## [1] -3.708099
p_value_A
## [1] 0.0002088208
p_value_B
## [1] 0.9998956
p_value_C
## [1] 0.0001044104