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
 3
 4
 5
 6
 7
 8
 9
10
ss4m(
  N,
  mu,
  sigma,
  DEFF = 1,
  conf = 0.95,
  error = "cve",
  delta = 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.

error

The type of error you want to minimize.

delta

The magnitude of the error you want to minimize.

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 <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

e4p

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
ss4m(N=10000, mu=10, sigma=2, DEFF = 2, error = "cve", delta = 0.03, plot=TRUE)
ss4m(N=10000, mu=10, sigma=2, DEFF = 2, error = "me", delta = 1, plot=TRUE)
ss4m(N=10000, mu=10, sigma=2, DEFF = 2, error = "rme", delta = 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, error = "rme", delta = 0.03, plot=TRUE)
# The minimum sample size for a complex sampling design
ss4m(N, mu, sigma, DEFF=1, conf=0.95, error = "me", delta = 5, plot=TRUE)
# The minimum sample size for a complex sampling design
ss4m(N, mu, sigma, DEFF=3.45, conf=0.95, error = "rme", delta = 0.03, plot=TRUE)

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