Learn R Programming

sampler (version 0.2.4)

spro: Calculate proportion and margin of error (stratified sample)

Description

Calculate proportion and margin of error (stratified sample)

Usage

spro(fulldf, sampdf, strata, col_name, ci = 95, na = "")

Arguments

fulldf

object containing original data frame used to draw sample

sampdf

object containing data frame on which to perform analysis

strata

variable in both data frames by which to stratify

col_name

variable in data frame for which you want to calculate proportion and margin of error

ci

(optional) confidence level for establishing a confidence interval using z-score (defaults to 95; restricted to 80, 85, 90, 95 or 99 as input)

na

(optional) value that you want to filter and exclude (defaults to include everything)

Value

Returns table of responses (n), proportions, margins of error, lower and upper bounds by factor for a given variable in a stratified sample

References

[1] Sampling Design & Analysis, S. Lohr, 1999, 4.6 & 4.7

Examples

Run this code
# NOT RUN {
spro(fulldf=albania, sampdf=opening, strata=qarku, col_name=openTime, ci=95, na="n/a")
# }

Run the code above in your browser using DataLab