Variance estimators of the Horvitz-Thompson estimator
Computes variance estimators of the Horvitz-Thompson estimator of the population total.
varHT(y,pikl,method)
y |
vector of the variable of interest; its length is equal to n, the sample size. |
pikl |
matrix of second-order inclusion probabilities; its dimension is nxn. |
method |
if 1, an unbiased variance estimator is computed; if 2, the Sen-Yates-Grundy variance estimator for fixed sample size is computed; be default, the method is 1. |
If method is 1, the following estimator is implemented
\widehat{Var}(\widehat{Y}_{HT})_1=∑_{k\in s}∑_{\ell\in s} \frac{y_k y_\ell}{π_{k\ell} π_k π_\ell}(π_{k\ell} - π_k π_\ell)
If method is 2, the following estimator is implemented
\widehat{Var}(\widehat{Y}_{HT})_2=\frac{1}{2}∑_{k\in s}∑_{\ell\in s} ≤ft(\frac{y_k}{π_k} - \frac{y_\ell}{π_\ell}\right)^2 \frac{π_k π_\ell-π_{k\ell}}{π_{k\ell}}
pik=c(0.2,0.7,0.8,0.5,0.4,0.4) N=length(pik) n=sum(pik) # Defines the variable of interest y=rnorm(N,10,2) # Draws a Poisson sample of expected size n s=UPpoisson(pik) # Computes the Horvitz-Thompson estimator HTestimator(y[s==1],pik[s==1]) # Computes the second-order inclusion prob. for Poisson sampling pikl=outer(pik,pik,"*") diag(pikl)=pik # Computes the variance estimator (method=1, the sample size is not fixed) varHT(y[s==1],pikl[s==1,s==1],1) # Draws a Tille sample of size n s=UPtille(pik) # Computes the Horvitz-Thompson estimator HTestimator(y[s==1],pik[s==1]) # Computes the second-order inclusion prob. for Tille sampling pikl=UPtillepi2(pik) # Computes the variance estimator (method=2, the sample size is fixed) varHT(y[s==1],pikl[s==1,s==1],2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.