View source: R/plot_functions.R
plot_coef | R Documentation |
Coefficient plot
plot_coef(
coef_est,
dates,
pt_num = 4,
col_vec = NULL,
line_size = rep(0.75, length(coef_est)),
alpha_size = rep(0.75, length(coef_est)),
xlab = NULL,
ylab = NULL,
num_col = 1
)
coef_est |
estimated slope by m different methods, list of length m with each element n-by-p matrix |
dates |
Date vector of class "Date". |
pt_num |
Number date points (pt_num + 1) wanted on the x-axis Use lubridate and zoo to transfer original date vector to "Date" class |
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)])
coef_est <- list(lasso = forecast_result$Lasso$beta_hat[, 1:6],
alasso = forecast_result$ALasso$beta_hat[, 1:6])
plot_coef(coef_est, dates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.