Learn R Programming

PortfolioTesteR (version 0.1.4)

plot.performance_analysis: Plot Performance Analysis Results

Description

S3 method for visualizing performance metrics. Supports multiple plot types including summary dashboard, return distributions, risk evolution, and rolling statistics.

Usage

# S3 method for performance_analysis
plot(x, type = "summary", ...)

Value

NULL (creates plot)

Arguments

x

performance_analysis object

type

Plot type: "summary", "returns", "risk", "drawdown"

...

Additional plotting parameters

Examples

Run this code
data("sample_prices_weekly")
data("sample_prices_daily")
syms_all <- intersect(names(sample_prices_weekly)[-1], names(sample_prices_daily)[-1])
syms <- syms_all[seq_len(min(3L, length(syms_all)))]
P <- sample_prices_weekly[, c("Date", syms), with = FALSE]
D <- sample_prices_daily[,  c("Date", syms), with = FALSE]
mom <- calc_momentum(P, lookback = 12)
sel <- filter_top_n(mom, n = 3)
W   <- weight_equally(sel)
res <- run_backtest(P, W)
perf <- analyze_performance(res, D, benchmark_symbol = syms[1])
if (interactive()) {
  plot(perf, type = "summary")
}

Run the code above in your browser using DataLab