ssd: Sample size dependent estimator.

Description Usage Arguments Value References See Also Examples

View source: R/ssd.R

Description

Calculates sample size dependent estimators of domain means, as composition of direct and synthetic estimators. The estimators involved in the composition must be given as function arguments.

Usage

1
ssd(dom, sweight, domsize, direct, synthetic, delta = 1, data)

Arguments

dom

vector or factor (same size as y) with domain codes.

sweight

vector (same size as dom) with sampling weights of the units.

domsize

matrix or data frame with domain codes in the first column and the corresponding domain population sizes in the second column.

direct

matrix or data frame with domain codes in the first column and the corresponding direct estimators of domain means in the second column.

synthetic

matrix or data frame with domain codes in the first column and the corresponding synthetic estimators of domain means in the second column.

delta

constant involved in sample size dependent estimator, controlling how much strength to borrow. Default value is 1.

data

optional data frame containing the variables named in dom and sweight. By default the variables are taken from the environment from which ssd is called.

Value

The function returns a data frame of size D*2 with the following columns:

Domain

domain codes in ascending order.

ssd

sample size dependent estimators of domain means.

CompWeight

weights attached to direct estimators in the composition.

Cases with NA values in dom or sweight are ignored.

References

- Drew, D., Singh, M.P. and Choudhry, G.H. (1982). Evaluation of small area estimation techniques for the Canadian Labour Force Survey. Survey Methodology 8, 17-47.

- Rao, J. N. K. (2003). Small Area Estimation. Wiley, London.

See Also

direct, pssynt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# We compute sample size dependent estimators of mean income by  
# composition of the Horvitz-Thompson direct estimator and the  
# post-stratified synthetic estimator with age groups as post-strata.

# Load data set
data(incomedata)

# Load population sizes of provinces (domains)
data(sizeprov)  

# First we compute Horvitz-Thompson direct estimators
dir <- direct(y=income, dom=provlab, sweight=weight,
              domsize=sizeprov[,c(1,3)], data=incomedata)

# Now we compute post-stratified synthetic estimators with education 
# levels as post-strata
# Load province sizes by education levels
data(sizeprovedu)

# Compute post-stratified synthetic estimators
colnames(sizeprovedu) <- c("provlab", "prov", "0", "1", "2", "3")
synth <- pssynt(y=income, sweight=weight, ps=educ,
                domsizebyps=sizeprovedu[,-2], data=incomedata)
                
# Compute sample size dependent estimators of province mean income
# by composition of Horvitz-Thompson direct estimators and 
# post-stratified estimators for delta=1
comp <- ssd(dom=provlab, sweight=weight, domsize=sizeprov[,c(1,3)],
            direct=dir[,c("Domain","Direct")], synthetic=synth, data=incomedata)
comp

sae documentation built on March 26, 2020, 7:52 p.m.