bw_cv_likelihood_calc_tkde: Bandwidth selection for Temporal Kernel density estimate by...

View source: R/temporal_kde_sf.R

bw_cv_likelihood_calc_tkdeR Documentation

Bandwidth selection for Temporal Kernel density estimate by likelihood cross validation

Description

Calculate the likelihood cross validation score for several bandwidths for the Temporal Kernel density

Usage

bw_cv_likelihood_calc_tkde(events, w, bws, kernel_name)

Arguments

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

Value

A vector with the cross validation scores (the higher the better).

Examples

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")

spNetwork documentation built on June 22, 2024, 9:40 a.m.