view_on_rank | R Documentation |
Helper to construct views on relative performance of assets.
view_on_rank(x, rank) ## Default S3 method: view_on_rank(x, rank) ## S3 method for class 'matrix' view_on_rank(x, rank) ## S3 method for class 'xts' view_on_rank(x, rank) ## S3 method for class 'tbl_df' view_on_rank(x, rank)
x |
An univariate or a multivariate distribution. |
rank |
A |
If rank = c(2, 1)
it is implied that asset in the first column will outperform
the asset in the second column. For longer vectors the interpretation
is the same: assets on the right will outperform assets on the left.
A list
of the view
class.
library(ggplot2) # Invariants x <- diff(log(EuStockMarkets)) prior <- rep(1 / nrow(x), nrow(x)) # asset in the first col will outperform the asset in the second col (DAX will # outperform SMI). views <- view_on_rank(x = x, rank = c(2, 1)) views ep <- entropy_pooling(p = prior, A = views$A, b = views$b, solver = "nloptr") autoplot(ep) # Prior Returns (SMI > DAX) colMeans(x)[1:2] # Posterior Returns (DAX > SMI) ffp_moments(x, ep)$mu[1:2]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.