plot_coef: Coefficient plot

View source: R/plot_functions.R

plot_coefR Documentation

Coefficient plot

Description

Coefficient plot

Usage

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
)

Arguments

coef_est

estimated slope by m different methods, list of length m with each element n-by-p matrix
names of list well defined

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.
e.g.: c("#D8DBE2", "#F46B7B", "#518DE8", "#FFBC42" )
If NULL, use ggplot default.

line_size

line size for each trend

alpha_size

degree of appearance

xlab

x-axis label

ylab

y-axis label

Value

A ggplot output

Examples

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)


zhan-gao/LasForecast documentation built on Sept. 18, 2024, 9:40 p.m.