Description Usage Arguments Details Value Author(s) Examples
create a list of line data based on ARIMA(X) predicted result or ts function result(i.e. time series data)
1 2 |
ARIMAmodel |
ARIMA model created by function |
XREG |
if using ARIMAX model, put in the regularized X matrix |
TS |
data created by |
linetype |
"TS" for time series data, "ARIMA" for ARIMA(X) predicted data |
Name |
title for this line |
This function ADDline
is used to conduct a data transformation. It can take in original time-series data generated
by function ts
or fitted ARIMA(X) model generated by function auto.arima
then take out four elements from
those result to create a list which contains content that can be put in function add_lines
or add_trace
.
So that we could add new lines in our plotly plot more easily.
a list contains 4 elements:
X |
data put in parameter "x" of plot_ly function |
TEXT |
rename the lable of variable X |
Y |
data put in parameter "y" of plot_ly function |
NAME |
title of the new line |
SOCR team <http://socr.umich.edu/people/>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | require(forecast)
require(zoo)
require(plotly)
#Firstly create a base plotly plot
Tempplot<-TSplot(48,modArima_train,as.matrix(X_test),title_size = 8,
ts_original = "Original time series",ts_forecast = "Predicted time series")
# Generate a new line with ADDline function
newline<-ADDline(TS = MCSI_Data_monthAvg_ts_Y_test,linetype = "TS",Name = "Original Result")
## Put the new line into our plot
Tempplot%>%
add_lines(x=newline$X,text=newline$TEXT,y=newline$Y,name=newline$NAME,line=list(color="grey"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.