bind_views: Stack Different Views

View source: R/views.R

bind_viewsR Documentation

Stack Different Views

Description

Bind views for entropy programming.

Usage

bind_views(...)

Arguments

...

Objects of the class ffp_views to combine.

Value

A list of the view class.

Examples

library(ggplot2)

# Invariant
ret <- diff(log(EuStockMarkets))
n   <- nrow(ret)

# Prior probabilities (usually equal weight scheme)
prior <- rep(1 / n, n)

# Prior belief for expected returns (here is 0% for each asset)
view_mean <- view_on_mean(x = ret, mean = rep(0, 4))

#' view on volatility
vol <- apply(ret, 2, stats::sd) * 1.1 # volatility 10% higher than average
view_volatility <- view_on_volatility(x = ret, vol = vol)

views_comb <- bind_views(view_mean, view_volatility)
views_comb

ep <- entropy_pooling(p      = prior,
                      Aeq    = views_comb$Aeq,
                      beq    = views_comb$beq,
                      A      = views_comb$A,
                      b      = views_comb$b,
                      solver = "nlminb")
autoplot(ep)

ffp documentation built on Sept. 29, 2022, 5:10 p.m.