Power Function of a Z test 

Function: calc[ZtestPower] - power function of a Z test 

Calling Sequence:  

ZtestPowerSide, mu[0], sigma, conjugate(X), n, alpha, N, mu, K
Parameters: 

Side - Left, Right, LR. Specifies an appropriate alternative hypothesis, one-sided: Left or Right, two-sided: LR.
mu[0] - null hypothesis.
sigma - standard deviation of the distribution.
 conjugate(X) - sample mean.
 
n - sample size.
 alpha - significance level.
 mu, K - make a choice of mu and the corresponding power K = K(mu)beta(mu),
           where beta is the probability of Type II error , then
 
N - returns the sample size necessary to give the selected power K = K(mu).  

Description: 

  • ZtestPower  computes the critical value(s) of the statistical test, the probability value (p-value) and illustrates the test H[0]:  mu = mu[0] against the alternative hypothesis H[1]:  mu mu[0]  ,  mu mu[0] or  `<>`(mu, mu[0])  graphically by animation. The power function K is scaled to fit the height of the Gaussian curve
 

Examples: 

> restart: with(calc):
 

> ZtestPower(LR,73,7,78.5,10,0.05,N,78,.80);
 

 

 

 

 

`Critical values`
[c[1] = 68.66, c[2] = 77.34]
`Probability value` = 0.130e-1
 
Plot_2d