%% Recreate the figures from the paper
%  Schmidt, D. F. & Makalic, E.
%  Robust Lasso Regression with Student-t Residuals
%  Lecture Notes in Artificial Intelligence, to appear, 2017.

% Load the boston housing data
clear;
load boshouse.mat

%% Run t-lasso and Gaussian lasso
[b_inf, b0_inf, r_inf] = tlasso(X, y, 1e4);
[ b_10,  b0_10,  r_10] = tlasso(X, y, 10);
[  b_2,   b0_2,   r_2] = tlasso(X, y, 2);

%% plot neg-ll
figure;
subplot(2,2,1);
hold on;
grid on;
box on;
xlim([-5, 9]);

set(gcf,'color','white');
set(gca, 'FontName', 'Times New Roman')
set(gca, 'FontSize', 16);

plot(log(r_inf.tau2), r_inf.negll, 'k-' ,'LineWidth', 1.5);
plot(log(r_10.tau2), r_10.negll, 'k--', 'LineWidth', 1.5);
plot(log(r_2.tau2), r_2.negll, 'k+-', 'LineWidth', 1.5);

xlabel('$\log \tau^2$', 'FontSize', 16, 'Interpreter','LaTex');
ylabel('Negative log-likelihood', 'FontSize', 16);

legend('Gaussian', 'Student-t (\nu = 10)', 'Student-t (\nu = 2)');

%% Plot path -- Gaussian
%figure;
subplot(2,2,2);
hold on;
grid on;
box on;
xlim([-5, 9]);
ylim([-20, 6]);

set(gcf,'color','white');
set(gca, 'FontName', 'Times New Roman')
set(gca, 'FontSize', 16);

plot(log(r_inf.tau2), b_inf', 'k-' ,'LineWidth', 1.5);

xlabel('$\log \tau^2$', 'FontSize', 16, 'Interpreter','LaTex');
ylabel('\beta(\tau^2)', 'FontSize', 16);
title('\nu = 1e4 (Gaussian)');

%% Plot path -- Student-t (nu = 10)
%figure;
subplot(2,2,3);
hold on;
grid on;
box on;
xlim([-5, 9]);
ylim([-20, 6]);

set(gcf,'color','white');
set(gca, 'FontName', 'Times New Roman')
set(gca, 'FontSize', 16);

plot(log(r_10.tau2), b_10', 'k-' ,'LineWidth', 1.5);

xlabel('$\log \tau^2$', 'FontSize', 16, 'Interpreter','LaTex');
ylabel('\beta(\tau^2)', 'FontSize', 16);
title('\nu = 10');

%% Plot path -- Student-t (nu = 2)
%figure;
subplot(2,2,4);
hold on;
grid on;
box on;
xlim([-5, 9]);
ylim([-20, 6]);

set(gcf,'color','white');
set(gca, 'FontName', 'Times New Roman')
set(gca, 'FontSize', 16);

plot(log(r_2.tau2), b_2', 'k-' ,'LineWidth', 1.5);

xlabel('$\log \tau^2$', 'FontSize', 16, 'Interpreter','LaTex');
ylabel('\beta(\tau^2)', 'FontSize', 16);
title('\nu = 2');