%% Calculate the Risk-Adjusted Return
% This example shows how to calculate the risk-adjusted return using portalpha and compare it with the fund and market's mean returns.
% Use the example data with a fund, a market, and a cash series.

load FundMarketCash 
Returns = tick2ret(TestData);
Fund = Returns(:,1);
Market = Returns(:,2);
Cash = Returns(:,3);
MeanFund = mean(Fund)
MeanMarket = mean(Market)
[MM, aMM] = portalpha(Fund, Market, Cash, 'MM')
[GH1, aGH1] = portalpha(Fund, Market, Cash, 'gh1')
[GH2, aGH2] = portalpha(Fund, Market, Cash, 'gh2')
[SML, aSML] = portalpha(Fund, Market, Cash, 'sml')

% Since the fund's risk is much less than the market's risk, the risk-adjusted return of the fund is much higher than both the nominal fund and market returns.
% Copyright 2020 The MathWorks, Inc.