ffscube: Fast flight phase for the cube method modified

Description Usage Arguments Examples

Description

implementation modified from the package sampling.

Usage

1
ffscube(X, pik, comment = TRUE)

Arguments

X

matrix of auxiliary variables.

pik

vector of inclusion probabilities.

comment

bool, if comment should be written.

order

order to rearrange the data. Default 1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 

# Matrix of balancing variables
X=cbind(c(1,1,1,1,1,1,1,1,1),c(1,2,3,4,5,6,7,8,9))
# Vector of inclusion probabilities.
# The sample size is 3.
pik=c(1/3,1/3,1/3,1/3,1/3,1/3,1/3,1/3,1/3)
# pikstar is almost a balanced sample and is ready for the landing phase
pikstar=fastflightcube(X,pik,order=1,comment=TRUE)
round(pikstar,9)





rm(list = ls())
set.seed(1)
eps <- 1e-13
library(Matrix)
N <- 300
Pik <- matrix(c(sampling::inclusionprobabilities(runif(N),70),
sampling::inclusionprobabilities(runif(N),50),
sampling::inclusionprobabilities(runif(N),30)),ncol = 3)
X <- PM(Pik)$PM
pik <- PM(Pik)$P
dim(X)
order = 2
EPS = 1e-11

system.time(test1 <- fastflightcubeSPOT(X,pik,order = 2))
system.time(test2 <- fastflightcubeSPOT(X,pik,order = 1))
system.time(test3 <- sampling::fastflightcube(X,pik, order = 2))
system.time(test4 <- BalancedSampling::flightphase(pik,X))



## End(Not run)

RJauslin/Sampling documentation built on Aug. 29, 2020, 7:27 a.m.