simulate_response_age_continuous: Simulate the true response to a continuous numerical response...

Description Usage Arguments Value Examples

Description

Simulate the true response to a continuous numerical response question in a given population with specified characteristics for sex, race/ethnicity, age, and geography

Usage

1
2
simulate_response_age_continuous(geovector, lambda_geography, lambda_sex,
  lambda_raceethnicity, lambda_age)

Arguments

geovector

A vector of geographies specified as a two letter abbreviation or a 5-digit FIPS code. Each geography must be the entire U.S. (US) or a single state (for example, TX or CA) or a single county (for example, 49035). For example, c("TX", "UT").

lambda_geography

Numeric vector specifying lambda (Poisson distribution) for the survey respondents by geography in the same bins as geovector.

lambda_sex

Numeric vector specifying lambda (Poisson distribution) for the survey respondents by sex in the order male, then female, for example, c(25, 75).

lambda_raceethnicity

Numeric vector specifying lambda for the survey respondents by race/ethnicity in the order white alone, Hispanic or Latino, black alone, Asian alone, and other, for example, c(90, 10, 50, 50, 50).

lambda_age

Numeric vector specifying lambda for survey respondents by age in the following bins: under 18 years, 18 to 24 years, 25 to 44 years, 45 to 64 years, 65 years and over, for example, c(50, 55, 65, 75, 85).

Value

A data frame with 3 columns (value, answer, and result) that tabulates the true response to the continuous, numerical survey question in the given population.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
geovector <- c("WI", "WV")
lambda_geography <- c(50, 10)
# lambda_sex specifies the response weights of men/women
# in this example, women have a higher mean response than men
lambda_sex <- c(25, 75)
lambda_raceethnicity <- c(90, 10, 50, 50, 50)
lambda_age <- c(50, 60, 70, 75, 80)
opinionDF <- simulate_response_age_continuous(geovector,
                                             lambda_geography, 
                                             lambda_sex, 
                                             lambda_raceethnicity,
                                             lambda_age)

heathermkrause/WWC documentation built on May 17, 2019, 3:20 p.m.