jipApprox

Build Status CRAN_Status_Badge R badge

Description

This package provides functions to approximate joint-inclusion probabilities in Unequal Probability Sampling, or to find Monte Carlo approximations of first and second-order inclusion probabilities of a general sampling design.

The main functions are:

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/jipApprox")

Usage

library(jipApprox)

### Generate population data ---
N <- 20; n <- 5

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)

### Approximate joint-inclusion probabilities for high entropy designs ---
pikl <- jip_approx(pik, method='Hajek')
pikl <- jip_approx(pik, method='HartleyRao')
pikl <- jip_approx(pik, method='Tille')
pikl <- jip_approx(pik, method='Brewer1')
pikl <- jip_approx(pik, method='Brewer2')
pikl <- jip_approx(pik, method='Brewer3')
pikl <- jip_approx(pik, method='Brewer4')

### Approximate inclusion probabilities through Monte Carlo simulation ---
pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "brewer")
pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "tille")
pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "poisson")
pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "maxEntropy")
pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "randomSystematic")
pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "systematic")
pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "sampford")

More


Buy Me A Coffee