| scores_oos_only | R Documentation |
Utility used in the chapter’s diagnostics: keep scores only on dates when a
portfolio decision was actually made (non-zero realised weights); set other
dates to NA. Inputs are wide by symbol with a Date column.
scores_oos_only(scores_dt, weights_wide)
scores_dt |
Wide table of model scores with columns |
weights_wide |
Wide table of realised portfolio weights with columns
|
A copy of scores_dt where rows not matching decision dates are set to NA
(except the Date column). If either input is empty, returns scores_dt[0].
pt_collect_results()
Other Chapter3-helpers:
pt_collect_results()
# Toy example
dates <- as.Date("2020-01-01") + 7*(0:5)
scores <- data.frame(
Date = dates,
AAA = seq(0.1, 0.6, length.out = 6),
BBB = rev(seq(0.1, 0.6, length.out = 6))
)
weights <- data.frame(
Date = dates,
AAA = c(0, 0.1, 0, 0.2, 0, 0.15),
BBB = c(0, 0, 0, 0, 0, 0 )
)
scores_oos_only(scores, weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.