Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/IPPPcondrandnum.R
Given knowledge of the location of one event from an inhomogeneous Poisson point process (IPPP), this function determines random numbers corresponding to the location of the n-th event above/below the known event.
The IPPP is described by a rate function r.
1 | IPPPcondrandnum(pointlocation, xrate, yrate, no = 1, nthpoint = 1, mode = "forward")
|
pointlocation |
Location of the known event |
xrate |
Vector of (strictly increasing) real numbers |
yrate |
Vector of strictly positive real numbers of the same length as xrate. The vectors xrate and yrate form the rate function r in the sense that r=approxfun(xrate,yrate) |
no |
OPTIONAL, default is 1. The number of random events to generate |
nthpoint |
OPTIONAL, default is 1. Setting this to a value i will simulate the location of the ith event above/below the event at the position pointlocation |
mode |
OPTIONAL, default is "forward". Determines whether the pdf for points above(right) the known event is determined (mode="forward""), or whether the pdf for points below(left) the known event is determined (mode="backward"") |
The value of rate function r below min(xrate) is set to r(min(xrate)), and for values above max(xrate) it is set to r(max(xrate)). Both r(min(xrate)) and r(max(xrate)) need to be strictly positive for the results to be correct.
Vector of length no, containing the locations of the simulated events.
Niklas Hohmann
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
vignette("IPPP")
for an overview of the features of the IPPP package and some background.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #define rate function
xrate=seq(0,2*pi,length.out=1000)
yrate=sin(xrate)+1.01
plot(xrate,yrate,type="l",main="Rate Function")
#define known event:
pointlocation=3
lines(c(3,3),c(0,3),lwd=3)
#values where the density is calulated:
x=xrate
#simulate the next point above the known event:
p1=IPPPcondrandnum(pointlocation, xrate,yrate)
points(p1,0.5,pch=1,cex=2)
#simulate 10 times the next event below the known location:
p2=IPPPcondrandnum(pointlocation, xrate,yrate,no=10,mode="backward")
points(p2,rep(1,length(p2)),cex=2,pch=2)
#simulate the second point above the known event:
p3=IPPPcondrandnum(pointlocation, xrate,yrate,no=1,nthpoint=2)
points(p3,1.5,cex=2,pch=3) #might be out of the plot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.