Skip to contents

Takes a fitted nhpp object and a vector of future cumulative times, returning predicted cumulative events with confidence bounds.

Usage

predict_nhpp(object, time, conf_level = 0.95)

Arguments

object

An object of class nhpp returned by nhpp().

time

A numeric vector of cumulative times at which to forecast. All values must be finite and > 0.

conf_level

Confidence level (default 0.95).

Value

An object of class nhpp_predict containing:

time

Forecast times.

cum_events

Predicted cumulative events.

lower_bounds

Lower confidence bounds.

upper_bounds

Upper confidence bounds.

conf_level

Confidence level used.

model_type

Model type.

nhpp_object

The original nhpp object.

Examples

time <- c(200, 400, 600, 800, 1000)
event <- c(3, 5, 4, 7, 6)
fit <- nhpp(time, event)
fc <- predict_nhpp(fit, time = c(1500, 2000))
print(fc)
#> NHPP Forecast (Power Law) 
#> -------------------------- 
#>  Time Cum.Events Lower (95%) Upper (95%)
#>  1500       40.9        26.9        62.1
#>  2000       57.8        36.9        90.5
plot(fc, main = "NHPP Forecast", xlab = "Time", ylab = "Cumulative Events")