Wk {TeachingSampling}R Documentation

The Calibration Weights

Description

Computes the calibration weights for the estimation of the population total of several variables of interest

Usage

Wk(x,tx,Pik,ck)

Arguments

x Vector, matrix or data frame containig the recollected auxiliary information for every unit in the selected sample
tx Vector containing the populations totals of the auxiliary information
Pik A vetor containing inclusion probabilities for each unit in the sample
ck A vector of weights induced by the structure of variance of the supposed model

Details

The calibration weights satisfy the following expression

sum_{kin S}w_kx_k=sum_{kin U}x_k

Value

The function returns a matrix of calibrated weights.

Author(s)

Hugo Andrés Gutiérrez Rojas hugogutierrez@usantotomas.edu.co

References

Sarndal, C-E. and Swensson, B. and Wretman, J. (1992), Model Assisted Survey Sampling. Springer.
Guti'errez, H. A. (2009), Estrategias de muestreo: Dise~no de encuestas y estimaci'on de par'ametros. Editorial Universidad Santo Tom'as

Examples

############
## Example 1
############
# Draws a simple random sample without replacement
data(Marco)
data(Lucy)
dim(Marco)
N <- dim(Marco)[1]
n <- 400
sam <- sample(N,n)
# The information about the units in the sample is stored in an object called data
data <- Lucy[sam,]
attach(data)
names(data)
# Vector of inclusion probabilities
Pik<-rep(n/N,n)

##############################

x <- rep(1,n)
ck <- rep(1,n)
tx <- c(N)
wk <- Wk(x,tx,Pik,ck)
sum(wk*x)

##############################

x <- Employees
tx <- c(151950)
ck <- x
wk <- Wk(x,tx,Pik,ck)
sum(wk*x)

##############################
                                                                                                         
x <- Taxes
tx <- c(28654)  
ck <- rep(1,n)                                                                
wk <- Wk(x,tx,Pik,ck)
sum(wk*x)                                                                                    
                                         
##############################

x <- data.frame(Employees, Taxes)
tx <- c(151950, 28654)
ck <- matrix(1, n, 2)
wk <- Wk(x,tx,Pik,ck)
sum(wk[,1]*x[,1]) 
sum(wk[,1]*x[,2]) 
sum(wk[,2]*x[,2]) 
sum(wk[,2]*x[,1]) 
                                          
##############################

x <- data.frame(Employees, Taxes)
tx <- c(151950, 28654)
ck <- x
wk <- Wk(x,tx,Pik,ck)
sum(wk[,1]*x[,1]) 
sum(wk[,1]*x[,2]) 
sum(wk[,2]*x[,2]) 
sum(wk[,2]*x[,1]) 

##############################
 
x <- cbind(1,Taxes)
tx <- c(N,28654)
ck <- x
wk <- Wk(x,tx,Pik,ck)
sum(wk[,1]*x[,1]) 
sum(wk[,1]*x[,2]) 
sum(wk[,2]*x[,2]) 
sum(wk[,2]*x[,1]) 

[Package TeachingSampling version 0.7.6 Index]