spl_Fit: Fitting a spline function from cardinal B-splines

Description Usage Arguments Value Examples

View source: R/spl_Fit.R

Description

This function fits a spline function from cardinal B-splines and returns the optimal spline coefficients and the knot points it was built upon

Usage

1
2
spl_Fit(Arrivals, m, n_arrs, Tstart, Tend, kn, cyclic, c_init = NULL,
  pplot = NULL)

Arguments

Arrivals

A vector of arrival times. If multiple days the days are appended and not sorted.

m

A scalar number of days of arrival data

n_arrs

A vector containint the number of arrivals on each observed day

Tstart

The start of the period of observation

Tend

The end of the period of observation

kn

The number of knots on which to build the spline function

cyclic

A TRUE/FALSE value stating whether the spline function should be constrained to be cyclic or not

c_init

(optional) If provided this is a scalar that tell us initial constant value from which to start the search for the optimal spline coefficients.

plot

(optional) If provided this is says whether to output a pplot or not. If you do not want a plot do not use this parameter, if you do make pplot=0

Value

Opt_Spl_Coeffs - The optimised spline coefficients

Knots - The knots on which the spline function was built

Examples

1
2
3
4
5
6
7
8
9
## Fitting the spline-based intensity given arrivals from a cyclic sinusoidal
data(Arrs)
data(n_Arrs)
m<-length(n_Arrs)
Tstart<-0
Tend<-24
kn<-50
cyclic=TRUE
spl_Fit(as.numeric(Arrs),m,as.numeric(n_Arrs),Tstart,Tend,kn,cyclic,pplot=0)

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