%% Estimate Mean and Covariance of Asset Returns from Data for a PortfolioMAD Object
% Given a PortfolioMAD object p, use the simulateNormalScenariosByData function to simulate multivariate normal asset return scenarios from data.

m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 0.0064 0.00408 0.00192 0; 
    0.00408 0.0289 0.0204 0.0119;
    0.00192 0.0204 0.0576 0.0336;
    0 0.0119 0.0336 0.1225 ];
m = m/12;
C = C/12;

RawData = mvnrnd(m, C, 240);
NumScenarios = 2000;

p = PortfolioMAD;
p = simulateNormalScenariosByData(p, RawData, NumScenarios);
p = setDefaultConstraints(p);

disp(p);

% Copyright 2015 The MathWorks, Inc.