Learn R Programming

MOSAlloc (version 1.2.4)

constructCrestrSTRS: Constructor for cost constraints

Description

A helper function for generating cost coefficient matrix C and corresponding right-hand side c under stratified random sampling (STRS) as input to the the multiobjective allocation function mosalloc().

Usage

constructCrestrSTRS(H, list)

Value

The function constructCrestrSTRS() returns a list

C (type: matrix): a cost matrix for the cost restrictions and

c (type: vector): a cost vector for the corresponding right-hand side
usable as input to the multiobjective allocation function mosalloc().

Arguments

H

(type: numeric) The number of strata.

list

(type: list) A list of lists taking subpopulation- (domain/area) specific arguments. Elements are lists containing the following components which correspond to one specific cost restriction:
..$stratum_id (type: numeric) A vector containing the indices of the strata considered for the current restriction. The indices must coincide with the row numbers of X_var and X_tot.
..$c_coef (type: numeric) A vector of length length(stratum_id) containing the stratum-specific cost components for the set of strata that is going to be bounded by above and/or below.
..$c_upper (type: numeric) The cost upper bound value. NULL if not present.
..$c_lower (type: numeric) The cost lower bound value. NULL if not present.
..$name (type: character) The name of the subpopulation (domain/area).

Examples

Run this code
# Artificial population of 50 568 business establishments and 5 business
# sectors (data from Valliant, R., Dever, J. A., & Kreuter, F. (2013).
# Practical tools for designing and weighting survey samples. Springer.
# https://doi.org/10.1007/978-1-4614-6449-5, Example 5.2 pages 133-9)

# See also https://umd.app.box.com/s/9yvvibu4nz4q6rlw98ac/file/297813512360
# file: Code 5.3 constrOptim.example.R

Nh <- c(6221, 11738, 4333, 22809, 5467) # stratum sizes
H <- length(Nh)
ch <- c(120, 80, 80, 90, 150) # stratum-specific cost of surveying
budget <- 300000

# Examples
#----------------------------------------------------------------------------
# Example 1: Assume we want so specify one overall cost constraint for the
# five strata. The cost of surveying must not exceed 300000 $.

# The input \code{C} and \code{C} to \code{mosalloc} can be specified as
# follows:

C <- matrix(ch, nrow = 1)
c <- as.vector(budget)

# Using \code{constructCrestrSTRS} this can also be done via
list <- list(list(stratum_id = 1:5, c_coef = ch, c_lower = NULL,
                  c_upper = budget, name = "Overall"))
Cc <- constructCrestrSTRS(H, list)

# Evaluation of the output
Cc$C - C
Cc$c - c

# Example 2: In addition to the overall cost constraint from Example 1,
# we want to specify a minimum sample size for strata 1 to 3.

# The input \code{C} and \code{C} to \code{mosalloc} can be specified as
# follows:

C <- rbind(ch,
           ch * c(-1, -1, -1, 0, 0))
c <- c(budget,                        # Maximum overall survey budget
       - 0.5 * budget)                # Minimum overall budget for strata 1-3

# Using \code{constructCrestrSTRS} this can also be done via
list <- list(list(stratum_id = 1:5, c_coef = ch, c_lower = NULL,
                  c_upper = budget, name = "Overall"),
             list(stratum_id = 1:3, c_coef = ch[1:3], c_lower = 0.5 * budget,
                  c_upper = NULL, name = "1to3"))
Cc <- constructCrestrSTRS(H, list)

# Evaluation of the output
Cc$C - C
Cc$c - c

Run the code above in your browser using DataLab