Skip to content

Commit

Permalink
Improved example files
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoRianiUNIPR committed Jan 14, 2024
1 parent 5d6d9fb commit 199356c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 22 deletions.
8 changes: 4 additions & 4 deletions solutionsEX/Ex8_3.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
xlim([min(X) max(X)])
if prin==1
print -depsc P30homobands.eps;
else
set(gcf,'Name', 'Figure A.49 (right panel)');
title('Figure A.49 (right panel)')
end

set(gcf,'Name', 'Figure A.49 (right panel)');
title('Figure A.49 (right panel)')

%InsideREADME
%InsideREADME
53 changes: 38 additions & 15 deletions solutionsEX/Ex8_4.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
%% Exercise 8.4
%% Exercise 8.4
%
% Analysis of transformed Airline data.
% This file creates Figures A.50-52

prin=0;

%% Data loading
% the original airline data (not contaminated)
Expand All @@ -25,17 +26,24 @@
% the model
model = struct;
model.trend = 1; % linear trend
model.seasonal = 102; % two harmonics with time varying seasonality
model.seasonal = 102; % two harmonics with time varying seasonality
model.s = 12; % monthly time series
model.lshift = 0; % no level shift

% Default h is round(nT*0.75), i.e 25% breakdown point
outLTS102 = LTSts(Y,'model',model,'plots',1,'conflev',0.99,'msg',0,'dispresults',true);
titl = {'model parameters for Airline data:' , 'A=1, B=2, G=1, $\delta_1=0$'};
titl = {'Model parameters for Airline data:' , 'A=1, B=2, G=1, $\delta_1=0$'};
title(findobj(gcf,'Tag','LTSts:ts'),titl,'interpreter','LaTeX','FontSize',16);

sgtitle('Figure A.50')
set(gcf,"Name",'Figure A.50')

if prin==1
% print to postscript
print -depsc ch8_problem5_102.eps;
else
sgtitle('Figure A.50')
set(gcf,"Name",'Figure A.50')
end


%% Create Figure A.51
% quadratic grow of amplitude
Expand All @@ -44,30 +52,45 @@
titl = {'model parameters for Airline data:' , 'A=1, B=2, G=2, $\delta_1=0$'};
title(findobj(gcf,'Tag','LTSts:ts'),titl,'interpreter','LaTeX','FontSize',16);

sgtitle('Figure A.51')
set(gcf,"Name",'Figure A.51')
if prin==1
% print to postscript
print -depsc ch8_problem5_202.eps;
else
sgtitle('Figure A.51')
set(gcf,"Name",'Figure A.51')
end



%% Create Figure A.52 (left panel)
% Transform the data and go back to linear grow of amplitude
model.seasonal = 102;
Ylog = log(Y);
outLTSlog102 = LTSts(Ylog,'model',model,'plots',1,'conflev',0.99,'msg',0,'dispresults',true);
titl = {'model parameters for log-transformed Airline data:' , 'A=1, B=2, G=1, $\delta_1=0$'};
titl = {'Model parameters for log-transformed Airline data:' , 'A=1, B=2, G=1, $\delta_1=0$'};
title(findobj(gcf,'Tag','LTSts:ts'),titl,'interpreter','LaTeX','FontSize',16);

sgtitle('Figure A.52 (left panel)')
set(gcf,"Name",'Figure A.52 (left panel)')

if prin==1
% print to postscript
print -depsc ch8_problem5_log102;
else
sgtitle('Figure A.52 (left panel)')
set(gcf,"Name",'Figure A.52 (left panel)')
end

%% Create Figure A.52 (right panel)
% No grow of amplitude
model.seasonal = 2;
outLTSlog2 = LTSts(Ylog,'model',model,'plots',1,'conflev',0.99,'msg',0,'dispresults',true);
titl = {'model parameters for log-transformed Airline data:' , 'A=1, B=2, G=0, $\delta_1=0$'};
titl = {'Model parameters for log-transformed Airline data:' , 'A=1, B=2, G=0, $\delta_1=0$'};
title(findobj(gcf,'Tag','LTSts:ts'),titl,'interpreter','LaTeX','FontSize',16);

sgtitle('Figure A.52 (right panel)')
set(gcf,"Name",'Figure A.52 (right panel)')
if prin==1
% print to postscript
print -depsc ch8_problem5_log2
else
sgtitle('Figure A.52 (right panel)')
set(gcf,"Name",'Figure A.52 (right panel)')
end

%InsideREADME
%InsideREADME
6 changes: 3 additions & 3 deletions solutionsEX/Ex8_5.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
% Analysis of body measurements to predict percentage of body fat in males.
% This file creates Figures A.53-A.56.

%% Data loading
%% Data loading
load fat
fatsel=fat{:,["neck" "chest" "abdomen" "hip" "thigh" "knee" "ankle" "bicep" "forearm" "wrist"]};
X=pivotCoord(fatsel);
Expand Down Expand Up @@ -69,7 +69,7 @@
fsout=FSR(y, X,'plots',0);
disp(fsout)

%% Create Figure A.55
%% Create Figure A.55
% Monitoring S estimtes
[out]=Sregeda(y,X,'msg',0);
fground = struct;
Expand Down Expand Up @@ -109,4 +109,4 @@
sgtitle('Figure A.56')
set(gcf,"Name",'Figure A.56')

%InsideREADME
%InsideREADME

0 comments on commit 199356c

Please sign in to comment.