View source: R/temporal_kde_sf.R
bw_cv_likelihood_calc_tkde | R Documentation |
Calculate the likelihood cross validation score for several bandwidths for the Temporal Kernel density
bw_cv_likelihood_calc_tkde(events, w, bws, kernel_name)
events |
A numeric vector representing the moments of occurrence of events |
w |
The weight of the events |
bws |
A numeric vector, the bandwidths to use |
kernel_name |
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.