| plot.wf_optimization_result | R Documentation |
Visual diagnostics for a wf_optimization_result returned by
run_walk_forward(). Supported types:
"parameters": best parameter values chosen per window.
"is_oos": in-sample vs out-of-sample scores by window.
"equity": stitched out-of-sample equity curve.
"drawdown": drawdown of the stitched OOS curve.
"windows": per-window bar/line chart of an OOS metric (see metric).
"stability": summary of parameter stability.
"distributions": distributions of IS/OOS scores across windows.
## S3 method for class 'wf_optimization_result'
plot(
x,
y = NULL,
type = c("parameters", "is_oos", "equity", "drawdown", "windows", "stability",
"distributions"),
param = NULL,
metric = NULL,
main = NULL,
sub = NULL,
xlab = NULL,
ylab = NULL,
...
)
x |
A |
y |
Ignored. |
type |
One of "parameters","is_oos","equity","drawdown", "windows","stability","distributions". |
param |
Character vector of parameter names to include for
"parameters"/"stability"/"distributions". If |
metric |
Character; column to plot for "is_oos" or "windows" (e.g., "OOS_Return" or "OOS_Score"). Ignored for other types. |
main, sub, xlab, ylab |
Base plotting annotations. |
... |
Additional plot options (type-specific). |
Invisibly, a small list describing the plot.
run_walk_forward(), wf_report(), print.wf_optimization_result()
data(sample_prices_weekly)
b <- function(prices, params, ...) {
weight_equally(filter_top_n(calc_momentum(prices, params$lookback),
params$top_n))
}
wf <- run_walk_forward(
prices = sample_prices_weekly,
grid = list(lookback = c(8, 12, 26), top_n = c(5, 10)),
builder = b,
is_periods = 52, oos_periods = 26, step = 26
)
plot(wf, type = "parameters")
plot(wf, type = "is_oos", metric = "OOS_Score")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.