surveyplanning (version 4.0)

dom_optimal_allocation: Optimal sample size allocation

Description

The function computes optimal sample size allocation over strata and domain for population.

Usage

dom_optimal_allocation(
  id,
  Dom,
  H,
  Y,
  Rh = NULL,
  deffh = NULL,
  indicator,
  sup_w,
  sup_cv,
  min_size = 3,
  correction_before = FALSE,
  dataset = NULL
)

Arguments

id

Variable for unit ID codes. One dimensional object convertible to one-column data.table or variable name as character, column number.

Dom

Optional variables used to define population domains. If supplied, values are calculated for each domain. An object convertible to data.table or variable names as character vector, column numbers.

H

The unit stratum variable. One dimensional object convertible to one-column data.table or variable name as character, column number.

Y

Variable of interest. Object convertible to data.table or variable names as character, column numbers.

Rh

The expected response rate in each stratum (optional). If not defined, it is assumed to be 1 in each stratum (full-response). Object convertible to one-column data.table, variable name as character, or column number.

deffh

The expected design effect for the estimate of variable (optional). If not defined, it is assumed to be 1 for each variable in each stratum. If is defined, then variables is defined the same arrangement as Yh. Object convertible to data.table, variable name as character vector, or column numbers.

indicator

Variable for detection fully surveyed units. Object convertible to data.table or variable names as character, column numbers.

sup_w

Variable for weight limit in domain of stratum. Object convertible to data.table or variable names as character, column numbers.

sup_cv

Variable for maximum coeficient of variation (CV) in percentage for domain. Object convertible to data.table or variable names as character, column numbers.

min_size

A numeric value for sample size.

correction_before

by default FALSE; correction of sample size is made before ending, if true, correction of sample size is made at the end.

dataset

Optional survey data object convertible to data.table with one row for each stratum.

Value

A list with eights data objects:

data

An object as data.table, with variables: id - variable with unit ID codes, Dom - optional variables used to define population domains, H - the unit stratum variable, Y - variable of interest, Rh - the expected response rate in each stratum, deffh - the expected design effect, indicator - variable for full surveys, sup_w - variable for weight limit in domain of stratum, sup_cv - Variable for maximum coeficient of variation, poph - population size, nh - sample size .

nh_larger_then_Nh

An object as data.table, with variables: H - the stratum variable, nh - sample size, poph - population size.

dom_strata_size

An object as data.table, with variables: H - the unit stratum variable, Dom - optional variables used to define population domains, sup_w - variable for weight limit in domain of stratum, poph - population size, nh - sample size, sample100 - sample size for fully surveyed units, design_weights - design weigts.

dom_size

An object as data.table, with variables: Dom - optional variables used to define population domains, poph - population size, nh - sample size, sample100 - sample size for fully surveyed units, design_weights - design weigts.

size

An object as data.table, with variables: poph - population size, nh - sample size, sample100 - sample size for fully surveyed units.

dom_strata_expected_precision

An object as data.table, with variables: H - stratum, variable - the name of variable of interest, estim - total value, deffh - the expected design effect, s2h - population variance \(S^2\), nh - sample size, Rh - the expected response rate, deffh - the expected design effect, poph - population size, nrh - expected number of respondents, var - expected variance, se - expected standard error, cv - expected coeficient of variance.

dom_expected_precision

An object as data.table, with variables: Dom - domain, variable - the name of variable of interest, poph - the population size, nh - sample size, nrh - expected number of respondents, estim - total value, var - the expected variance, se - the expected standart error, cv - the expected coeficient of variance.

total_expected_precision

An object as data.table, with variables: variable - the name of variable of interest, poph - the population size, nh - sample size, nrh - expected number of respondents, estim - total value, var - the expected variance, se - the expected standart error, cv - the expected coeficient of variance.

See Also

expsize, optsize, prop_dom_optimal_allocation

Examples

Run this code
# NOT RUN {
library("laeken")
library("data.table")
data("ses")
data <- data.table(ses)
data[, H := paste(location, NACE1, size, sep = "_")]
data[, id := .I]
data[, full := 0]
data[, sup_cv := 10]
data[, sup_w := 20]
#vars <- dom_optimal_allocation(id = "id", dom = "sex",
#                                H = "H", Y = "earnings",
#                                indicator = "full",
#                                sup_w = "sup_w",
#                                sup_cv = "sup_cv",
#                                min_size = 3,
#                                correction_before = FALSE,
#                                dataset = data)
#                                dataset=data)
#vars
# }

Run the code above in your browser using DataLab