Nothing
#' Fit a homogeneous poisson process to event data
#'
#' Compute maximum likelihood estimator of the rate of a homogeneous Poisson
#' process for the given events.
#'
#' @param events vector containing the event times.
#' @param end end of observation period, starting from 0 (default is last event)
#'
#' @return a hpp object containing the events and the estimated parameter
#' @export
#' @examples
#' pois_y <- pp_hpp(lambda = 1)
#' events <- pp_simulate(pois_y, end = 10)
#' fithpp(events)
fithpp <- function(events, end = max(events)) {
start <- 0
if (start == end) {
stop("Start and end time are equal.")
}
n <- length(events)
lambda <- n / (end - start)
hpp_object <- list(lambda = lambda, events = events)
class(hpp_object) <- "hpp"
return(hpp_object)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.