submean: Sub-sample Mean Estimation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/submean.R

Description

The function submean estimates the population mean out of sub-samples (two-stage samples) either with or without consideration of finite population correction in both stages.

Usage

1
submean(y, PSU, N, M, Nl, m.weight, n.weight, method = 'simple', level = 0.95)

Arguments

y

vector of target variable.

PSU

vector of grouping variable which indicates the primary unit for each sample element.

N

positive integer specifying population size

M

positive integer specifying the number of primary units in the population.

Nl

vector of sample sizes in each primary unit, which has to be specified in alphabetical or numerical order of the categories of l.

m.weight

vector of primary sample unit weights, which has to be specified in alphabetical or numerical order of the categories of l.

n.weight

vector of secondary sample unit weights in each primary sample unit, which has to be specified in alphabetical or numerical order of the categories of l.

method

estimation method. Default is "simple", alternative is "ratio".

level

coverage probability for confidence intervals. Default is level=0.95.

Details

If the absolute sizes M and Nl are given, the variances are calculated with finite population correction. Otherwise, if the weights m.weight and n.weight are given, the variances are calculated without finite population correction.

Value

The function submean returns a value, which is a list consisting of the components

call

is a list of call components: y target variable in sample data, PSU gouping variable in sample data, N population size, M number of primary population units, fpc finite population correction, method estimation method, level coverage probability for confidence intervals

mean

mean estimate for population

se

standard error of the mean estimate for population

ci

vector of confidence interval boundaries for population

Author(s)

Shuai Shao and Juliane Manitz

References

Kauermann, Goeran/Kuechenhoff, Helmut (2011): Stichproben. Methoden und praktische Umsetzung mit R. Springer.

See Also

Smean, stratamean

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
y <- c(23,33,24,25,72,74,71,37,42)
psu <- as.factor(c(1,1,1,1,2,2,2,3,3))
# with finite population correction
submean(y, PSU=psu, N=700, M=23, Nl=c(100,50,75), method='ratio')
# without finite population correction
submean(y, PSU=psu, N=700, m.weight=3/23, n.weight=c(4/100,3/50,2/75), method='ratio')

# Chinese wage data
data(wage)
summary(wage)
submean(wage$Wage,PSU=wage$Region, N=990, M=33, Nl=rep(30,14))

Example output

Loading required package: pps
Loading required package: sampling
Loading required package: survey
Loading required package: grid
Loading required package: Matrix
Loading required package: survival

Attaching package:survivalThe following objects are masked frompackage:sampling:

    cluster, strata


Attaching package:surveyThe following object is masked frompackage:graphics:

    dotchart


submean object: Sub-sample mean estimate
With finite population correction.
Using method: ratio

Mean estimate: 40.9074
Standard error: 26.9358
95% confidence interval: [-11.8858,93.7006]


submean object: Sub-sample mean estimate
Without finite population correction.
Using method: ratio

Mean estimate: 40.9074
Standard error: 28.8828
95% confidence interval: [-15.7018,97.5166]

       Region                 Sector         Wage      
 Henan    : 19   BusinessServices: 11   Min.   : 4698  
 Liaoning : 19   Husbandry       : 11   1st Qu.:13918  
 Chongqing: 18   Construction    : 10   Median :16695  
 Beijing  : 17   Financial       : 10   Mean   :16760  
 Hubei    : 17   Health          : 10   3rd Qu.:19533  
 Jiangsu  : 17   Research        : 10   Max.   :29530  
 (Other)  :124   (Other)         :169                  

submean object: Sub-sample mean estimate
With finite population correction.
Using method: simple

Mean estimate: 16753.19
Standard error: 475.3202
95% confidence interval: [15821.58,17684.8]

samplingbook documentation built on April 3, 2021, 1:06 a.m.