show_hawkes {stelfi} | R Documentation |
Plot Hawkes intensity
Description
Plots a Hawkes intensity function, options to extend to non-homogeneous background intensity.
Plots a number of goodness-of-fit plots for a fitted Hawkes process. Includes 1) a comparison of the compensator and observed events, 2) a histogram of transformed interarrival times, 3) a Q-Q plot of transformed interarrival times, and 4) the CDF of consecutive interarrival times, In addition, results of a Kolmogorov-Smirnov and Ljung-Box hypothesis test for the interarrival times are printed.
Usage
show_hawkes(obj)
show_hawkes_GOF(
obj,
background_integral = NULL,
plot = TRUE,
return_values = FALSE
)
Arguments
obj |
Either object returned by |
background_integral |
Function, as defined in |
plot |
Logical, whether to plot goodness-of-fit plots. Default |
return_values |
Logical, whether to return GOF values. Default |
Value
show_hawkes
returns a gtable
object
with geom_line
and geom_histogram
values.
show_hawkes_GOF
returns no value unless return_values = TRUE
,
in this case a list of interarrival times is returned.
Examples
data(retweets_niwa, package = "stelfi")
times <- unique(sort(as.numeric(difftime(retweets_niwa, min(retweets_niwa),units = "mins"))))
params <- c(mu = 9, alpha = 3, beta = 10)
show_hawkes(list(times = times, params = params))
fit <- fit_hawkes(times = times, parameters = params)
show_hawkes(fit)
data(retweets_niwa, package = "stelfi")
times <- unique(sort(as.numeric(difftime(retweets_niwa, min(retweets_niwa),units = "mins"))))
params <- c(mu = 9, alpha = 3, beta = 10)
show_hawkes_GOF(list(times = times, params = params))
fit <- fit_hawkes(times = times, parameters = params)
show_hawkes_GOF(fit)