ts_daily_decomp: Time Series Forecast and Decomposition for Daily Crime Data

Description Usage Arguments Value Author(s) Examples

View source: R/ts_daily_decomp.R

Description

This function transforms daily crime count data and plots the resultant components of a time series which has been decomposed into seasonal, trend, and irregular components using Loess smoothing. Holt Winters exponential smoothing is also performed for inproved trend resolution since data is in a daily format.

Usage

1

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.

Value

Returns an object of class "stl" with the following components:

time.series: a multiple time series with columns seasonal, trend and remainder.

weights: the final robust weights (all one if fitting is not done robustly).

call: the matched call.

win: integer (length 3 vector) with the spans used for the "s", "t", and "l" smoothers.

deg: integer (length 3) vector with the polynomial degrees for these smoothers.

jump: integer (length 3) vector with the 'jumps' (skips) used for these smoothers.

inner: number of inner iterations

Author(s)

Jamie Spaulding, Keith Morris

Examples

1
2
3
4
#Using provided dataset from Chicago Data Portal:
data(crimes)
test <- ts_daily_decomp(data = crimes, start = c(2017, 1, 1))
plot(test)

rcrimeanalysis documentation built on July 8, 2020, 7:34 p.m.