Calculate the Temporal kernel density estimate based on sampling points in time and events
tkde(events, w, samples, bw, kernel_name, adaptive = FALSE)
A numeric vector representing the moments of occurrence of events
The weight of the events
A numeric vector representing the moments to sample
A float, the bandwidth to use
The name of the kernel to use
Boolean
A numeric vector with the density values at the requested timestamps
data(bike_accidents)
bike_accidents$Date <- as.POSIXct(bike_accidents$Date, format = "%Y/%m/%d")
start <- min(bike_accidents$Date)
diff <- as.integer(difftime(bike_accidents$Date , start, units = "days"))
density <- tkde(diff, rep(1,length(diff)), seq(0,max(diff),1), 2, "quartic")