prop_dom_optimal_allocation: Optimal sample size allocation for proportion

Description Usage Arguments Value See Also Examples

View source: R/prop_dom_optimal_allocation.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
prop_dom_optimal_allocation(
  H,
  Dom,
  pop = NULL,
  R = NULL,
  deff = NULL,
  se_max = 0.5,
  prop = 0.5,
  min_size = 3,
  step = 1,
  unit_level = TRUE,
  dataset = NULL
)

Arguments

H

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

Dom

Variables

used to define population domains. An object convertible to data.table or variable names as character vector, column numbers.

pop

The

population size in each stratum.

R

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.

deff

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.

se_max

Variable

for maximum standarterror (se) in domain.

prop

The

excepted ratio proportion.

min_size

A

numeric value for minimal sample size.

step

A

value for pace.

unit_level

A

logical value, if dataset is prepared for unit level then value TRUE, othercase FALSE.

dataset

Optional

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

Value

A list with two data objects:

datah

An object as data.table, with variables:
H - the unit stratum variable,
Dom - variables used to define population domains,
poph - the population size in each stratum,
Rh - the expected response rate in each stratum,
deffh - the expected design effect,
s2h - variance in domain of stratum,
sup_cv - Variable for maximum coeficient of variation,
poph - population size,
nh - sample size .

aggr_Dom

An object as data.table, with variables:
Dom - optional variables used to define population domains,
pop_Dom - population size,
sample_size_Dom - optional variables used to define population domains,
sample_size - optional variables used to define population domains,
pop - sample size

See Also

expsize, optsize, dom_optimal_allocation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library("data.table")
library("laeken")
data("eusilc")
eusilc <- data.table(eusilc)
dataset <- eusilc[, .(poph = sum(db090)), by = c("db040")]
dataset[, dom := "1"]
res <- prop_dom_optimal_allocation(H = "db040", Dom = "dom",
                                   pop = "poph", R = NULL,
                                   deff = NULL, se_max = 0.5,
                                   prop = 0.5, min_size = 3,
                                   step = 1, unit_level = FALSE,
                                   dataset = dataset)

surveyplanning documentation built on July 1, 2020, 10:38 p.m.