Skip to content

Commit

Permalink
Improvements with fanplotFS. Change name of option to multiPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoRianiUNIPR committed Nov 12, 2023
1 parent 3d26266 commit f71629e
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 62 deletions.
4 changes: 2 additions & 2 deletions graphics/fanplot.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function brushedUnits=fanplot(out,varargin)
%fanplot plots the fan plot (this function will be replaced by fanplotFS)
%fanplot OLD FUNCTION (this function is replaced by fanplotFS and it is not updated anylonger)
%
%<a href="matlab: docsearchFS('fanplot')">Link to the help function</a>
%
% NOTE THAT THIS FUNCTION WILL BE REMOVED IN A FUTURE RELEASE OF FSDA
% BECAUSE IT IS IN CONFLICT WITH FUNCTION fanplot OF THE ECONOMETRIC TOOLBOX.
% FSDA function fanplot IS REPLACED BY FUNCTION fanplotFS
% This function has been replace by function fanplotFS
%
% Required input arguments:
%
Expand Down
142 changes: 82 additions & 60 deletions graphics/fanplotFS.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@
% Example - 'namey',''
% Data Types - char
%
%separatePanels : plots on a single or multiple panels. Boolean. If
% separatePanels is true each trajectory appears on a
% seperate subplot. If separatePanels is false all the
%multiPanel : plots on a single or multiple panels. Boolean. If
% multiPanel is false each trajectory appears on a
% seperate subplot. If multiPanel is true (defaul) all the
% trajectories appear in single plot.
% Example - 'separatePanels',true
% Example - 'multiPanel',true
% Data Types - logical
%
% SizeAxesNum: Size of the numbers of the axis. Scalar. Scalar which
Expand Down Expand Up @@ -632,7 +632,7 @@
'laby',laby,'xlimx','','ylimy','','lwd',2,'lwdenv',1, ...
'FontSize',12,'SizeAxesNum',10,'highlight',[],...
'tag','pl_fan','datatooltip','','databrush','', ...
'nameX','','namey','','label','','separatePanels',false);
'nameX','','namey','','label','','multiPanel',false);

[varargin{:}] = convertStringsToChars(varargin{:});
UserOptions=varargin(1:2:length(varargin));
Expand Down Expand Up @@ -760,7 +760,7 @@
laby=options.laby;
titl=options.titl;
highlight=options.highlight;
separatePanels=options.separatePanels;
multiPanel=options.multiPanel;

if ~isempty(highlight)

Expand All @@ -774,7 +774,7 @@
% SizeAxesNum = font size for the axes numbers
SizeAxesNum=options.SizeAxesNum;

if separatePanels==false
if multiPanel==false

plot1=plot(Sco(:,1),Sco(:,2+intercept:end),'LineWidth',lwd);
set(gcf,'Tag',options.tag)
Expand Down Expand Up @@ -1600,42 +1600,20 @@
% event_obj = Handle to event object (event_obj=graphics.datatipevent)
% Remark: the first two arguments are implicit in the sense that
% these arguments are automatically passed to the function when it executes.
% out = a structure containing the following fields
% Score = (n-init) x length(la)+1 matrix
% 1st col = fwd search index
% 2nd col = value of the score test in each step
% of the fwd search for la(1)
% ...........
% end col = value of the score test in each step
% of the fwd search for la(end)
% Un = cell of size length(la). out.Un{i} is a
% (n-init) x 11 Matrix which contains the unit(s)
% included in the subset at each step of the fwd search
% REMARK: in every step the new subset is compared
% with the old subset. Un contains the unit(s) present
% in the new subset but not in the old one
% Un(1,2) for example contains the unit included in step
% init+1
% Un(end,2) contains the units included in the final step
% of the search
% out = a structure coming from FSReda, Sregeda, MMregeda
% or FSRaddt
% label =(optional argument) if it is present it must be
% a cell array of strings containing the labels of
% the rows of the regression dataset
% Output:
%
% output_txt= Datatip text (string or string cell array) which informs
% 1) about the value of the score test
% 2) the step of the search
% 3) the value of the transformation parameter
% 4) the unit(s) which enter(s) the search
% 1) about the value of the statistic which is monitored
% 2) the step of the search (just if FS) or bdp (if
% Sregeda) or eff (if MMregeda)
%
% REMARK: this function is called by function fanplotFS
%
% References:
%
% Atkinson and Riani (2000), Robust Diagnostic Regression Analysis,
% Springer Verlag, New York.
%
% Written by FSDA team
%

Expand All @@ -1645,43 +1623,87 @@
% x and y, plot coordinates of the mouse
x = pos(1); y = pos(2);

if fanplotScore ==true

% output_txt is what it is shown on the screen
output_txt = {['Value of the score test=',num2str(y)]};
else
output_txt = {['Value of the deletion t test=',num2str(y)]};
end
% Add information abou the step of the search which is under investigation
output_txt{end+1} = ['Step m=' num2str(x)];

% If structure out does not contain labels for the rows then
% labels row1....rown are added automatically
if isempty(intersect('label',fieldnames(out)))

% Find n=number of units
% cUn=cell2mat(out.Un(1));
% n=cUn(end,1);
out.label=cellstr(num2str((1:n)','row%d'));
end
% if fanplotScore ==true
%
% else
% output_txt = {['Value of the deletion t test=',num2str(y)]};
% end
%
% % If structure out does not contain labels for the rows then
% % labels row1....rown are added automatically
% if isempty(intersect('label',fieldnames(out)))
%
% % Find n=number of units
% % cUn=cell2mat(out.Un(1));
% % n=cUn(end,1);
% out.label=cellstr(num2str((1:n)','row%d'));
% end

% Add information about the unit(s) and the selected steps they entered the
% search

[~,col] = find(Sco(:,2:end)==y);
Un=out.Un{col};
idx = find(Un(:,1)==x,1);
sel=Un(idx,2:end);

% Add information about the corresponding row label of what has been
% selected
if fanplotScore ==true
if strcmp(out.class,'FSRfan')
% output_txt is what it is shown on the screen
output_txt = {['Value of the score test=',num2str(y)]};

% Add information abou the step of the search which is under investigation
output_txt{end+1} = ['Step m=' num2str(x)];

[~,col] = find(Sco(:,2:end)==y);
Un=out.Un{col};
idx = find(Un(:,1)==x,1);
sel=Un(idx,2:end);


output_txt{end+1} = ['H_0: \lambda =' num2str(out.la(col))];
else
output_txt{end+1} = ['Unit(s) entered in step ' num2str(x) '=' num2str(sel(~isnan(sel)))];


elseif strcmp(out.class,'FSRaddt')
output_txt = {['Value of the deletion t test=',num2str(y)]};
% Add information abou the step of the search which is under investigation
output_txt{end+1} = ['Step m=' num2str(x)];

[~,col] = find(Sco(:,2:end)==y);
Un=out.Un{col};
idx = find(Un(:,1)==x,1);
sel=Un(idx,2:end);
output_txt{end+1} = ['H_0: \beta_' num2str(out.la(col)-1) '=0'];
output_txt{end+1} = ['Unit(s) entered in step ' num2str(x) '=' num2str(sel(~isnan(sel)))];

elseif strcmp(out.class,'FSReda')
output_txt = {['Value of the t test=',num2str(y)]};
% Add information abou the step of the search which is under investigation
output_txt{end+1} = ['Step m=' num2str(x)];

[~,col] = find(Sco(:,2+intercept:end)==y);
Un=out.Un;
idx = find(Un(:,1)==x,1);
sel=Un(idx,2:end);
output_txt{end+1} = ['H_0: \beta_' num2str(col) '=0'];
output_txt{end+1} = ['Unit(s) entered in step ' num2str(x) '=' num2str(sel(~isnan(sel)))];

elseif strcmp(out.class,'Sregeda')

output_txt = {['Value of the t test=',num2str(y)]};
% Add information about bdp
output_txt{end+1} = ['bdp=' num2str(x)];
[~,col] = find(Sco(:,2+intercept:end)==y);
output_txt{end+1} = ['H_0: \beta_' num2str(col) '=0'];
elseif strcmp(out.class,'MMregeda')

output_txt = {['Value of the t test=',num2str(y)]};
% Add information about eff
output_txt{end+1} = ['eff=' num2str(x)];
[~,col] = find(Sco(:,2+intercept:end)==y);
output_txt{end+1} = ['H_0: \beta_' num2str(col) '=0'];
else

end

output_txt{end+1} = ['Unit(s) entered in step ' num2str(x) '=' num2str(sel(~isnan(sel)))];

end

Expand Down
Binary file modified helpfiles/FSDA/images/fanplotFS_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified helpfiles/FSDA/images/fanplotFS_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified helpfiles/FSDA/images/fanplotFS_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified helpfiles/FSDA/images/fanplotFS_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified helpfiles/FSDA/images/fanplotFS_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified helpfiles/FSDA/images/fanplotFS_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified helpfiles/FSDA/images/fanplotFS_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f71629e

Please sign in to comment.