Learn R Programming

UPSvarApprox

Description

UPSvarApprox provides functions for the approximation of the variance of the Horvitz-Thompson total estimator in Unequal Probability Sampling using only first-order inclusion probabilities.

The main functions are:

  • Var_approx(): computes and approximation of the variance of the HT estimator;
  • approx_var_est(): computes an approximate variance estimate for the HT estimator;

Installation

The development version of the package can be installed from GitHub:

# if not present, install 'devtools' package
install.packages("devtools")
devtools::install_github("rhobis/UPSvarApprox")

Usage

library(UPSvarApprox)

### Generate population data ---
N <- 500; n <- 50

set.seed(0)
x <- rgamma(500, scale=10, shape=5)
y <- abs( 2*x + 3.7*sqrt(x) * rnorm(N) )

pik <- n * x/sum(x)
s   <- sample(N, n)

ys <- y[s]
piks <- pik[s]

### Variance approximations ---
Var_approx(y, pik, n, method = "Hajek1")
Var_approx(y, pik, n, method = "Hajek1")
Var_approx(y, pik, n, method = "HartleyRao1")
Var_approx(y, pik, n, method = "HartleyRao2")
Var_approx(y, pik, n, method = "FixedPoint")


### Approximate variance estimators ---

## Estimators of class 2
approx_var_est(ys, piks, method="Deville1")
approx_var_est(ys, piks, method="Deville2")
approx_var_est(ys, piks, method="Deville3")
approx_var_est(ys, piks, method="Rosen")
approx_var_est(ys, piks, method="FixedPoint")
approx_var_est(ys, piks, method="Brewer1")

## Estimators of class 3 
approx_var_est(ys, pik, method="Berger", sample=s)
approx_var_est(ys, pik, method="Tille", sample=s)
approx_var_est(ys, pik, method="MateiTille1", sample=s)
approx_var_est(ys, pik, method="MateiTille2", sample=s)
approx_var_est(ys, pik, method="MateiTille3", sample=s)
approx_var_est(ys, pik, method="MateiTille4", sample=s)
approx_var_est(ys, pik, method="MateiTille5", sample=s)
approx_var_est(ys, pik, method="Brewer2", sample=s)
approx_var_est(ys, pik, method="Brewer3", sample=s)
approx_var_est(ys, pik, method="Brewer4", sample=s)

More

  • Please, report any bug or issue here.
  • For more information, please contact the maintainer at rob.sichera@gmail.com.

Copy Link

Version

Install

install.packages('UPSvarApprox')

Monthly Downloads

239

Version

0.1.4

License

GPL-3

Maintainer

Roberto Sichera

Last Published

August 27th, 2023

Functions in UPSvarApprox (0.1.4)

UPSvarApprox-package

UPSvarApprox: Approximate the variance of the Horvitz-Thompson estimator
approx_var_est

Approximated Variance Estimators
var_Berger

Berger approximate variance estimator
var_Brewer_class2

Approximate Variance Estimators by Brewer (2002)
Var_approx

Approximate the Variance of the Horvitz-Thompson estimator
var_HartleyRao

Hartley and Rao approximate variance estimator
var_FixedPoint

Fixed-Point approximate variance estimator
var_Hajek

Hájek Approximate Variance Estimator
var_Brewer_class3

Approximate Variance Estimators by Brewer (2002)
var_Rosen

Rosén Approximate Variance Estimator
var_Tille

Tillé's Approximate Variance Estimator
is.wholenumber

Check if a number is integer
var_MateiTille

Approximate Variance Estimators by Matei and Tillé (2005)
var_Deville

Deville's approximate variance estimators