cluster_gen_separate: Generate cluster samples with individual questionnaires

View source: R/cluster_gen_separate.R

cluster_gen_separateR Documentation

Generate cluster samples with individual questionnaires

Description

This is a subfunction of 'cluster_gen' that performs cluster sampling, with the twist that each cluster level has its own questionnaire.

Usage

cluster_gen_separate(
  n_levels,
  n,
  N,
  sum_pop,
  calc_weights,
  sampling_method,
  cluster_labels,
  resp_labels,
  collapse,
  n_X,
  n_W,
  cat_prop,
  c_mean,
  sigma,
  cor_matrix,
  rho,
  theta,
  whitelist,
  verbose,
  ...
)

Arguments

n_levels

number of cluster levels

n

numeric vector with the number of sampled observations (clusters or subjects) on each level

N

list of numeric vector with the population size of each *sampled* cluster element on each level

sum_pop

total population at the lowest level (sampled or not)

calc_weights

if 'TRUE', sampling weights are calculated

sampling_method

can be "SRS" for Simple Random Sampling or "PPS" for Probabilities Proportional to Size, "mixed" to use SRS for students and PPS otherwise or a vector with the sampling method for each level

cluster_labels

character vector with the names of each cluster level

resp_labels

character vector with the names of the questionnaire respondents on each level

collapse

if 'TRUE', function output contains only one data frame with all answers

n_X

list of 'n_X' per cluster level

n_W

list of 'n_W' per cluster level

cat_prop

list of cumulative proportions for each item. If theta = TRUE, the first element of cat_prop must be a scalar 1, which corresponds to the theta.

c_mean

vector of means for the continuous variables or list of vectors for the continuous variables for each level

sigma

vector of standard deviations for the continuous variables or list of vectors for the continuous variables for each level

cor_matrix

Correlation matrix between all variables (except weights)

rho

estimated intraclass correlation

theta

if TRUE, the first continuous variable will be labeled 'theta'. Otherwise, it will be labeled 'q1'.

whitelist

used when 'n = select(...)', determines which PSUs get to generate questionnaires

verbose

if 'TRUE', prints output messages

...

Additional parameters to be passed to 'questionnaire_gen()'

See Also

cluster_gen cluster_gen_together


tmatta/lsasim documentation built on Aug. 25, 2023, 5:50 p.m.