Description Usage Arguments Details Value Author(s) Examples
Plotly method working on time series analysis. Work only for month & year dataset(i.e. dataset that can
satisfy the format required by function as.yearmon
from package zoo
)
1 2 3 4 |
origin_t |
Number of periods of original time series data you wish to include in the plot write all if all periods should be included |
ARIMAmodel |
ARIMA model created by function |
XREG |
if using ARIMAX model, put in the regularized X matrix |
NEWtitle |
title for this plot |
Ylab |
label of Y axis |
Xlab |
label of X axis |
ts_original |
label for original time series line |
ts_forecast |
label for forecasted time series line |
title_size |
size of the title |
The function TSplot
is based on package plotly
. It applies plot_ly
function to create
interactive plot for time-series analysis result. It requires a fitted model by function auto.arima
.
If you are fitting an ARIMA model with external regressors (i.e. Xreg
), then you must put inside the
external regressors again.
a plot result created by plot_ly() function
SOCR team <http://socr.umich.edu/people/>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | require(forecast)
require(zoo)
require(plotly)
# Creating time series data
MCSI_Data_monthAvg_ts_Y <- ts(Y, start=c(1978,1), end=c(2018, 12), frequency = 12)
# Applying ARIMAX model
modArima <- auto.arima(MCSI_Data_monthAvg_ts_Y, xreg=X)
# Creating plot_ly results
## 48 means that there will be 48 periods from the original
## time series dataset that is included in the plot result.
## You could also change this to "all" to see all original dataset in a single plot.
TSplot(48,modArima,X_new,title_size = 8,ts_original = "Original time series",
ts_forecast = "Predicted time series")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.