category: Create weighting category

Description Usage Arguments Value Examples

View source: R/category.R

Description

This function creates an individual weighting category with known marginal probabilities. (E.g., age group, eye color.) One or more of these are built and fed into universe().

Usage

1
category(name, buckets, targets, sum.1 = FALSE)

Arguments

name

Name given to weighting category, character. Must have exact match in the column names of data to be weighted.

buckets

Vector corresponding to the "buckets" in which your category can be classified.

targets

Numeric vector of the proportions each element of `buckets` represents in the population.

sum.1

Whether or not to force inputs to `targets` to sum to one.

Value

A list with special class category.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
category(
  name = "costume",
  buckets = c("Bat Man", "Cactus"),
  targets = c(0.645, 0.355)
)

category(
  name = "seeds",
  buckets = c("Tornado", "Bird", "Earthquake"),
  targets = c(0.3333, 0.3333, 0.3333),
  sum.1 = TRUE
)

ttrodrigz/iterake documentation built on July 1, 2020, 7:46 a.m.