ts_month_decomp: Time Series Decomposition for Monthly Crime Data

View source: R/ts_month_decomp.R

ts_month_decompR Documentation

Time Series Decomposition for Monthly Crime Data

Description

This function transforms traditional crime data and plots the resultant components of a time series which has been decomposed into seasonal, trend and irregular components using Loess smoothing.

Usage

ts_month_decomp(data, start)

Arguments

data

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

start

The year in which the time series data starts. The time series is assumed to be composed of solely monthly count data

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

#Using provided dataset from Chicago Data Portal:
data(crimes)
test <- ts_month_decomp(crimes, 2017)
plot(test)

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