survey_size: Calculate the sample size of a survey.

Description Usage Arguments Value Examples

View source: R/survey_size.R

Description

survey_size calculates the sample size of a survey based on user imputs of margin of error, confidence level, response distribution, and population size.

Usage

1
2
survey_size(sample_size = NULL, error_margin = 0.05, conf_level = 0.95,
  response_distr = 0.5, population_size = 1e+05)

Arguments

error_margin

The amount of error that can be tolerated, where the margin of error is how close the calculated value is to the <e2><80><9c>true value<e2><80><9d> for the population. The smaller the margin of error, the closer the calculated value will be to the "true value" at the specified confidence level. Defaults to 0.05 (5%).

conf_level

The amount of uncertainty that can be tolerated, where the confidence level is the certainty with which the sample accurately reflects the population, within the specified margin of error. Defaults to 0.95 (95%).

response_distr

The expected distribution of responses to a binary question. Defaults to 0.5: either answer is equally likely to be chosen.

population_size

Estimated size of the population being surveyed. Defaults to NULL. The function produce an error if a population_size value is not specified.

Value

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# Calculate sample size using the defaults
survey_size(population_size = 20000) # sample size = 377

# Calculate the sample size required for a survey of a group of
# specialist physicians (population = 450), with a margin of error of
# 10%, and a confidence level of 99%. Assume the response distribution
# is 50%.
survey_size(error_margin = 0.1, conf_level = 0.99, population_size = 450)
# sample size = 121

## End(Not run)

kamermanpr/surveytools documentation built on May 20, 2019, 7:19 a.m.