Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

sampling (version 0.45)

HTestimator: The Horvitz-Thompson estimator

Description

Computes the Horvitz-Thompson estimator of the population total.

Usage

HTestimator(y,pik,s)

Arguments

y
vector of the variable of interest; its length is equal to N, the population size.
pik
vector of the first-order inclusion probabilities.
s
vector of size N, with 0/1 elements indicating the unit status: 1 - unit is selected in the sample, 0 - otherwise.

See Also

UPtille

Examples

Run this code
# Belgian municipalities data base
b=data(belgianmunicipalities)
# Compute the inclusion probabilities
pik=inclusionprobabilities(belgianmunicipalities$Tot04,200)
N=length(pik)
n=sum(pik)
# Define the variable of interest
y=belgianmunicipalities$TaxableIncome
# Draw a Poisson sample of expected size 200
s=UPpoisson(pik)
# Compute the Horvitz-Thompson estimator
HTestimator(y,pik,s)

Run the code above in your browser using DataLab