ss4dp: The required sample size for estimating a single difference...

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

View source: R/ss4dp.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ss4dp(
  N,
  P1,
  P2,
  DEFF = 1,
  conf = 0.95,
  cve = 0.05,
  me = 0.03,
  T = 0,
  R = 1,
  plot = FALSE
)

Arguments

N

The maximun population size between the groups (strata) that we want to compare.

P1

The value of the first estimated proportion.

P2

The value of the second estimated proportion.

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.

me

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

T

The overlap between waves. By default T = 0.

R

The correlation between waves. By default R = 1.

plot

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

Details

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

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

Where

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

and

S^2 = (P1 * Q1 + P2 * Q2) * (1 - (T * R)) * DEFF

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

n = \frac{S^2}{p^2cve^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
20
ss4dp(N=100000, P1=0.5, P2=0.55, cve=0.05, me=0.03)
ss4dp(N=100000, P1=0.5, P2=0.55, cve=0.05, me=0.03, plot=TRUE)
ss4dp(N=100000, P1=0.5, P2=0.55, DEFF=3.45, conf=0.99, cve=0.03, me=0.03, plot=TRUE)
ss4dp(N=100000, P1=0.5, P2=0.55, DEFF=3.45, T=0.5, R=0.5, conf=0.99, cve=0.03, me=0.03, plot=TRUE)

#############################
# Example with BigLucy data #
#############################
data(BigLucy)
attach(BigLucy)

N1 <- table(SPAM)[1]
N2 <- table(SPAM)[2]
N <- max(N1,N2)
P1 <- prop.table(table(SPAM))[1]
P2 <- prop.table(table(SPAM))[2]
# The minimum sample size for simple random sampling
ss4dp(N, P1, P2, DEFF=1, conf=0.99, cve=0.03, me=0.03, plot=TRUE)
# The minimum sample size for a complex sampling design
ss4dp(N, P1, P2, DEFF=3.45, conf=0.99, cve=0.03, me=0.03, plot=TRUE)

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