| weight_by_rank | R Documentation |
Weights securities based on their rank rather than raw signal values. Useful when signal magnitudes are unreliable but ordering is meaningful.
weight_by_rank(
selected_df,
signal_df,
method = c("linear", "exponential"),
ascending = FALSE
)
selected_df |
Binary selection matrix |
signal_df |
Signal values for ranking |
method |
Weighting method: "linear" or "exponential" |
ascending |
Sort order for ranking (default: FALSE) |
Data.table with rank-based weights
data("sample_prices_weekly")
momentum <- calc_momentum(sample_prices_weekly, lookback = 12)
selected <- filter_top_n(momentum, 10)
# Linear rank weighting (best gets most)
weights <- weight_by_rank(selected, momentum, method = "linear")
# Exponential (heavy on top stocks)
weights_exp <- weight_by_rank(selected, momentum, method = "exponential")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.