主要内容

posteriorProbabilities

R2026b

Compute posterior probabilities for entropyViews object

Since R2026b

Description

p = posteriorProbabilities(obj) computes the posterior probabilities for the scenarios in the entropyViews object obj. The posterior probabilities reflect the views specified on the object while minimizing the relative entropy (Kullback-Leibler divergence) between the prior and posterior distributions.

example

Examples

collapse all

Compute posterior probabilities and use them to calculate updated portfolio statistics.

Create a multivariate empirical distribution, Data, of returns for five assets.

rng(13)

numScenarios = 10000;
mu = [0.08 0.1 0.06 0.12 0.09];
sigma = [0.15 0.2 0.12 0.25 0.18];
corrMatrix = [1 0.6 0.3 0.4 0.5; 0.6 1 0.4 0.5 0.6; 0.3 0.4 1 0.3 0.4; 0.4 0.5 0.3 1 0.5; 0.5 0.6 0.4 0.5 1];
covMatrix = diag(sigma)*corrMatrix*diag(sigma);
Data = mvnrnd(mu,covMatrix,numScenarios);

Create an entropyViews object from the returns.

obj = entropyViews(Data,VariableNames=["Equity" "Bonds" "Gold" "RealEstate" "FX"]);

Define two mean views and a volatility view.

obj = setMeanViews(obj,["Equity" "RealEstate"],[">" "<"],[0.12 0.08]);
obj = setVolatilityViews(obj,["Gold" "RealEstate"],"<",[0.1 0.2]);

Compute posterior probabilities and use them to compute posterior means and standard deviations.

p = posteriorProbabilities(obj);
posteriorMeans = mean(Data,1,Weights=p)
posteriorMeans = 1×5

    0.1200    0.1116    0.0502    0.0800    0.0928

posteriorStandardDeviations = std(Data,p)
posteriorStandardDeviations = 1×5

    0.1462    0.1920    0.1054    0.2173    0.1727

Input Arguments

collapse all

Entropy views object, specified as an entropyViews object.

Output Arguments

collapse all

Posterior probabilities, returned as a numeric column vector. The number of entries in p matches the number of rows in the DistributionData property of obj. The posterior probabilities represent the updated probability weights for each scenario after incorporating the views stored in the Views property of obj and sum to one.

Tip

You can use the posterior probabilities as weights to compute posterior statistics. For example, to compute the posterior mean of the distribution data: posteriorMean = mean(obj.DistributionData,1,Weights=p).

Data Types: double

Version History

Introduced in R2026b