expected_CV | R Documentation |
Function to report the expected coefficients of variation for target variables Ys in a 'strata' dataset given an allocation 'alloc' and the current set of precision constraints
expected_CV(strata, errors, alloc)
strata |
name of the dataframe containing information in the sampling strata. |
errors |
name of the dataframe |
alloc |
vector containing the allocation of sampling units. |
a dataframe containing the maximum expected coefficients of variation in each domain level for each target variable
load("./data/sample.RData")
target_vars <- c("active","inactive","unemployed","income_hh")
strata <- R2BEAT:::prepareInputToAllocation_beat.1st(samp_frame = samp,
ID = "id_hh",
stratum = "stratum_label",
dom = "region",
target = target_vars)
strata$CENS <- as.numeric(strata$CENS)
strata$COST <- as.numeric(strata$COST)
strata$CENS <- 0
cv <- as.data.frame(list(DOM = c("DOM1","DOM2"),
CV1 = c(0.05,0.10),
CV2 = c(0.05,0.10),
CV3 = c(0.05,0.10),
CV4 = c(0.05,0.10)))
allocation <- beat.1st(strata,cv)
alloc <- allocation$alloc$ALLOC[-nrow(allocation$alloc)]
exp_cv <- expected_CV(strata,cv,alloc)
exp_cv
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.