wpik {WaveSampling} | R Documentation |
Stratification matrix from inclusion probabilities
Description
The stratification matrix is calculated from the inclusion probabilities. It takes the distances between units into account. See Details.
Usage
wpik(X, pik, bound = 1, tore = FALSE, shift = FALSE, toreBound = -1)
Arguments
X |
matrix representing the spatial coordinates. |
pik |
vector of the inclusion probabilities. The length should be equal to |
bound |
a scalar representing the bound to reach. Default is 1. |
tore |
an optional logical value, if we are considering the distance on a tore. Default is |
shift |
an optional logical value, if you would use a shift perturbation. See Details for more informations. Default is |
toreBound |
a numeric value that specify the size of the grid. Default is -1. |
Details
Entries of the stratification matrix indicates how the units are close from each others. Hence a large value w_{kl}
means that the unit k
is close to the unit l
. This function considers that a unit represents its neighbor till their inclusion probabilities
sum up to bound
.
We define G_k
the set of the nearest neighbor of the unit k
including k
such that the sum of their inclusion
probabilities is just greater than bound
. Moreover, let g_k = \#{G_k}
, the number of elements in G_k
.
The matrix \bf W
is then defined as follows,
-
w_{kl} = \pi_l
if unitl
is in the set of theg_k - 1
nearest neighbor ofk
. -
w_{kl} = \pi_l + 1 - (\sum_{t \in G_k} \pi_t)
if unitl
is theg_k
nearest neighbour ofk
. -
w_{kl} = 0
otherwise.
Hence, the k
th row of the matrix represents
neighborhood or stratum of the unit such that the inclusion probabilities sum up to 1 and
the k
th column the weights that unit k
takes for each stratum.
The option shift
add a small normally distributed perturbation rnorm(0,0.01)
to the coordinates
of the centroid of the stratum considered. This could be useful if there are many unit that have the same distances.
Indeed, if two units have the same distance and are the last unit before that the bound is reached, then the weights
of the both units is updated. If a shift perturbation is used then all the distances are differents and only one unit
weight is update such that the bound is reached.
The shift perturbation is generated at the beginning of the procedure such that each stratum is shifted by the same perturbation.
Value
A sparse matrix representing the spatial weights.
Author(s)
Raphaƫl Jauslin raphael.jauslin@unine.ch
See Also
Examples
N <- 25
n <- 5
X <- as.matrix(cbind(runif(N),runif(N)))
pik <- rep(n/N,N)
W <- wpik(X,pik)