view_on_mean | R Documentation |
Helper to construct views on expected returns.
view_on_mean(x, mean) ## Default S3 method: view_on_mean(x, mean) ## S3 method for class 'matrix' view_on_mean(x, mean) ## S3 method for class 'xts' view_on_mean(x, mean) ## S3 method for class 'tbl_df' view_on_mean(x, mean)
x |
An univariate or a multivariate distribution. |
mean |
A |
A list
of the view
class.
library(ggplot2) # Invariant ret <- diff(log(EuStockMarkets)) n <- nrow(ret) # View on expected returns (here is 2% for each asset) mean <- rep(0.02, 4) # Prior probabilities (usually equal weight scheme) prior <- rep(1 / n, n) # View views <- view_on_mean(x = ret, mean = mean) views # Optimization ep <- entropy_pooling(p = prior, Aeq = views$Aeq, beq = views$beq, solver = "nlminb") autoplot(ep) # Probabilities are twisted in such a way that the posterior # `mu` match's exactly with previously stated beliefs ffp_moments(x = ret, p = ep)$mu
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.