Description Usage Arguments Details Value Author(s) See Also Examples
Generate a random point pattern containing n independent, identically distributed random points with any specified distribution.
1 2 3 
n 
Number of points to generate. 
f 
The probability density of the points,
possibly unnormalised.
Either a constant,
a function 
fmax 
An upper bound on the values of 
win 
Window in which to simulate the pattern.
Ignored if 
... 
Arguments passed to the function 
giveup 
Number of attempts in the rejection method after which the algorithm should stop trying to generate new points. 
verbose 
Flag indicating whether to report details of performance of the simulation algorithm. 
nsim 
Number of simulated realisations to be generated. 
drop 
Logical. If 
This function generates n
independent, identically distributed
random points with common probability density proportional to
f
.
The argument f
may be
uniformly distributed random points will be generated.
random points will be generated
in the window win
with probability density proportional
to f(x,y,...)
where x
and y
are the cartesian
coordinates. The function f
must accept
two vectors of coordinates x,y
and return the corresponding
vector of function values. Additional arguments ...
of any kind
may be passed to the function.
if f
is a pixel image object
of class "im"
(see im.object
) then
random points will be generated
in the window of this pixel image, with probability density
proportional to the pixel values of f
.
The algorithm is as follows:
If f
is a constant, we invoke runifpoint
.
If f
is a function, then we use the rejection method.
Proposal points are generated from the uniform distribution.
A proposal point (x,y) is accepted with probability
f(x,y,...)/fmax
and otherwise rejected.
The algorithm continues until n
points have been
accepted. It gives up after giveup * n
proposals
if there are still fewer than n
points.
If f
is a pixel image, then a random sequence of
pixels is selected (using sample
)
with probabilities proportional to the
pixel values of f
. Then for each pixel in the sequence
we generate a uniformly distributed random point in that pixel.
The algorithm for pixel images is more efficient than that for functions.
A point pattern (an object of class "ppp"
)
if nsim=1
, or a list of point patterns if nsim > 1
.
and \rolf
ppp.object
,
owin.object
,
runifpoint
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  # 100 uniform random points in the unit square
X < rpoint(100)
# 100 random points with probability density proportional to x^2 + y^2
X < rpoint(100, function(x,y) { x^2 + y^2}, 1)
# `fmax' may be omitted
X < rpoint(100, function(x,y) { x^2 + y^2})
# irregular window
data(letterR)
X < rpoint(100, function(x,y) { x^2 + y^2}, win=letterR)
# make a pixel image
Z < setcov(letterR)
# 100 points with density proportional to pixel values
X < rpoint(100, Z)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.