b4dm: Statistical power for a hyphotesis testing on a difference of...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/b4dm.R

Description

This function computes the power for a (right tail) test of difference of means

Usage

1
b4dm(N, n, mu1, mu2, sigma1, sigma2, D, DEFF = 1, conf = 0.95, plot = FALSE)

Arguments

N

The population size.

n

The sample size.

mu1

The value of the estimated mean of the variable of interes for the first population.

mu2

The value of the estimated mean of the variable of interes for the second population.

sigma1

The value of the estimated variance of the variable of interes for the first population.

sigma2

The value of the estimated mean of a variable of interes for the second population.

D

The value of the null effect.

DEFF

The design effect of the sample design. By default DEFF = 1, which corresponds to a simple random sampling design.

conf

The statistical confidence. By default conf = 0.95.

plot

Optionally plot the power achieved for an specific sample size.

Details

We note that the power is defined as:

1-Φ(Z_{1-α} - \frac{ (D - (μ_1 - μ_2))}{√{\frac{1}{n}(1-\frac{n}{N})S^2}})

where

S^2 = DEFF (σ_1^2 + σ_2^2

Value

The power of the test.

Author(s)

Hugo Andres Gutierrez Rojas <hagutierrezro at gmail.com>

References

Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas

See Also

ss4p

Examples

1
2
3
4
b4dm(N = 100000, n = 400, mu1 = 5, mu2 = 5, sigma1 = 10, sigma2 = 15, D = 5)
b4dm(N = 100000, n = 400, mu1 = 5, mu2 = 5, sigma1 = 10, sigma2 = 15, D = 0.03, plot = TRUE)
b4dm(N = 100000, n = 4000, mu1 = 5, mu2 = 5, sigma1 = 10, sigma2 = 15, 
D = 0.05, DEFF = 2, conf = 0.99, plot = TRUE)

Example output

Loading required package: TeachingSampling
Loading required package: timeDate
With the parameters of this function: N = 1e+05 n =  400 mu1 = mu1 = 5 mu2 = 5 sigma1 = 10 sigma2 = 15 D = 5 DEFF =  1 conf = 0.95 . 
The estimated power of the test is  99.99545 . 
 
$Power
[1] 99.99545

With the parameters of this function: N = 1e+05 n =  400 mu1 = mu1 = 5 mu2 = 5 sigma1 = 10 sigma2 = 15 D = 0.03 DEFF =  1 conf = 0.95 . 
The estimated power of the test is  5.353487 . 
 
$Power
[1] 5.353487

With the parameters of this function: N = 1e+05 n =  4000 mu1 = mu1 = 5 mu2 = 5 sigma1 = 10 sigma2 = 15 D = 0.05 DEFF =  2 conf = 0.99 . 
The estimated power of the test is  1.391213 . 
 
$Power
[1] 1.391213

samplesize4surveys documentation built on Jan. 18, 2020, 1:11 a.m.