Contenuto principale

setVolatilityViews

R2026b

Set views on variable volatilities for entropyViews object

Since R2026b

Description

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

example

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

example

Examples

collapse all

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

Define two volatility views and a mean view. The function gives default names to the views.

obj = setVolatilityViews(obj,[3 4],"<",[0.1 0.2]);
obj = setMeanViews(obj,"Var3","=",0.08)
obj = 
  entropyViews with properties:

      DistributionData: [10000×5 double]
    PriorProbabilities: [10000×1 double]
                 Views: ["VolatilityView_Var3_LessThan"    "VolatilityView_Var4_LessThan"    "MeanView_Var3_EqualTo"]
         VariableNames: ["Var1"    "Var2"    "Var3"    "Var4"    "Var5"]

Set volatility 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.10 0.06];
sigma = [0.15 0.20 0.12];
corrMatrix = [1.0 0.6 0.3; 0.6 1.0 0.4; 0.3 0.4 1.0];
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 Volatility 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 = setVolatilityViews(obj,["SPX" "AAPL"],"<",[0.12 0.18],ViewNames=["LowVolSPX" "LowVolAAPL"])
obj = 
  entropyViews with properties:

      DistributionData: [100000×3 double]
    PriorProbabilities: [100000×1 double]
                 Views: ["LowVolSPX"    "LowVolAAPL"]
         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