saMinCV: Optimal Strata Formation and Allocation Using Simulated...

Description Usage Arguments Value Examples

View source: R/saMinCV.R

Description

This function exchanges sampling units between strata to minimize the target coefficient of variation (CV), every few steps (as determined by sampleUpdateIterations) a number of iterations are performed to improve the target CV by changing the sample allocation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
saMinCV(
     x, 
     label, 
     targetCV, 
     sampleSize, 
     weightMatrix, 
     iterations=1000, 
     sampleSizeIterations=3, 
     recalcIterations=10000,
     locationAdjustment,
     scaleAdjustment,
     p = 2,                   
     penalty = -1,       
     cooling = 0,
     preserveSatisfied=TRUE,
     fpc=TRUE
   )

Arguments

x

(Required) A matrix where each row is a sampling unit and each column is a characteristic of the sampling unit.

Multiple observations of the same PSU can be included by including additional rows for each observation. When data is presented in this manner, the average CV of each characteristic is used in the objective function.

e.g. for 3 observations per PSU:

PSU Observation of PSU .... data

1 1

1 2

1 3

2 1

2 2

2 3

. .

. .

. .

Note that only x should be of this form for multiple observations per PSU. All other parameters should be of the same size as if there was a single observation per PSU.

label

(Required) Integer valued initial stratum assignment.

targetCV

(Required) A vector of target CVs. This vector must be of equal length to the number of columns of x.

sampleSize

(Required) sample size, either an integer valued scalar that will be equally split between strata, or a sample size for each strata. When the sample size cannot be split excess sample allocations will be given to strata in increasing order.

weightMatrix

A matrix of size nrow(x) by total strata. PSUs with larger weights are more likely to be selected in the simulated annealing procedure. Acceleration of the procedure can be attained by using weights inversely proportional to the distance to known strata boundaries.

iterations

Number of iterations to perform of the simulated annealing procedure.

sampleSizeIterations

Number of iterations for each sample Allocation update step (0 = no changes).

recalcIterations

Number of iterations to wait until recalculating the variance (0 = every iteration).

locationAdjustment

A constant value added to the population variable for each administrative variable, this is of the same size and layout of x.

scaleAdjustment

A constant value multiplied by the population variable (before the location adjustment) for each administrative variable, this is of the same size and layout of x.

penalty

The penalty vector used for each of the CV targets penalties. Penalties with negative elements are ignored. A scalar value may be used, and will be repeated for all CVs.

p

The exponent for the penalty function, fractional exponents are available.

cooling

Cooling Schedule (0 = exchange only).

preserveSatisfied

TRUE implies that any constraint that is met for an accepted state is kept, FALSE allows for met CVs to be violated by accepted states.

fpc

TRUE use a finite population correction factor (fpc), FALSE do not use a fpc.

Value

accept

Matrix with three columns and a row for each iteration, "change": change in objective function, "U": uniform random variable, "accepted": 1 - accepted, 0 - not accepted "selected": index of PSU, "from": current stratum of selected PSU , "to": candidate stratum of selected PSU, "n_h": sample size (h is the index or label associated with strata), column names or numbers if not presented

cost

Objective Function

label

Final Label

sampleSize

Final Sample Size

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# data set with 100 observations and four 
# characteristics split between two strata
x <- matrix(rnorm( 100*4 ),ncol=4)  

# create an initial set of strata assignments 
label <- c(rep(0,50),rep(1,50)) 

# run minCV for a sample size of 20
b <- saMinCV(
  x,
  label,
  targetCV=c(0.08, 0.10, 0.05, 0.08),
  sampleSize=20
)

summary(b)

jlisic/saAlloc documentation built on May 19, 2019, 12:47 p.m.