MATLAB code simulation (figure 4 and figure 5) 1. Import data, set parameters and range of x R_M=xlsread('Data_Simulation',1,'B2:B2001') % random return R_M r=0.001; % risk-free rate of return n=2; % lower partial moment order x=[-0.5:0.0001:1]; 2. Find MLPM portfolios for varying target t for i=1:15 t(i)=0.001+0.0005*(i-1); % range of target t R_P.LPM(:,i)=nthroot(lpm(x.*R_M+(1-x)*r,t(i),n),n); % n-th root of lower partial moment for portfolio return R_P with varying target t [LPM_n,t(R_P)]^(1/n) x_MLPM.ind(i)=find(R_P.LPM(:,i)==min(R_P.LPM(:,i)),1); % find index number of MLPM portfolios x_MLPM.value(i)=x(x_MLPM.ind(i)) % retrieve value of x at the MLPM portfolio end 3. Plot portfolio fraction x_MLPM as function of target t figure('position', [100 100 1500 850]) plot(t,x_MLPM.value,'-ko','LineWidth',1.5,'MarkerSize',10) ax = gca; ax.XAxis.Exponent = 0; % prevent scientific format xtickformat('%.3f') % format with 3 decimal places ytickformat('%.3f') yticks([0.005 0.015 0.025]) % selected ticks on y axis set(gca,'FontSize', 30,'FontName','Times New Roman','xcolor','k') xlabel('$$\tau$$','Interpreter','latex','FontSize',30,'FontName','Times New Roman', 'color','k') ylabel('$$x_{\textrm{MLPM}}$$','Interpreter','latex','FontSize',30,'FontName','Times New Roman','color','k') box off % prevent box format 4. Compute asymptotes and MLPM portfolio line R_P.Kappa_rLPM=(mean(R_M)-r)/nthroot(lpm(R_M,r,n),n) % Kappa ratio with t=r and LPM (upper asymptote) R_P.Kappa_rUPM=(mean(R_M)-r)/nthroot(lpm(-R_M,-r,n),n) % Kappa ratio with t=r and UPM (lower asymptote) R_P.mean=x.*mean(R_M)+(1-x)*r; % portfolio mean for i=1:25 t(i)=0.001+0.0005*(i-1); % range of target t R_P.LPM(:,i)=nthroot(lpm(x.*R_M+(1-x)*r,t(i),n),n); % n-th root of lower partial moment for portfolio return R_P with varying target t [LPM_n,t(R_P)]^(1/n) x_MLPM.ind(i)=find(R_P.LPM(:,i)==min(R_P.LPM(:,i)),1); % find index number of MLPM portfolios x_MLPM.value(i)=x(x_MLPM.ind(i)) % retrieve value of x at the MLPM portfolio x_MLPM.LPM(i)=nthroot(lpm(r+x_MLPM.value(i).*(R_M-r),t(i),n),n) % n-th root of lower partial moment for MLPM portfolios x_MLPM.Mean(i)=r+x_MLPM.value(i)*(mean(R_M)-r) % mean of MLPM portfolios end 5. Plot asymptotes, MLPM portfolio line and portfolio lines for selected targets figure('position', [100 100 1500 850]) plot([0:0.005:0.02],r+R_P.Kappa_rLpm*[0:0.005:0.02],'k--','LineWidth',1.5) % plot upper asymptote hold on plot([0:0.005:0.02],r-R_P.Kappa_rUpm*[0:0.005:0.02],'k--','LineWidth',1.5) % plot lower asymptote hold on plot(x_MLPM.LPM, x_MLPM.Mean,'k-','LineWidth',1.5) % plot MLPM portfolio line hold on p1=plot(R_P.LPM(:,3),R_P.mean','k-','LineWidth',1.5) % plot portfolio line with t=0.002 hold on p2=plot(R_P.LPM(:,7),R_P.mean','color',[0,0,0]+0.5,'LineWidth',1.5) % plot portfolio line with t=0.004 hold on p3=plot(R_P.LPM(:,11),R_P.mean','k:','LineWidth',1.5) % plot portfolio line with t=0.006 ax = gca; ax.YAxis.Exponent = 0; % prevent scientific format xtickformat('%.3f') % format with 3 decimal places yticks([0.000 0.001 0.002 0.003]) % selected ticks on y axes set(gca,'ylim',[-0.0005 0.003],'xlim',[0 0.01],'FontSize', 30,'FontName','Times New Roman') xlabel('$$\sqrt[2]{\textrm{LPM}_{2,\tau}(R)}$$','Interpreter','latex','FontSize',30) ylabel('$$\textrm{E}(R)$$','Interpreter','latex','FontSize',30) legend([p1 p2 p3],{'\tau = 0.002','\tau = 0.004','\tau = 0.006'},'Location','Northwest','Orientation','horizontal') legend('boxoff')% prevent legend box box off % prevent box format