pop is a suppositious data frame for a small population with 5 elements. It is used for simple illustration of survey sampling estimators.

data(pop)

## Format

A data frame with 5 observations on the following 3 variables.

id

a numeric vector of individual identification values

X

a numeric vector of first characteristic

Y

a numeric vector of second characteristic

## References

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

## Examples

data(pop)
print(pop)
#>   id  X  Y
#> 1  1 11  9
#> 2  2 11 10
#> 3  3 11 11
#> 4  4 21 18
#> 5  5 21 22
## 1) Usage of Smean()
data(pop)
Y <- pop$Y Y #> [1] 9 10 11 18 22# Draw a random sample pop size=3 set.seed(93456) y <- sample(x = Y, size = 3) sort(y) #> [1] 9 11 22# Estimation with infiniteness correction est <- Smean(y = y, N = length(pop$Y))
est
#>
#> Smean object: Sample mean estimate
#> With finite population correction: N=5
#>
#> Mean estimate: 14
#> Standard error: 2.556
#> 95% confidence interval: [8.9903,19.0097]
#>
## 2) Usage of mbes()
data(pop)
# Draw a random sample of size=3
set.seed(802016)
data <- pop[sample(1:5, size=3),]
names(data) <- c('id','x','y')
# difference estimator
mbes(formula=y~x, data=data, aux=15, N=5, method='diff', level=0.95)
#>
#> mbes object: Model Based Estimation of Population Mean
#> Population size N = 5, sample size n = 3
#>
#> Values for auxiliary variable:
#> X.mean.1 = 15, x.mean.1 = 17.6667
#> ----------------------------------------------------------------
#> Difference Estimate
#>
#> Mean estimate:  14
#> Standard error:  0.7303
#>
#> 95% confidence interval [12.5686,15.4314]
#> # ratio estimator
mbes(formula=y~x, data=data, aux=15, N=5, method='ratio', level=0.95)
#>
#> mbes object: Model Based Estimation of Population Mean
#> Population size N = 5, sample size n = 3
#>
#> Values for auxiliary variable:
#> X.mean.1 = 15, x.mean.1 = 17.6667
#> ----------------------------------------------------------------
#> Ratio Estimate
#>
#> Mean estimate:  14.1509
#> Standard error:  0.74
#>
#> 95% confidence interval [12.7006,15.6013]
#> # regression estimator
mbes(formula=y~x, data=data, aux=15, N=5, method='regr', level=0.95)
#>
#> mbes object: Model Based Estimation of Population Mean
#> Population size N = 5, sample size n = 3
#>
#> Values for auxiliary variable:
#> X.mean.1 = 15, x.mean.1 = 17.6667
#> ----------------------------------------------------------------
#> Linear Regression Estimate
#>
#> Mean estimate:  14
#> Standard error:  1.0328
#>
#> 95% confidence interval [11.9758,16.0242]
#>
#> ----------------------------------------------------------------
#> Linear Regression Model:
#> Call:
#> lm(formula = formula, data = data)
#>
#> Residuals:
#>          5          4          2
#>  2.000e+00 -2.000e+00  6.661e-16
#>
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)
#> (Intercept)  -1.0000     6.3340  -0.158    0.900
#> x             1.0000     0.3464   2.887    0.212
#>
#> Residual standard error: 2.828 on 1 degrees of freedom
#> Multiple R-squared:  0.8929,	Adjusted R-squared:  0.7857
#> F-statistic: 8.333 on 1 and 1 DF,  p-value: 0.2123
#>