%SETUP   A script file editted by the user for setting up data sessions.
%        The user must provide information on location of data and
%        frequency of data.  Also provided is information on variables
%        to be obtained: names, samples and frequencies.  
%
%        Note that the program assumes that each time series stored in 
%        the .mat files to be accessed have a beginning and ending date 
%        as their first two elements.
%
%        Edit SETUP.M for full instructions and examples.

%        Ellen R. McGrattan, 7-22-87
%        Revised, 7-3-89,  ERM

%        SETUP is the file to be edited in order to set up a workfile 
%        in matlab via workfl.m.   WORKFL sets up a workfile by loading 
%        files listed in the string 'matfiles' and using varibles 
%        listed in the 'varnames' string.    'freq1', 'freq2' are 
%        vectors with length equaling the number of variables listed 
%        in varnames.  Element i of freq1 is the original frequency of 
%        the ith series (e.g. freq1(i)=1, 4, 12 for annual, quarterly, 
%        monthly data, respectively).  Element i of 'freq2' is the 
%        frequency of i to be used during the work session.   
%
%        'sample' is a #variables x 2 matrix with samples(i,:) equal
%        to the sample to be used for the ith variable. The number 
%        after a decimal point in an element of the sample matrix should 
%        have two, one, no places if the data is monthly, quarterly, 
%        yearly respectively.  For example, suppose you want to analyze
%        series i for the dates 1960 through the end of 1971.  Then
%        specify 'samples(i,:)' as:
%
%        samples(i,:)= { [1960.01,1971.12]        for { monthly data
%                      { [1960.1, 1971.4]             { quarterly data
%                      { [1960,   1971]               { yearly data.
%
%        Example:   Suppose you want to load in japan.mat and canada.mat
%        and use variables c5 c1 and ii5, which are quarterly series.
%        The samples to be used are 1960-1971 for c5 1962.3-1970.5 for 
%        c1 and 1961.12-1970.03 for ii5.   Then, for this example, the 
%        following code is written in setup.m:
%    
%            matfiles='japan canada'       <------- Only put spaces 
%            varnames='c5 c1 ii5'          <------- between names. 
%            samples=[1960,1971;                    The following will
%                    1962.3,1970.5;                 not work: ' c5 c1 ii5'
%                    1961.12,1970.03];                        'c5 c1 ii5 '
%            freq1=4*ones(3,1)
%            freq2=[1;4;12]
%
%
%        One limitation with this program is that the time series being 
%        accessed must have sample dates in the first two elements.
%        For example, if you have quarterly data for GNP between 1947:1 
%        and 1986:4, the vector GNP should have 162 elements with:
%         
%                      GNP(1) = 1947.1
%                      GNP(2) = 1986.4
% 
%        Also, you cannot access variables from different .mat files that
%        have the same name.

%        Below, set 'matfiles', 'varnames', 'samples', 'freq1', and 'freq2'.
%
clear


%matfiles='nipa1 capital1 labor1 populat1 /home/mcgrattan/data/larry/iginvest.dat';
%varnames=['knnrp knrp kncd lhours gcd82 gcn82 gcs82 gif82 gge82 p16 ', ...
%          'knnr knr'];
%samples=ones(12,1)*[1947.1,1985.4];
%freq1=[1 1 1 12 4 4 4 4 4 12 1 1 ]';
%freq2=ones(12,1)*4;
%n=ones(12,1);


%matfiles=['/home/erm/data/new/nipa1 populat1 labor1 capital1 ', ...
%          '/home/erm/data/new/cons1 soitax'];
%varnames=['knnrp knrp kncd lhours gcd82 gcn82 gcs82 gif82 gge82 p16', ...
%          ' Tk Tn'];
%samples=ones(12,1)*[1947.1,1987.4];
%freq1=[1 1 1 12 4 4 4 4 4 12 1 1]';
%freq2=ones(12,1)*4;

%matfiles=['/home/erm/data/new/nipa1 populat1 labor1 capital1 ', ...
%          '/home/erm/data/new/cons1 soitax'];
%varnames=['p16 lhours gcn82 gcs82 gcd82 gif82 gge82 gcsh82 knnrp', ...
%          ' kncd knrp Tk Tn gpi82 k knnrpe knnrps knnrge knnrgs gnp82', ...
%          ' knnr knnrg knr knrg'];
%samples=ones(24,1)*[1947.1,1987.4];
%freq1=[12;12;4;4;4;4;4;4;1;1;1;1;1;4;1;1;1;1;1;4;1;1;1;1];
%freq2=ones(24,1)*4;
%n=ones(24,1);

%matfiles=['/home/erm/data/toni/ushist /home/erm/data/toni/ukhist'];
%varnames=['cpi0 armed0 pr0 ward0 c1 gnp1 armed1 wage1 price1 pop1'];
%samples=[ones(4,1)*[1889,1969];ones(6,1)*[1855,1965]];
%freq1=ones(10,1);
%freq2=ones(10,1);
%         
%matfiles=['/home/erm/data/capital1 /home/erm/data/nipa1'];
%varnames=['gnp82 knnrp knrp'];
%samples=ones(3,1)*[1947,1982];
%freq1=[4;1;1];
%freq2=[1;1;1];

%matfiles=['/usr/people/erm/work/labor/labor /usr/people/erm/data/nipa1'];
%varnames=['gnp82 lheprm lheprf lhemmr lhemfr pom16 pof16'];
%samples=ones(7,1)*[1950.1,1987.4];
%freq1=[4;12*ones(6,1)];
%freq2=[4*ones(7,1)];
%n = ones(7,1);

matfiles=['/usr/people/erm/work/hp/data/hpdata'];
varnames=['p16 lhours gcnq gcsq gcdq gifq ggeq gcshq knnrp', ...
          ' kncd knrp Tk Tn knnrg knrg govcon govinv'];
samples=ones(17,1)*[1947.1,1992.4];
freq1=[12;12;4;4;4;4;4;4;1;1;1;1;1;1;1;4;4];
freq2=ones(17,1)*4;
n=ones(17,1);



%//////////////////////////////////////////////////////////////////////////////
%/                              CALL WORKFL:                                  /
%//////////////////////////////////////////////////////////////////////////////
workfl
