tkde: Temporal Kernel density estimate

View source: R/temporal_kde_sf.R

tkdeR Documentation

Temporal Kernel density estimate

Description

Calculate the Temporal kernel density estimate based on sampling points in time and events

Usage

tkde(events, w, samples, bw, kernel_name, adaptive = FALSE)

Arguments

events

A numeric vector representing the moments of occurrence of events

w

The weight of the events

samples

A numeric vector representing the moments to sample

bw

A float, the bandwidth to use

kernel_name

The name of the kernel to use

adaptive

Boolean

Value

A numeric vector with the density values at the requested timestamps

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"))
density <- tkde(diff, rep(1,length(diff)), seq(0,max(diff),1), 2, "quartic")

JeremyGelb/spNetwork documentation built on May 24, 2024, 7:23 p.m.