Generate a probability sample from a sampling frame
sam
takes a sample size, a 'population' data frame, a formula specifying the count variable and
stratification variable(s), an optional expression to select a subset of the
population, relative sampling factor and the probability parameter for
a binomial response. It generates a sample based on these parameters.
1 2 | sam(N = 1, pop = popagetable, fmla = population ~ sex + age +
raceethnicity + state, subset, fac, prob)
|
N |
sample size (default: 1) |
pop |
a data frame giving frequencies in each stratum defined by a combination of
variables. The stratification can be finer than the stratification given in |
fmla |
a formula of the form |
subset |
an expression that selects a subset, e.g. state == 'AK' & age > '5 to 9 years' (Default: no subsetting) |
fac |
a data frame or a list of data frames whose variables include some subset of variables in the
right hand side of |
prob |
a data frame or a list of data frames similar to |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.