nhpp <- thinning(maxTime = 12, seed = 8675309, plotDelay = 0)
nhpp <- thinning(maxTime = 24, seed = 8675309, plotDelay = 0)
# \donttest{
nhpp <- thinning(maxTime = 48, seed = 8675309, plotDelay = 0)
# thinning with custom intensity function and default majorizing function
intensity <- function(x) {
day <- 24 * floor(x/24)
return(80 * (dnorm(x, day + 6, 2.5) +
dnorm(x, day + 12.5, 1.5) +
dnorm(x, day + 19, 2.0)))
}
nhpp <- thinning(maxTime = 24, plotDelay = 0, intensityFcn = intensity)
# thinning with custom intensity and constant majorizing functions
major <- function(x) { 25 }
nhpp <- thinning(maxTime = 24, plotDelay = 0, intensityFcn = intensity,
majorizingFcn = major)
# piecewise-constant data.frame for bounding default intensity function
fpwc <- data.frame(
x = c(0, 2, 20, 30, 44, 48),
y = c(5, 5, 20, 12, 20, 5)
)
nhpp <- thinning(maxTime = 24, plotDelay = 0, majorizingFcn = fpwc, majorizingFcnType = "pwc")
# piecewise-linear data.frame for bounding default intensity function
fpwl <- data.frame(
x = c(0, 12, 24, 36, 48),
y = c(5, 25, 10, 25, 5)
)
nhpp <- thinning(maxTime = 24, plotDelay = 0, majorizingFcn = fpwl, majorizingFcnType = "pwl")
# piecewise-linear closure/function bounding default intensity function
fclo <- function(x) {
if (x <= 12) (5/3)*x + 5
else if (x <= 24) 40 - (5/4)*x
else if (x <= 36) (5/4)*x - 20
else 85 - (5/3) * x
}
nhpp <- thinning(maxTime = 48, plotDelay = 0, majorizingFcn = fclo)
# thinning with fancy custom intensity function and default majorizing
intensity <- function(x) {
day <- 24 * floor(x/24)
return(80 * (dnorm(x, day + 6, 2.5) +
dnorm(x, day + 12.5, 1.5) +
dnorm(x, day + 19, 2.0)))
}
nhpp <- thinning(maxTime = 24, plotDelay = 0, intensityFcn = intensity)
# piecewise-linear data.frame for bounding custom intensity function
fpwl <- data.frame(
x = c(0, 6, 9, 12, 16, 19, 24, 30, 33, 36, 40, 43, 48),
y = c(5, 17, 12, 28, 14, 18, 7, 17, 12, 28, 14, 18, 7)
)
nhpp <- thinning(maxTime = 48, plotDelay = 0, intensityFcn = intensity,
majorizingFcn = fpwl, majorizingFcnType = "pwl")
# thinning with simple custom intensity function and custom majorizing
intensity <- function(t) {
if (t < 12) t
else if (t < 24) 24 - t
else if (t < 36) t - 24
else 48 - t
}
majorizing <- data.frame(
x = c(0, 12, 24, 36, 48),
y = c(1, 13, 1, 13, 1))
times <- thinning(plotDelay = 0, intensityFcn = intensity,
majorizingFcn = majorizing , majorizingFcnType = "pwl", maxTime = 48)
# }
Run the code above in your browser using DataLab