systematic: Title

Description Usage Arguments Examples

View source: R/systematic.R

Description

La fonction va boucler sur les unités les plus proche pour trouver la strate tel que l'unité k est au bord (coupé de la bonne manière) et un autre unité qui laisse le plus en dehors.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
systematic(
  X,
  pik,
  tb,
  tore = FALSE,
  toreBound = -1,
  comment = FALSE,
  pik_cutted,
  s
)

Arguments

X

sptaial coordinates

toreBound
pik_tmp

temporary pik (unit k has a cutted pik)

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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
############################# 1D

rm(list = ls())
eps <- 1e-13
N <- 36
n <- 8
X <- as.matrix(seq(1,N,1))
tb = -0.001
pik <- rep(n/N,N)
shift = TRUE
tore = TRUE
toreBound = N
comment = TRUE


s <- systematic(X,pik,tb,tore,toreBound,comment = TRUE)
plot(X,rep(0,N))
points(X[s],rep(0,n),pch = 16)

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


rm(list = ls())
#set.seed(2)
# set.seed(8)
# set.seed(3)
 #set.seed(5) # n = 12
set.seed(7)
eps <- 1e-13
N <- 144
n <-  24
pik <- rep(n/N,N)
#pik <- sampling::inclusionprobabilities(runif(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)
comment = TRUE

s <- systematic(X,pik,tb,tore = tore,toreBound = toreBound,comment = comment)

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


rm(list = ls())
#set.seed(2)
# set.seed(8)
# set.seed(3)
 #set.seed(5) # n = 12
set.seed(7)
eps <- 1e-13
N <- 144
n <-  24
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)
comment = TRUE

s <- systematic(X,pik,tb,tore = tore,toreBound = toreBound,comment = comment)

plot(X)
points(X[s,],pch = 16)


############################# 2D


rm(list = ls())
#set.seed(3)
eps <- 1e-13
N <- 100
n <- 10
pik <- rep(n/N,N)


tb <- rep(0,2)
X <- as.matrix(cbind(runif(N, min = 1,max = 3),runif(N,min = 1,max = 3)))
tore = FALSE
toreBound = -1
comment = TRUE
s <- systematic(X,pik,tb,tore = tore,toreBound = toreBound,comment = TRUE)
plot(X)
points(X[s,],pch = 16)

s <- lpm1(pik,X)
plot(X)
points(X[s,],pch = 16)

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