主要内容

setMeanViews

R2026b

Set views on variable means for entropyViews object

Since R2026b

Description

obj = setMeanViews(obj,Variables,RelationshipTypes,Thresholds) sets views on the means of the specified variables in the entropyViews object obj. Each view specifies that the mean of a variable has a particular relationship (less than, equal to, or greater than) to a threshold value.

example

obj = setMeanViews(obj,Variables,RelationshipTypes,Thresholds,ViewNames=viewNames) sets views with custom names on the means.

example

Examples

collapse all

Set mean views on two variables.

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"]);

Set mean views: Equity mean greater than 0.1 and Bonds mean equal to 0.12. The function gives default names to the views.

obj = setMeanViews(obj,["Equity" "Bonds"],[">" "="],[0.10 0.12])
obj = 
  entropyViews with properties:

      DistributionData: [10000×5 double]
    PriorProbabilities: [10000×1 double]
                 Views: ["MeanView_Equity_GreaterThan"    "MeanView_Bonds_EqualTo"]
         VariableNames: ["Equity"    "Bonds"    "Gold"    "RealEstate"    "FX"]

Set mean views on two variables with custom names.

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

rng(13)

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

Create an entropyViews object from the returns.

obj = entropyViews(Data,VariableNames=["SPX" "AAPL" "MSFT"]);

Set mean views. Use the ViewNames name-value argument to give custom names to the views. Use the scalar value "<" for the relationship type to assign that relationship type to both views.

obj = setMeanViews(obj,["SPX" "AAPL"],"<",[0.10 0.15],ViewNames=["BearishSPX" "BearishAAPL"])
obj = 
  entropyViews with properties:

      DistributionData: [100000×3 double]
    PriorProbabilities: [100000×1 double]
                 Views: ["BearishSPX"    "BearishAAPL"]
         VariableNames: ["SPX"    "AAPL"    "MSFT"]

Input Arguments

collapse all

Entropy views object, specified as an entropyViews object.

Variables on which to set views, specified as a string or numeric vector.

  • If you specify Variables as a string vector, then the names in Variables must also appear in the VariableNames property of obj.

  • If you specify Variables as a numeric vector, then the numbers in Variables must also be column numbers in the DistributionData property of obj.

Data Types: string | double

Types of relationships between the variables and the thresholds, specified as a string vector. The entries in RelationshipTypes must all be either "<", "=", or ">".

  • If RelationshipTypes has more than one entry, then RelationshipTypes must have the same number of entries as Variables does.

  • If RelationshipTypes has only one entry, then the function applies the specified relationship to all of the variables specified in Variables.

Note

You can use "LessThan", "EqualTo", and "GreaterThan" as aliases for "<", "=", and ">", respectively.

Threshold values for views, specified as a numeric vector. The number of entries in Thresholds must match the number of entries in Variables. Each entry of Thresholds defines the target value for its corresponding variable.

Names for the created views, specified as a string vector. The number of entries in viewNames must match the number of entries in Variables.

Note

If you do not specify the viewNames argument, then the function sets the names for the created views as <viewType>View_<varName>_<relationshipType>, where:

  • viewType is either Mean or Volatility.

  • varName is the entry in Variables for which you are creating a view.

  • relationshipType is either LessThan, EqualTo, or GreaterThan.

Output Arguments

collapse all

Entropy views object, returned as an entropyViews object. Use the object functions to manage views and compute posterior probabilities.

Version History

Introduced in R2026b