View source: R/plot_functions.R
plot_trend | R Documentation |
Trend plot
plot_trend(
y_0,
y_hat,
dates,
pt_num = 4,
col_vec = NULL,
line_size = rep(0.75, ncol(y_hat) + 1),
alpha_size = rep(0.75, ncol(y_hat) + 1),
xlab = NULL,
ylab = NULL
)
y_0 |
True predict target, length n vector |
y_hat |
Predicted values by m different methods, n-by-m matrix, colnames well defined |
dates |
Date vector of class "Date". |
pt_num |
Number date points (pt_num + 1) wanted on the x-axis |
col_vec |
A vector indicates colors of different trends. |
line_size |
line size for each trend |
alpha_size |
degree of appearance |
xlab |
x-axis label |
ylab |
y-axis label |
A ggplot output
data("forecast_result")
data("raw_data_h1")
D <- raw_data_h1[!is.na(raw_data_h1$LongReturn), ]
dates <- zoo::as.Date.yearmon(D$yyyymm[-(1:180)])
y0 <- forecast_result$y[-(1:180)]
y_hat <-cbind(forecast_result$Lasso$y_hat,
forecast_result$Lasso_Std$y_hat,
forecast_result$ALasso$y_hat)
colnames(y_hat) <- c("lasso", "lasso_std", "alasso")
plot_trend(y0, y_hat, dates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.