MoE_P: Margin of error for proportion

Description Usage Arguments Value See Also Examples

View source: R/MoE_P.R

Description

The function computes margin of error for proportion. The calculation takes into proportion, expected response rate and design effect.

Usage

1
MoE_P(P = 0.5, n, pop, confidence = 0.95, R = 1, deff_sam = 1, deff_est = 1)

Arguments

P

The expected proportion for variable of interest.

n

The expected sample size.

pop

Population size.

R

The expected response rate (optional). If not defined, it is assumed to be 1 (full-response).

deff_sam

The expected design effect of sample design for the estimates (optional). If not defined, it is assumed to be 1.

deff_est

The estimated design effect of estimator for the estimates (optional). If not defined, it is assumed to be 1.

confidence

Optional

positive value for confidence interval. This variable by default is 0.95.

Value

The estimate of margin of error for proportion.

See Also

expvar, optsize, MoE_Y

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library("data.table")
n <- 100
pop <- 1000

MoE_P(P = 0.5, n = n, pop = pop)

DT <- data.table(P = seq(0, 1, 0.01))
DT[, Y := round(pop * P)]
DT[, AMoE := MoE_P(P, n = 100, pop = 1000)]
DT[Y > 0, RMoE := AMoE / Y]
DT

surveyplanning documentation built on July 1, 2020, 10:38 p.m.