Description Usage Arguments Examples
Title
1 | simu(SIM, Xcoord, pik, tb, tore, toreBound)
|
toreBound |
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 | ############# 2D runif
rm(list = ls())
N <- 36
n <- 6
Xcoord <- as.matrix(cbind(runif(N, min = 1,max = 10),runif(N,min = 1,max = 10)))
pik <- rep(n/N,N)
tb <- rep(0,2)
tore = FALSE
toreBound = -1
SIM <- 200
res <- simu(SIM,Xcoord,pik,tb,tore,toreBound)
library(ggplot2)
dat <- data.frame(x = Xcoord[,1],y = Xcoord[,2],size = res$pik_systematic,pik = pik)
ggplot()+
geom_point(data = dat,aes(x = x,y = y,size = pik),pch = 1,alpha = 1,colour = "black")+
geom_point(data = dat,aes(x = x,y = y,size = size,colour = size))+
theme_bw()
############# 2D grid
rm(list = ls())
N <- 36
n <- 6
Xcoord <- as.matrix(expand.grid(seq(1,sqrt(N),1),seq(1,sqrt(N),1)))
pik <- rep(n/N,N)
tore = TRUE
toreBound = 6
tb <- runif(2)/100
SIM = 100
s <- systematic(Xcoord,pik,tb,tore = tore,toreBound = toreBound,comment = TRUE)
plot(Xcoord)
points(Xcoord[s,],pch = 16)
res <- simu(SIM,Xcoord,pik,tb,tore,toreBound)
library(ggplot2)
dat <- data.frame(x = Xcoord[,1],y = Xcoord[,2],size = res$pik_systematic,pik = pik)
ggplot()+
geom_point(data = dat,aes(x = x,y = y,size = pik),pch = 1,alpha = 1,colour = "black")+
geom_point(data = dat,aes(x = x,y = y,size = size,colour = size))+
theme_bw()
############# 1D
rm(list = ls())
N <- 30
n <- 5
Xcoord <- as.matrix(seq(1,N,1))
pik <- inclusionprobabilities(runif(N),n = 5)
tb = 0.001
tore <- TRUE
toreBound <- N
SIM = 1000
simu(SIM,Xcoord,pik,tb,tore,toreBound)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.