Debian Codegraph @

contrib/ms-sbvar/TZcode/MatlabFiles/fn_foregraph.m

raw
1 function fn_foregraph(yfore,yacte,keyindx,rnum,cnum,q_m,ylab,forelabel,conlab)
2 %
3 % Graph annual (or calendar year) forecasts vs actual (all data from "msstart.m")
4 %
5 % yfore: actual and forecast annual growth data with dates.
6 % yacte: actual annual growth data with dates.
7 % keyindx: index for the variables to be graphed
8 % rnum: number of rows in subplot
9 % cnum: number of columns in subplot
10 % q_m: if 4 or 12, quarterly or monthly data
11 % ylab: string array for the length(keyindx)-by-1 variables
12 % forelabel: title label for as of time of forecast
13 % conlab: label for what conditions imposed; e.g., conlab = 'All bar MS shocks inspl'
14 %-------------
15 % No output argument for this graph file
16 % See fn_seriesgraph.m, fn_forerrgraph.m.
17 %
18 % Tao Zha, March 2000
19 %
20 % Copyright (C) 1997-2012 Tao Zha
21 %
22 % This free software: you can redistribute it and/or modify
23 % it under the terms of the GNU General Public License as published by
24 % the Free Software Foundation, either version 3 of the License, or
25 % (at your option) any later version.
26 %
27 % It is distributed in the hope that it will be useful,
28 % but WITHOUT ANY WARRANTY; without even the implied warranty of
29 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 % GNU General Public License for more details.
31 %
32 % If you did not received a copy of the GNU General Public License
33 % with this software, see <http://www.gnu.org/licenses/>.
34 %
35
36
37 vyrs = yfore(:,1);
38 hornum = cell(length(vyrs),1); % horizontal year (number)
39 count=0;
40 for k=vyrs'
41 count=count+1;
42 jnk=num2str(k);
43 hornum{count}=jnk(3:4); % e.g., with '1990', we have '90'
44 end
45
46 count=0;
47 for i = keyindx
48 count = count+1;
49 subplot(rnum,cnum,count)
50 plot(yacte(:,1)+yacte(:,2)/q_m,yacte(:,2+i),yfore(:,1)+yfore(:,2)/q_m,yfore(:,2+i),'--')
51
52 if (yfore(1,2)==0) % only for annual growth rates (not for, say, monthly annualized rates)
53 set(gca,'XLim',[vyrs(1) vyrs(end)])
54 set(gca,'XTick',vyrs)
55 set(gca,'XTickLabel',char(hornum))
56 end
57
58 if i==keyindx(1)
59 title(forelabel)
60 elseif i>=length(keyindx) %i>=length(keyindx)-1
61 xlabel(conlab)
62 end
63 %
64 grid
65 ylabel(char(ylab(i)))
66 end