## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----eval = FALSE------------------------------------------------------------- # library(BuSuCo) # # # Generate synthetic business data # DATA <- Gen.Data( # N = 1000, # periods = 5, # D = 2, # D.probs = c(0.8, 0.2), # H = 3, # borders = c(100, 500), # corr.B.U = 0.75 # ) ## ----eval = FALSE------------------------------------------------------------- # # Define which enterprises are relevant for each survey # Sur_rel <- Survey.relevance( # DATA, # periods = 5, # years = c(1, 2), # domains.survey = list(1:2, 1), # ge.or.less = c("ge", "l"), # TO.or.EM = c("TO", "EM"), # size.class = c(0, 5) # ) ## ----eval = FALSE------------------------------------------------------------- # # Stratify the population # strat <- Stratify( # DATA, # Survey.relevant = Sur_rel, # periods = 5, # years = c(1, 2), # TO.or.EM = c("TO", "EM"), # strata.TO = c(500), # strata.EM = c(10) # ) ## ----eval = FALSE------------------------------------------------------------- # # Apply Dutch BSC algorithm for period 1 # result <- Dutch.BSC( # DATA = DATA, # period = 1, # sf = c(0.2, 0.5), # Sampling fractions # rf = c(0.5, 1), # Rotation fractions # years = c(1, 2), # Survey periodicity # chi_S = c(0.5, 2), # Response burden in hours # survey.prio = 1:2, # Survey priority order # burden.periods = 5, # seed = 123, # Survey.relevant = Sur_rel, # stratification = strat # ) # # # Use updated DATA for next period # DATA <- result$DATA # in_sample <- result$in.sample