Collect your own time series data and import into R (e.g. you can use quantmod to collect stock data)
Figure 1: Time Series Plot of Clover Health Insurance Stocks.
Figure 2: Candlestick Time Series Plot of Clover Health Insurance Stocks.
Examine class of time series object and variables:
i. Trend
Trend refers to the general movement of the data over time, such as in the example time series plots. The trend of the CLOV data had a fairly stable neutral trend until July 2021, which has since been on a general downwards trend.
ii. Stationarity
Stationarity is demonstrated by a flat looking series, without trend, constant variance over time, a constant autocorrelation structure over time and no periodic fluctuations (seasonality). On the other hand, nonstationarity is the status of a time series whose statistical properties are changing through time. The CLOV data generally is nonstationary, i.e., the CLOV data does have a general negative trend.
iii. pdq
A nonseasonal ARIMA model is classified as an “ARIMA(p,d,q)” model, where: p is the number of autoregressive terms, d is the number of nonseasonal differences needed for stationarity, and q is the number of lagged forecast errors in the prediction equation. The pdq of the CLOV data generally, at least since July 2021, could be generally predicted due to general negative trend and nonstationarity.
# Plotting time series data using TSstudiolapply(c("quantmod", "tidyverse","TSstudio"), require, character.only =TRUE)
Loading required package: quantmod
Loading required package: xts
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: TTR
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
m =tail(CLOV, n=30)m =m[,1:(ncol(m)-2)] # drop last two columns names(m)<-c('Open', 'High', 'Low', 'Close') # rename columns for plottingpath <-getwd()setwd("~/Documents/Fall 2022/EPPS 6356/samantha-manuel.github.io") # place dygraph.css into the same directorydygraph(m, main ="Clover Health Insurance Stock Prices (Candlestick Chart)") |>dyCandlestickGroup(c('Open', 'High', 'Low', 'Close')) |>dyCandlestick() |>dyLegend(show ="always", hideOnMouseOut = T) |>dyCSS("dygraph.css")