# Algorithms (PSS: Two-Variance Test)

## Contents

### Power

#### Calculating power with Levene's method

Let $\rho =\frac{{\sigma }_{1}}{\sigma_2}$

One-sided power:$H_0:\frac{{\sigma }_{1}}{\sigma_2}\ge 1$

$Power=F(-\frac{t(\alpha ,n_1+n_2)}{\theta }-\frac{(\rho -1)}{\sqrt{\frac{\pi }{2}-1}\sqrt{\rho^{2}/{n_1}+1/n_2}})$

One-sided power:$H_0:\frac{{\sigma }_{1}}{\sigma_2}\le 1$

$Power=1-F(\frac{t(\alpha ,n_1+n_2)}{\theta }-\frac{(\rho -1)}{\sqrt{\frac{\pi }{2}-1}\sqrt{\rho^{2}/{n_1}+1/n_2}})$

Two-sided power $H_0:\frac{{\sigma }_{1}}{\sigma_2}=1$

$Power=1-F(\frac{t(\alpha/2 ,n_1+n_2)}{\theta }-\frac{(\rho -1)}{\sqrt{\frac{\pi }{2}-1}\sqrt{\rho^{2}/{n_1}+1/n_2}})+F(-\frac{t(\alpha/2 ,n_1+n_2)}{\theta }-\frac{(\rho -1)}{\sqrt{\frac{\pi }{2}-1}\sqrt{\rho^{2}/{n_1}+1/n_2}})$

$t(\alpha ,n_1+n_2)\!$:upper percentile of the t distribution with n1+n2-2 degrees of freedom

$\theta=\sqrt{\frac{\rho^{2}+n_1/n_2}{n_1\rho^{2}/n_2+1}}$

F:the cumulative distribution function of the standard normal distribution

#### Calculating power with the F Test method

Let $\rho =\frac{{\sigma }_{1}}{\sigma_2}$

One-sided power:$H_0:\frac{{\sigma }_{1}}{\sigma_2}\ge 1$

$Power=F_{k1,k2}[V_{k1,k2,\alpha }/\rho ^2]\!$

One-sided power:$H_0:\frac{{\sigma }_{1}}{\sigma_2}\le 1$

$Power=1-F_{k1,k2}[V_{k1,k2,1-\alpha }/\rho ^2]\!$

Two-sided power $H_0:H_0:\frac{{\sigma }_{1}}{\sigma_2}=1$

$Power=1-F_{k1,k2}[V_{k1,k2,1-\alpha/2 }/\rho ^2]+F_{k1,k2}[V_{k1,k2,\alpha/2 }/\rho ^2]\!$

$F_{k1,k2}\!$:distribution function of the F distribution with k1 and k2 degrees of freedom; k1 and k2 = n -1

$V_{k1,k2,C}\!$:inverse CDF evaluated at C for a F distribution with k1 and k2 degrees of freedom

$\alpha\!$:significance level

### Sample Size

Origin uses an iterative algorithm with the power equation. At each iteration,the power for a trial sample size are evaluated and iteration stops when the power evaluated reaches the values which corresponding to an integer sample size, and which is nearest to, yet greater than, the target value.