| rpoint3 | R Documentation |
Generate a random point pattern in three-dimensional space
containing n independent, identically distributed random points
with a specified distribution.
rpoint3(n, f, fmax = NULL, domain = box3(), ...,
nsim = 1, drop = TRUE, ex = NULL, giveup = 1000)
n |
Number of points to generate. |
f |
The probability density of the points,
possibly un-normalised.
Either a constant, or a function |
fmax |
An upper bound on the values of |
domain |
Three-dimensional box (object of class |
... |
Additional arguments passed to the function |
nsim |
Number of simulated realisations to be generated. |
drop |
Logical. If |
ex |
Optional. Example point pattern in three dimensions
(object of class |
giveup |
Integer. Maximum number of attempts permitted in the rejection method. |
This function generates n independent, identically distributed
random points with common probability density proportional to
f inside the specified three-dimensional region domain.
The argument f may be
uniformly distributed random points will be generated.
random points will be generated
in the domain with probability density proportional
to f(x, y, z, ...) where x, y, z
are the cartesian
coordinates. The function f must accept
vectors of coordinates x,y,z and return the corresponding
vector of function values. Additional arguments ... of any kind
may be passed to the function.
The algorithm is as follows:
If f is a constant, we invoke runifpoint3.
If f is a function, then we use the rejection method.
Proposal points are generated from the uniform distribution.
A proposal point (x,y,z) is accepted with probability
f(x,y,z,...)/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.
A three-dimensional point pattern (an object of class "pp3")
if nsim=1 and drop=TRUE,
otherwise a list of three-dimensional point patterns.
.
runifpoint3
rpoint3(10, 1)
rpoint3(10, f=function(x,y,z) {sqrt(x)}, fmax=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.