Learn R Programming

ffp (version 0.2.2)

view_on_joint_distribution: Views on Joint Distribution

Description

Helper to construct constraints on the entire distribution.

Usage

view_on_joint_distribution(x, simul, p)

# S3 method for default view_on_joint_distribution(x, simul, p)

# S3 method for matrix view_on_joint_distribution(x, simul, p)

# S3 method for xts view_on_joint_distribution(x, simul, p)

# S3 method for tbl_df view_on_joint_distribution(x, simul, p)

Value

A list of the view class.

Arguments

x

An univariate or a multivariate distribution.

simul

An univariate or multivariate simulated panel.

p

An object of the ffp class.

Details

  • simul must have the same number of columns than x

  • p should have the same number of rows that simul.

Examples

Run this code
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