drill.svq: drill down (cross tabulate a svq)

Description Usage Arguments Details Value Stratified samples

View source: R/drill.R

Description

drill.svq is the drill implementation for class svq

Usage

1
drill.svq(q, by, strat = NULL, N = NULL, ...)

Arguments

q

a svq object

by

a factor to split q by (usually a "select one" svq)

strat

an optional factor of strata for stratified samples

N

the vector of population values for each stratum

Details

The svq is split by the factor by and cross sectional measurements are made for for each subgroup. The measurement made is determined by the type of the svq. "select one" questions generate cross tabulations of responses in each subgroup and overall. One table will be generated for the counts, a second for an estimate of the proportion of each subgroup responding with each choice, and a third for the standard error of each estimate. "select all that apply" (select_multi) questions are similar but the proportions will not, in general, add up to one. "decimal" and "integer" questions will generate a table with the mean, the standard deviation, the standard error (others to be added). The last column in each table will give the totals. "date" questions will generate a table of frequencies.

Optionally, q can be a list of svq objects of the same length and question type, and drill.svq will return a list of results. by can also be a list of factors, with a similar result, but the implementation of this is a little rough.

Value

a list of class svqdrill with the following elements:

for "select" types:

for "integer" and "decimal" types:

for "date" types:

Stratified samples

If the data was collected using stratified sampling, estimates and standard errors can be calculated accordingly by setting strat and N. strat should be a factor of the same length as q that can be used to split the data into the strata. N is a vector of length length(levels(strat)) with the population size corresponding to each stratum. If N is specified as an integer and strat is NULL, the finite population correction will be applied to the error estimates.


mlgrm/svyr documentation built on May 11, 2017, 9:57 p.m.