Learn R Programming

sampling (version 2.1)

calibev: Calibration estimator and its variance estimation

Description

Computes the calibration estimator and its variance estimation using the residuals' technique. The function returns two values: cest (the calibration estimator) and evar (its estimated variance).

Usage

calibev(Ys,Xs,total,pikl,d,g,q=rep(1,length(d)), with=FALSE,EPS=1e-6)

Arguments

Ys
vector of interest variable; its size is n, the sample size.
Xs
matrix of sample calibration variables.
total
vector of population totals for calibration.
pikl
matrix of joint inclusion probabilities of the sample units.
d
vector of initial weights of the sample units.
g
vector of g-weights; its size is n, the sample size.
q
vector of positive values accounting for heteroscedasticity; its size is n, the sample size.
with
if TRUE, the variance estimation takes into account the initial weights d; otherwise, the final weights w=g*d are taken into account; by default, its value is FALSE. If TRUE, the following formula is used $$Var(Ys)= \sum_{k\ins}\s
EPS
the tolerance in checking the calibration; by default, its value is 1e-6.

encoding

latin1

References

Deville, J.-C. and S�arndal, C.-E. (1992). Calibration estimators in survey sampling. Journal of the American Statistical Association, 87:376--382. Deville, J.-C., S�rndal, C.-E., and Sautory, O. (1993). Generalized raking procedure in survey sampling. Journal of the American Statistical Association, 88:1013--1020.

See Also

calib

Examples

Run this code
############
## Example
############
# Example of g-weights (linear, raking, truncated, logit),
# with the data of Belgian municipalities as population.
# Firstly, a sample is selected by means of Poisson sampling.
# Secondly, the g-weights are calculated.
data(belgianmunicipalities)
attach(belgianmunicipalities)
# matrix of calibration variables for the population
X=cbind(
Men03/mean(Men03),
Women03/mean(Women03),
Diffmen,
Diffwom,
TaxableIncome/mean(TaxableIncome),
Totaltaxation/mean(Totaltaxation),
averageincome/mean(averageincome),
medianincome/mean(medianincome))
# selection of a sample with expectation size equal to 200
# by means of Poisson sampling
# the inclusion probabilities are proportional to the average income 
pik=inclusionprobabilities(averageincome,200)
N=length(pik)               # population size
s=UPsystematic(pik)  	    # draws a sample s using systematic sampling	
Xs=X[s==1,]                 # matrix of sample calibration variables
piks=pik[s==1]              # sample inclusion probabilities
n=length(piks)              # sample size
# vector of population totals of the calibration variables
total=c(t(rep(1,times=N))%*%X)  
g1=calib(Xs,d=1/piks,total,method="linear") # computes the g-weights
pikl=UPsystematicpi2(pik)   # computes the matrix of the joint inclusion probabilities 
pikls=pikl[s==1,s==1]       # the same matrix for the units in s
Ys=Tot04[s==1]		    # the variable of interest is Tot04	(for the units in s)
calibev(Ys,Xs,total,pikls,d=1/piks,g1,with=FALSE,EPS=1e-6)

Run the code above in your browser using DataLab