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.

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

References

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

Author

Shuai Shao and Juliane Manitz

See also

Examples

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')
#> #> 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] #>
# 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')
#> #> 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] #>
# Chinese wage data data(wage) summary(wage)
#> 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(wage$Wage,PSU=wage$Region, N=990, M=33, Nl=rep(30,14))
#> #> 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] #>