spl_Arrs: Arrival time generation for a cubic spline function composed...

Description Usage Arguments Value Examples

View source: R/spl_Arrs.R

Description

This thinning-based algorithm returns arrivals from the cubic spline function arrival rate

Usage

1

Arguments

knots

The knots upon which the B-spline is built - output 2 of the spl_Fit function (spl_Fit$Knots)

c

The spline-coefficients of the spline function - output 1 of the spl_Fit function (spl_Fit$Opt_Spl_Coeffs)

m

The number of days of arrivals required

Value

Arrivals - An unsorted vector containing the arrivals from day 1 to m one day after another

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## spline-based intensity defined on [0,10]
d<-3        #spline function degree
knots<-seq(-3,13,by=1)
n<-length(knots)-(d+1)
c<-runif(n,1,5)
m<-5
## plot the spline-based function and the arrivals
x<-seq(0,10-0.01,by=0.01)
plot(x,spl(x,knots,c),lwd=0.5,ylim=c(0,5),type="l")
Arrs<-spl_Arrs(knots,c,m)
points(sort(Arrs),rep(0,length(Arrs)))

morganle/NHPPspline documentation built on July 10, 2020, 7:07 p.m.