Learn R Programming

surveyplanning (version 4.0)

MoE_Y: Margin of error for count

Description

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

Usage

MoE_Y(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.

confidence

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

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.

Value

The estimate of margin of error for count.

See Also

expvar, optsize, MoE_P

Examples

Run this code
# NOT RUN {
library("data.table")
n <- 100
pop <- 1000

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

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

# }

Run the code above in your browser using DataLab