weight_responses: Weight responses

View source: R/weight_responses.R

weight_responsesR Documentation

Weight responses

Description

calculates sampling weights for the questionnaire responses

Usage

weight_responses(
  cluster_bg,
  n_obs,
  N,
  lvl,
  sublvl,
  previous_sublvl,
  sampling_method,
  cluster_labels,
  resp_labels,
  sum_pop,
  verbose
)

Arguments

cluster_bg

dataset with background questionnaire

n_obs

list with the number of elements per level

N

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

lvl

number of the current level

sublvl

number of the current sublevel (element within level)

previous_sublvl

number of the sublevel of the parent level

sampling_method

can be "SRS" for Simple Random Sampling or "PPS" for Probabilities Proportional to Size

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

sum_pop

total population at each level (sampled or not)

verbose

if 'TRUE', prints output messages

Value

Input data frame ('cluster_bg') with three new columns for the sampling weights.


lsasim documentation built on Aug. 22, 2023, 5:09 p.m.