Learn R Programming

valueprhr (version 0.1.0)

run_cca_var_analysis: Run Complete CCA and VAR Analysis

Description

Convenience function to run both sparse CCA and panel/aggregated VAR.

Usage

run_cca_var_analysis(
  direct_prices,
  production_prices,
  panel_data,
  cca_components = 3L,
  verbose = TRUE
)

Value

A list with cca, pvar, agg_var, and granger results.

Arguments

direct_prices

Data frame with direct prices.

production_prices

Data frame with production prices.

panel_data

Data frame in panel format.

cca_components

Number of CCA components. Default 3.

verbose

Logical. Print progress. Default TRUE.

Examples

Run this code
# \donttest{
set.seed(123)
years <- 2000:2019
sectors <- LETTERS[1:5]

direct <- data.frame(Year = years)
production <- data.frame(Year = years)
for (s in sectors) {
  direct[[s]] <- 100 + cumsum(rnorm(20, 2, 1))
  production[[s]] <- 102 + cumsum(rnorm(20, 2, 1))
}

panel <- prepare_panel_data(direct, production)

matrices <- prepare_log_matrices(direct, production)

result <- run_cca_var_analysis(
  direct, production, panel,
  cca_components = 2
)
# }

Run the code above in your browser using DataLab