surveyplanning (version 4.0)

MoE_P: Margin of error for proportion

Description

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

Usage

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

Value

The estimate of margin of error for proportion.

See Also

expvar, optsize, MoE_Y

Examples

Run this code
# NOT RUN {
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

# }

Run the code above in your browser using DataLab