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

Description Usage Arguments Value References Examples

View source: R/spro.R

Description

Calculate proportion and margin of error (stratified sample)

Usage

1
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

1
spro(fulldf=albania, sampdf=opening, strata=qarku, col_name=openTime, ci=95, na="n/a")

Example output

  openTime   n   midpoint        me       lower     upper
1     7_00 408 78.3676959 3.3312036 75.03649228 81.698900
2    7-730  92 17.6001119 3.0807742 14.51933775 20.680886
3    730-8  17  3.2674097 1.4554306  1.81197911  4.722840
4    8-830   4  0.7647825 0.7085333  0.05624911  1.473316

sampler documentation built on Sept. 15, 2019, 5:02 p.m.