reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

month2quarter.m (479B)


      1 function yQ=month2quarter(yM);
      2 
      3 % function yQ=month2quarter(yM);
      4 %
      5 %  Converts the monthly observations in yM to quarterly observations
      6 %  by averaging the values in the three months of the quarter.
      7 %
      8 %  Example:  Jan=5%, Feb=4%, Mar=3%  ==> Quarter=4%
      9 %
     10 %  Assumes the first three observations make up a quarter
     11 
     12 T=length(yM);
     13 TQ=floor(T/3);  % Length of quarterly series
     14 
     15 yQ=zeros(TQ,1)*NaN;
     16 t=1;  % index for montly data
     17 
     18 for i=1:TQ;
     19    yQ(i)=mean(yM(t:(t+2)));
     20    t=t+3;
     21 end;