Title: | Utilities for Sampling |
---|---|
Description: | Interactive tools for generating random samples. Users select an .xlsx, .csv, or delimited .txt file with population data and are walked through selecting the sample type (Simple Random Sample or Stratified), the number of backups desired, and a "stratify_on" value (if desired). The sample size is determined using a normal approximation to the hypergeometric distribution based on Nicholson (1956) <doi:10.1214/aoms/1177728270>. An .xlsx file is created with the sample and key metadata for reference. It is menu-driven and lets users pick an output directory. See vignettes for a detailed walk-through. |
Authors: | Paul West [aut, cre] |
Maintainer: | Paul West <[email protected]> |
License: | GPL-3 |
Version: | 0.9.6.2 |
Built: | 2025-02-16 03:16:03 UTC |
Source: | https://github.com/km4ivi/whsample |
sampler
generates Simple Random or Stratified samples
ci |
the required confidence level |
me |
the margin of error |
p |
the expected probability of occurrence |
backups |
the number of available replacements |
seed |
the random number seed |
Writes samples to an Excel workbook and generates a report summary.
sampler
lets users select an Excel or delimited text (.csv or .txt) data file and the type of sample they prefer (Simple Random Sample, Stratified Random Sample, or Tabbed Stratified Sample with each stratum in a different Excel worksheet).
if(interactive()){ sampler(backups=3, p=0.6) }
if(interactive()){ sampler(backups=3, p=0.6) }
ssize
takes a population size and returns a sample size
ssize(N, ci = 0.95, me = 0.07, p = 0.5)
ssize(N, ci = 0.95, me = 0.07, p = 0.5)
N |
The population size |
ci |
The desired confidence interval (default is 0.95) |
me |
The margin of error (default: +/- 0.07) |
p |
The expected rate of occurrence (default: 0.50) |
Returns the estimated minimum sample size, rounded up to the nearest integer.
ssize
uses a normal approximation of the hypergeomtric distribution approach.
ssize(1000) ssize(1000, ci=0.90, p=0.60)
ssize(1000) ssize(1000, ci=0.90, p=0.60)