Learn R Programming

TeachingSampling (version 4.1.1)

E.Trim: Weight Trimming and Redistribution

Description

This function performs a method of trimming sampling weights based on the evenly redistribution of the net ammount of weight loss among units whose weights were not trimmed. This way, the sum of the timmed sampling weights remains the same as the original weights.

Usage

E.Trim(dk, L, U)

Arguments

dk

Vector of original sampling weights.

L

Lower bound for weights.

U

Upper bound for weights.

Value

This function returns a vector of trimmed weights.

Details

The function returns a vector of trimmed sampling weigths.

References

Valliant, R. et. al. (2013), Practical Tools for Designing and Weigthing Survey Samples. Springer. Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas.

Examples

Run this code
# NOT RUN {
# Example 1
dk <- c(1, 1, 1, 10) 
summary(dk)
L <- 1
U <- 3.5 * median(dk)
dkTrim <- E.Trim(dk, L, U)
sum(dk)
sum(dkTrim)

# Example 2
dk <- rnorm(1000, 10, 10)
L <- 1
U <- 3.5 * median(dk)
dkTrim <- E.Trim(dk, L, U)
sum(dk)
sum(dkTrim)
summary(dk)
summary(dkTrim)
hist(dk)
hist(dkTrim)
# }

Run the code above in your browser using DataLab