%% Estimate Mean and Covariance of Asset Returns from Market Data for a PortfolioMAD Object
% Create a PortfolioMAD object p and use the simulateNormalScenariosByData function with market data loaded from CAPMuniverse.mat to simulate multivariate normal asset return scenarios. The market data, AssetsTimeTable, is a timetable of asset returns.

load CAPMuniverse

p = PortfolioMAD('AssetList',Assets);
disp(p.AssetList');

%
% Simulate the scenarios from the timetable data for each of the assets from CAPMuniverse.mat and plot the efficient frontier.

p = simulateNormalScenariosByData(p,AssetsTimeTable,10000,'missingdata',true);
p = setDefaultConstraints(p);
plotFrontier(p);

% Copyright 2015 The MathWorks, Inc.