Type: | Package |
Title: | Inhomogeneous Poisson Point Processes |
Version: | 1.1 |
Date: | 2019-05-21 |
Author: | Niklas Hohmann |
Maintainer: | Niklas Hohmann <Niklas.Hohmann@fau.de> |
Description: | Generates random numbers corresponding to the events on a Poisson point process with changing event rates. This includes the possibility to incorporate additional information such as the number of events occurring or the location of an already known event. It can also generate the probability density functions of specific events in the cases where additional information is available. Based on Hohmann (2019) <doi:10.48550/arXiv.1901.10754>. |
License: | CC BY 4.0 |
Depends: | stats |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2019-05-21 11:02:45 UTC; nick |
Repository: | CRAN |
Date/Publication: | 2019-05-21 12:00:08 UTC |
Inhomogeneous Poisson Point Processes
Description
Generates random numbers corresponding to the events on a Poisson point process with changing event rates. This includes the possibility to incorporate additional information such as the number of events occurring or the location of an already known event. It can also generate the probability density functions of specific events in the cases where additional information is available. Based on Hohmann (2019) <arXiv:1901.10754>.
Details
The DESCRIPTION file:
Package: | IPPP |
Type: | Package |
Title: | Inhomogeneous Poisson Point Processes |
Version: | 1.1 |
Date: | 2019-05-21 |
Author: | Niklas Hohmann |
Maintainer: | Niklas Hohmann <Niklas.Hohmann@fau.de> |
Description: | Generates random numbers corresponding to the events on a Poisson point process with changing event rates. This includes the possibility to incorporate additional information such as the number of events occurring or the location of an already known event. It can also generate the probability density functions of specific events in the cases where additional information is available. Based on Hohmann (2019) <arXiv:1901.10754>. |
License: | CC BY 4.0 |
Depends: | stats |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
Index of help topics:
IPPP-package Inhomogeneous Poisson Point Processes IPPPcond Simulate Location of Events for a Fixed Number of Events IPPPconddens Conditional Probability Density Given the Location of one Event IPPPcondrandnum Generate Events Relative to a Known Event of an Inhomogeneous Poisson Point Process IPPPinterval Simulate the Number of Events in an Interval IPPPnthpointdens Probability Density of Events in an Inhomogeneous Poisson Point Process IPPPuncond Simulate Events according to an Inhomogeneous Poisson Point Process
For the vignette, use vignette("IPPP")
Author(s)
Niklas Hohmann
Maintainer: Niklas Hohmann <Niklas.Hohmann@fau.de>
References
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
Simulate Location of Events for a Fixed Number of Events
Description
Returns a vector of random numbers that correspond to the location of events of an inhomogeneous Poisson point process (IPPP) in the case that the number of events is fixed.
The IPPP is described by a rate function r.
Usage
IPPPcond(samplesize, xrate, yrate, rnpr = 100)
Arguments
samplesize |
Natural number. The number of events occurring |
xrate |
Vector of (strictly increasing) real numbers |
yrate |
Vector of 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) |
rnpr |
OPTIONAL, default is 100. The number of random numbers used per run in the loop of the rejection method. For details see the corresponding preprint |
Details
Below min(xrate) and above max(xrate), the rate function r is assumed to have the value zero.
Value
A vector of length samplesize, containing the locations of the simulated events
Author(s)
Niklas Hohmann
References
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
See Also
IPPPuncond
for the unconditioned version with a random number of events occurring.
vignette("IPPP")
for an overview of the features of the IPPP package and some background.
Examples
#define rate function
sx=1:5
sy=c(0,1,1,3,0)
sm=c(1,0,1,0,-1)
xrate=seq(1,5,length.out=100)
yrate=splinefunH(sx,sy,sm)(xrate)
#plot rate function
plot(xrate,yrate,type='l',xlim=c(0.5,5.5), main='Rate Function')
#simulate location of 5 events:
samplesize=5
p5=IPPPcond(samplesize,xrate,yrate)
points(p5,rep(0,samplesize),cex=2) #plot results
#simulate location of 30 events
samplesize=30
p30=IPPPcond(samplesize,xrate,yrate)
points(p30,rep(1,samplesize),cex=2,pch=3) #compare with former results
Conditional Probability Density Given the Location of one Event
Description
Given knowledge of the location of one event, this function determines the probability density function (pdf) of the distribution of the n-th point above/below the known event.
Usage
IPPPconddens(x, pointlocation, xrate, yrate, nthpoint = 1, mode = "forward")
Arguments
x |
Points at which the values of the pdf are determined |
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) |
nthpoint |
OPTIONAL, default is 1. Setting this to a value i will determine the pdf 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") |
Details
The value of the 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.
Value
Returns a list containing two entries:
x |
Duplicate of the input of the same name |
densval |
Vector consisting of the values of the conditional probability density, evaluated at x |
Author(s)
Niklas Hohmann
References
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
See Also
IPPPnthpointdens
for the probability density of the location of the of the n-th event, given that a fixed number of events occur.
vignette("IPPP")
for an overview of the features of the IPPP package and some background.
Examples
#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 pdf of the event above the known event:
r1=IPPPconddens(x,pointlocation,xrate,yrate)
lines(r1$x,r1$densval,col="red",lwd=3)
#simulate the pdf of the event below the known event:
r2=IPPPconddens(x,pointlocation,xrate,yrate,mode="backward")
lines(r2$x,r2$densval,col="blue",lwd=3)
#simulate the pdf of the third event below the known event:
r2=IPPPconddens(x,pointlocation,xrate,yrate,mode="backward",nthpoint=3)
lines(r2$x,r2$densval,col="green",lwd=3)
Generate Events Relative to a Known Event of an Inhomogeneous Poisson Point Process
Description
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.
Usage
IPPPcondrandnum(pointlocation, xrate, yrate, no = 1, nthpoint = 1, mode = "forward")
Arguments
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"") |
Details
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.
Value
Vector of length no, containing the locations of the simulated events.
Author(s)
Niklas Hohmann
References
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
See Also
vignette("IPPP")
for an overview of the features of the IPPP package and some background.
Examples
#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
Simulate the Number of Events in an Interval
Description
Generates random numbers that correspond to the number of events of an inhomogeneous Poisson point process (IPPP) in a given interval.
The IPPP is described by a rate function r.
Usage
IPPPinterval(from, to, xrate, yrate, no = 1, expsamplesize = NULL)
Arguments
from |
Real number, describing the lower boundary of the interval of interest |
to |
Real number larger than from, describing the upper boundary of the interval of interest |
xrate |
Vector of (strictly increasing) real numbers |
yrate |
Vector of 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 times the random number is determined |
expsamplesize |
OPTIONAL, default is NULL. Setting this parameter to a numeric value changes the average number of events generated by the IPPP as a whole to the chosen value. The number of events in the interval changes accordingly |
Details
Below min(xrate) and above max(xrate), the rate function r is assumed to have the value zero.
Value
Vector of length no, whose i-th entry contains the number of events in the interval generated in the i-th run.
Author(s)
Niklas Hohmann
References
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
See Also
vignette("IPPP")
for an overview of the features of the IPPP package and some background.
Examples
#determine rate function
sx=1:5
sy=c(0,1,1,3,0)
sm=c(1,0,1,0,-1)
xrate=seq(1,5,length.out=100)
yrate=splinefunH(sx,sy,sm)(xrate)
#plot rate function
plot(xrate,yrate,type='l',xlim=c(0.5,5.5), main='Rate Function')
#determine no of events between 3 and 6
from=3
to=5
lines(c(from,from),c(0,10)) #mark interval in the plot
lines(c(to,to),c(0,10))
#simulate the number of events in the interval [from, to]
IPPPinterval(from,to,xrate,yrate) #simulate the number of events in the interval [from, to]
#rescale so that the whole rate function will on average generate 200 events:
IPPPinterval(from,to,xrate,yrate,expsamplesize=200)
#now more events occur in the interval [from, to]!
#Make 20 repetitions of the upper simulation
IPPPinterval(from,to,xrate,yrate,no=20,expsamplesize=200)
Probability Density of Events in an Inhomogeneous Poisson Point Process
Description
Determines values of the probability density function of the n-th point of an inhomogeneous Poisson point process (IPPP), given that a fixed number of events occur. The IPPP is described by a rate function r.
Usage
IPPPnthpointdens(x, n, samplesize, xrate, yrate)
Arguments
x |
Vector of real numbers where the value of the probability density is determined |
n |
Natural number smaller than samplesize. Determines the event for which the probability density is determined. 1=first event from the left, i=i-th event from the left. |
samplesize |
Natural number. The overall number of events occurring |
xrate |
Vector of (strictly increasing) real numbers |
yrate |
Vector of 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) |
Details
Below min(xrate) and above max(xrate), the rate function r is assumed to have the value zero.
Value
A list containing two entries:
x |
A duplicate of the input of the same name |
densval |
A vector consisting of the values of the probability density, evaluated at x |
Author(s)
Niklas Hohmann
References
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
See Also
IPPPconddens
for the probability density of the n-th event above/below the location of some given event.
vignette("IPPP")
for an overview of the features of the IPPP package and some background.
Examples
sx=c(1,2,3,4,5)
sy=c(0,1,1,3,0)
sm=c(1,0,1,0,-1)
xrate=seq(1,5,length.out=100)
yrate=splinefunH(sx,sy,sm)(xrate)
#plot rate function
plot(xrate,yrate,type='l',xlim=c(0.5,5.5), main='Rate Function')
x=seq(0,6,length.out = 1000) #point where the pdf is determined
n=1 #get the pdf of the first point from the left ...
samplesize=5 #... out of a sample of five
ll=IPPPnthpointdens(x,n,samplesize,xrate,yrate)
plot(ll$x,ll$densval,type='l') #plot the resulting pdf
legend('topleft',legend=paste('pdf of point no.',as.character(n),
'out of ',as.character(samplesize)), 'points' ,lty=1)
Simulate Events according to an Inhomogeneous Poisson Point Process
Description
Generates random numbers corresponding to the locations of events of an inhomogeneous Poisson point process (IPPP). The IPPP is described by a rate function r.
Usage
IPPPuncond(xrate, yrate, expsamplesize = NULL, rnpr = 100)
Arguments
xrate |
Vector of (strictly increasing) real numbers |
yrate |
Vector of 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) |
expsamplesize |
OPTIONAL, default is NULL. If this variable is set to a numeric value, it determines the average number of events occurring |
rnpr |
OPTIONAL, default is 100. The number of random numbers used per run in the loop of the rejection method. For more details see the corresponding preprint |
Details
Below min(xrate) and above max(xrate), the rate function r is assumed to have the value zero.
Value
A vector of variable length, containing the generated locations of the events. If no events occur, the output is numeric(0)
Author(s)
Niklas Hohmann
References
Hohmann, Niklas. "Conditional Densities and Simulations of Inhomogeneous Poisson Point Processes: The R package "IPPP"" arXiv 2019. <arXiv:1901.10754>
See Also
IPPPuncond
for a version with a fixed number of events occurring.
vignette("IPPP")
for an overview of the features of the IPPP package and some background.
Examples
#Define rate function
sx=1:5
sy=c(0,1,1,3,0)
sm=c(1,0,1,0,-1)
xrate=seq(1,5,length.out=100)
yrate=splinefunH(sx,sy,sm)(xrate)
#plot rate function
plot(xrate,yrate,type='l',xlim=c(0.5,5.5), main='Rate Function')
p=IPPPuncond(xrate,yrate) #simulate one set of events
points(p,rep(0,length(p)),cex=2) #plot results
#simulate location of events with the expected number of events being 20
expsamplesize=20
pp=IPPPuncond(xrate,yrate,expsamplesize)
length(pp) #in most cases, the result is not exactely 20
points(pp,rep(1,length(pp)),cex=2,pch=3) #compare with former results