R/temporal_kde_sf.R
bw_cv_likelihood_calc_tkde.Rd
Calculate the likelihood cross validation score for several bandwidths for the Temporal Kernel density
bw_cv_likelihood_calc_tkde(events, w, bws, kernel_name)
A numeric vector representing the moments of occurrence of events
The weight of the events
A numeric vector, the bandwidths to use
The name of the kernel to use
A vector with the cross validation scores (the higher the better).
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"))
w <- rep(1,length(diff))
scores <- bw_cv_likelihood_calc_tkde(diff, w, seq(10,60,10), "quartic")