View source: R/rHardcore.sphwin.R
rHardcore.sphwin | R Documentation |
Generate a random pattern of points, a simulated realisation of the hard core process, using the Metropolis-Hastings simulation algorithm.
rHardcore.sphwin(beta, R=0, p=0.5, m=100, win = sphwin(type="sphere"), proper=TRUE, nsim=1, drop=TRUE, expand=TRUE, as.sp=TRUE, ndim="2")
beta |
intensity parameter (a positive number). |
R |
interaction parameter (a number between 0 and pi*rho, inclusive, where rho is the radius of the sphere that to simulate the point pattern on.). |
p |
Metropolis-Hastings parameter: The conditional probability of proposing a birth given that a birth or death is proposed. |
m |
Metropolis-Hastings parameter: The number of proposals that should be run. |
win |
The window, an object of type |
proper |
Logical. If TRUE, then |
nsim |
Number of simulated realisations to be generated. |
drop |
Logical. If |
expand |
Logical. If |
as.sp |
Logical. If TRUE, returns an object of class as defined by
|
ndim |
A string, taking value |
rHardcore.sphwin
uses the Metropolis Hasting algorithm to generate
a realisation of a hard core process inside the window win
.
The hard core process is a model for spatial inhibition, in which no
points can occur within a distance R
of each other; with
interaction radius R
and parameter beta
, it is the
pairwise interaction point process with probability density
f(x[1], ..., x[n]) = alpha . beta^(n(x))
where x[1], ..., x[n] represent the points of the pattern, n(x) is the number of points in the pattern and alpha is the normalising constant. Intuitively, each point of the pattern contributes a factor beta to the probability density, and each pair of points closer than r units apart contributes a factor gamma to the density.
The Hardcore process may also be generated using
rStrauss.sphwin
, where gamma=0
, but a warning message
is created advising that such a process is hard core rather than
Strauss.
The Metropolis-Hastings algorithm is a Markov Chain, whose states are spatial point patterns, and whose limiting distribution is the desired point process. After running the algorithm for a very large number of iterations, we may regard the state of the algorithm as a realisation from the desired point process.
However, there are difficulties in deciding whether the algorithm has
run for “long enough”. The convergence of the algorithm may indeed be
extremely slow. No guarantees of convergence are given! Hence, the
argument proper
is provided; if proper=FALSE
, then rHardcore.sphwin
will perform
m
iterations of the Metropolis-Hastings algorithm and give the resulting point pattern.
completed. Otherwise, (if proper=TRUE
), then rHardcore.sphwin
ignores m
is ignored and as many
iterations of the Metropolis-Hastings algorithm are performed as is
needed to attain a true hard core process (i.e. with
d(x, X \ {x}) >= R
for all x in X.
While it is fashionable to decry the Metropolis-Hastings algorithm for its poor convergence and other properties, it has the advantage of being easy to implement for a wide range of models.
If nsim=1
and drop=FALSE
then a single item as described below; otherwise a list containing nsim
items.
An item is determined by the values of as.sp
and ndim
:
If as.sp=FALSE
and ndim="2"
, a two column matrix giving the locations of the simulated points.
If as.sp=FALSE
and ndim="3"
, a three column matrix giving the locations of the simulated points.
If as.sp=TRUE
and ndim="2"
, an object of class sp2
giving the locations of the simulated points.
If as.sp=TRUE
and ndim="3"
, an object of class sp3
giving the locations of the simulated points.
This function is the analogue for point processes on the sphere of the
function rmh
in spatstat when used in the
third example in rmh.default
, which is the corresponding
function for point processes in R^2. Hence elements of this help
page have been taken from those for rmh
and
rHardcore
(also in spatstat), with the
permission of A. J. Baddeley. This enables the code to be highly
efficient and give corresponding output to rmh
, and for
the information on this help page to be consistent with that for
rmh
and rHardcore
. It is hoped that this
will minimise or remove any confusion for users of both
spatstat and spherstat.
Tom Lawrence tjlawrence@bigpond.com
Lawrence, T.J. (2017) Master's Thesis, University of Western Australia.
rHardcore
, rMatClust.sphwin
,
rMaternI.sphwin
, rMaternII.sphwin
,
rpoispp.sphwin
, rStrauss.sphwin
,
rThomas.sphwin
rH1 <- rHardcore.sphwin(beta=5, R=0.04*pi, p=0.5, m=100, win=sphwin()) rH1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.