{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) 参考github。 更多参考笔记github。
{r message=FALSE, warning=FALSE} library(TSstudio) library(tidyverse)
{r} typeof(USgas) class(USgas) USgas
注意 input 的格式。
Input object, either a univariate time series object of a class “ts”, “zoo”, “xts”, or a data frame object of a class “data.frame”, “tbl”, “data.table” as long as there is at least one “Date”/“POSIXt” and a “numeric” objects
已经其他时间格式的数据。
{r} ts_seasonal(USgas, type = "all")
这里使用箱型图,更好表现了季节性是否显著,因此可以认为这个包不错。
{r} ts_lags(USgas, lags = 1:12)
这样查询 lag 记录,可以给sense 可以应用到 sales 项目。
{r} ts_heatmap(USgas)
这里研究除了周期、lag之外,其他规律的探查。