set.seed(1)
library(ggplot2)
# Invariants
ret <- diff(log(EuStockMarkets))
n <- nrow(ret)
#' Prior probability distribution
prior <- rep(1 / n, n)
# Simulated marginals
simul <- bootstrap_scenarios(ret, as_ffp(prior), as.double(n))
views <- view_on_joint_distribution(x = ret, simul = simul, p = prior)
views
ep <- entropy_pooling(p = prior, Aeq = views$Aeq, beq = views$beq, solver = "nlminb")
autoplot(ep)
# location matches
colMeans(simul)
ffp_moments(x = ret, p = ep)$mu
# dispersion matches
cov(simul)
ffp_moments(x = ret, p = ep)$sigma
Run the code above in your browser using DataLab