factorR2: R squared of the series' regression on factors

View source: R/factorR2.R

factorR2R Documentation

R squared of the series' regression on factors

Description

factorR2 returns the R^2 of the series' regression on the factors in form of a tibble.

Usage

factorR2(series, factors, plot = F)

Arguments

series

A tibble with multiple time series as columns.

factors

A tibble with factors as columns.

plot

A logical indicator whether the function should additionally return a bar plot of the R^2.

Value

A tibble of R^2 from each time series for each factor will be returned. If plot = TRUE, a plot containing the R^2 is returned and displayed additonally.

Examples

dat <- pca(
  keywords = c("Pluto", "Saturn"),
  categories = 0,
  geo = "DE",
  time = paste("2020-01-01", "2020-06-01")
)

series <- dplyr::select(dat, date, 4:5)
factors <- dplyr::select(dat, date, 2:3)

factorR2(series, factors, plot = TRUE)

johannes97s/ifwtrends documentation built on Oct. 9, 2022, 7:01 p.m.