unionStrata: Create the union of the strata

Description Usage Arguments Examples

View source: R/unionStrata.R

Description

Create the union of the strata

Usage

1
unionStrata(l_Strata, ref)

Arguments

X

sptaial coordinates

pik_tmp

temporary pik (unit k has a cutted pik)

toreBound

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
############################# 1D

rm(list = ls())
set.seed(1)
eps <- 1e-13
N <- 10
n <- 3
X <- as.matrix(seq(1,N,1))
tb = -0.001
pik <- rep(0.3,N)
pikInit <- pik
ref <- 6
pik[ref] <- runif(1,min = eps,max = pik[ref] - eps)
shift = TRUE
tore = TRUE
toreBound = 10
l_Strata <- allStrata(X,pik,ref,tb,pikInit)
l_Strata
u_Strata <- unionStrata(l_Strata,ref)
u_strata

################################# 2D
rm(list = ls())
set.seed(1)
N <- 36
n <- 8
pik <- rep(n/N,N)
pikInit <- pik


tb <- runif(2)/100
X <- as.matrix(cbind(runif(N),runif(N)))
tore = FALSE
toreBound = FALSE
ref = 1

l_Strata <- allStrata(X,pik,ref,tb,pikInit)
plot(l_Strata,X)
u_Strata <- unionStrata(l_Strata)
plot(u_Strata,X)

################## GRID 2D

rm(list = ls())
set.seed(1)
eps <- 1e-13
N <- 81
n <- 9
pik <- rep(n/N,N)


tb <- runif(2)/100

X <- as.matrix(expand.grid(seq(1,sqrt(N),1),seq(1,sqrt(N),1)))
tore = TRUE
toreBound = sqrt(N)

ref = 25

l_Strata <- allStrata(X,pik,ref,tb,tore = tore,toreBound = toreBound,pikInit = pik)
plot(l_Strata,X)
u_Strata <- unionStrata(l_Strata)
plot(u_Strata,X)

RJauslin/SystematicSampling documentation built on Feb. 10, 2021, 9:37 a.m.