ss4m: The required sample size for estimating a single mean

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

View source: R/ss4m.R

Description

This function returns the minimum sample size required for estimating a single mean subjec to predefined errors.

Usage

1
2
ss4m(N, mu, sigma, DEFF = 1, conf = 0.95, cve = 0.05, rme = 0.03,
  plot = FALSE)

Arguments

N

The population size.

mu

The value of the estimated mean of a variable of interest.

sigma

The value of the estimated standard deviation of a variable of interest.

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. By default conf = 0.95.

cve

The maximun coeficient of variation that can be allowed for the estimation.

rme

The maximun relative margin of error that can be allowed for the estimation.

plot

Optionally plot the errors (cve and margin of error) against the sample size.

Details

Note that the minimun sample size to achieve a relative margin of error \varepsilon is defined by:

n = \frac{n_0}{1+\frac{n_0}{N}}

Where

n_0=\frac{z^2_{1-\frac{alpha}{2}}S^2}{\varepsilon^2 μ^2}

and

S^2=σ^2 DEFF

Also note that the minimun sample size to achieve a coefficient of variation cve is defined by:

n = \frac{S^2}{\bar{y}_U^2 cve^2 + \frac{S^2}{N}}

Author(s)

Hugo Andres Gutierrez Rojas <hugogutierrez at usantotomas.edu.co>

References

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

See Also

e4p

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
ss4m(N=10000, mu=10, sigma=2, cve=0.05, rme=0.05)
ss4m(N=10000, mu=10, sigma=2, cve=0.05, rme=0.03, plot=TRUE)
ss4m(N=10000, mu=10, sigma=2, DEFF=3.45, cve=0.05, rme=0.03, plot=TRUE)

##########################
# Example with Lucy data #
##########################

data(Lucy)
attach(Lucy)
N <- nrow(Lucy)
mu <- mean(Income)
sigma <- sd(Income)
# The minimum sample size for simple random sampling
ss4m(N, mu, sigma, DEFF=1, conf=0.95, cve=0.03, rme=0.03, plot=TRUE)
# The minimum sample size for a complex sampling design
ss4m(N, mu, sigma, DEFF=3.45, conf=0.95, cve=0.03, rme=0.03, plot=TRUE)

Example output

Loading required package: TeachingSampling
Loading required package: timeDate
With the parameters of this function: N = 10000 mu = 10 sigma = 2 DEFF =  1 conf = 0.95 .

             The estimated sample size to obatin a maximun coefficient of variation of 5 % is n= 16 .
             The estimated sample size to obatin a maximun margin of error of 5 % is n= 62 . 
 
$n.cve
[1] 16

$n.rme
[1] 62

With the parameters of this function: N = 10000 mu = 10 sigma = 2 DEFF =  1 conf = 0.95 .

             The estimated sample size to obatin a maximun coefficient of variation of 5 % is n= 16 .
             The estimated sample size to obatin a maximun margin of error of 3 % is n= 168 . 
 
$n.cve
[1] 16

$n.rme
[1] 168

With the parameters of this function: N = 10000 mu = 10 sigma = 2 DEFF =  3.45 conf = 0.95 .

             The estimated sample size to obatin a maximun coefficient of variation of 5 % is n= 55 .
             The estimated sample size to obatin a maximun margin of error of 3 % is n= 557 . 
 
$n.cve
[1] 55

$n.rme
[1] 557

With the parameters of this function: N = 2396 mu = 432.0605 sigma = 266.9792 DEFF =  1 conf = 0.95 .

             The estimated sample size to obatin a maximun coefficient of variation of 3 % is n= 361 .
             The estimated sample size to obatin a maximun margin of error of 3 % is n= 970 . 
 
$n.cve
[1] 361

$n.rme
[1] 970

With the parameters of this function: N = 2396 mu = 432.0605 sigma = 266.9792 DEFF =  3.45 conf = 0.95 .

             The estimated sample size to obatin a maximun coefficient of variation of 3 % is n= 909 .
             The estimated sample size to obatin a maximun margin of error of 3 % is n= 1681 . 
 
$n.cve
[1] 909

$n.rme
[1] 1681

samplesize4surveys documentation built on July 24, 2018, 9:04 a.m.