View source: R/risk_analysis.R
| create_regime_buckets | R Documentation |
Transforms continuous indicators into discrete regime categories.
create_regime_buckets(
indicator,
breakpoints,
labels = NULL,
use_percentiles = FALSE
)
indicator |
Numeric vector or data frame with indicator values |
breakpoints |
Numeric vector of breakpoints |
labels |
Optional character vector of regime names |
use_percentiles |
Use percentiles instead of fixed breakpoints (default: FALSE) |
Integer vector of regime classifications
data("sample_prices_weekly")
momentum <- calc_momentum(sample_prices_weekly, lookback = 12)
selected <- filter_top_n(momentum, 10)
# Create VIX-like indicator from volatility
vol <- calc_rolling_volatility(sample_prices_weekly, lookback = 20)
vix_proxy <- vol$SPY * 100 # Scale to VIX-like values
regimes <- create_regime_buckets(vix_proxy, c(15, 25))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.