ts_forecast: Time Series Forecast for Daily Crime Data

View source: R/ts_forecast.R

ts_forecastR Documentation

Time Series Forecast for Daily Crime Data

Description

This function transforms traditional crime data into a time series and forecasts future incident counts based on the input data over a specified duration. The forecast is computed using simple exponential smoothing with additive errors. Returned is a plot of the time series, trend, and the upper and lower prediction limits for the forecast.

Usage

ts_forecast(data, start, duration = NULL)

Arguments

data

Data frame of crime or RMS data. See provided Chicago Data Portal example for reference

start

Start date for the time series being analyzed. The format is as follows: c('year', 'month', 'day'). See example below for reference.

duration

Number of days for the forecast. If NULL, the default duration for the forecast is 365 days.

Value

Returns a plot of the time series entered (black), a forecast over the specified duration (blue), the exponentially smoothed trend for both the input data (red) and forecast (orange), and the upper and lower bounds for the prediction interval (grey).

Author(s)

Jamie Spaulding, Keith Morris

Examples

#Using provided dataset from Chicago Data Portal:
data(crimes)
ts_forecast(crimes, start = c(2017, 1, 1))

rcrimeanalysis documentation built on May 31, 2023, 8:54 p.m.