<< Click to Display Table of Contents >> COLLAPSE |
|
COLLAPSE transform one higher-frequency timeseries to a lower-frequency timeseries, for instance converting quarterly data to annual data. Use INTERPOLATE to do the inverse transformation.
Syntax
COLLAPSE lf = hf method;
lf |
Lower frequency timeseries. Frequency can be indicated with suffix !a, !q or !m. Banknames may be used. |
hf |
Higher-frequencey timeseries. Frequency can be indicated with suffix !a, !q or !m. Banknames may be used. |
method |
(Optional). Choose between:
•total: The higher-freq observations are summed. •avg: The higher-freq observations are averaged. •first: The first higher-freq observation is used. •last: The last higher-freq observation is used.
Note: default is 'total'. |
•If a variable on the right-hand side of = is stated without databank, Gekko may look for it in the list of open databanks (if databank search is active, cf. MODE).
Example
Use this to convert frequency:
COLLAPSE fY!a = fY!q; |
Since the method is 'total' as default, this will create the annual timeseries fY!a where each annual observation is the sum of the corresponding quarters in fY!q.
COLLAPSE fY!a = qbank:fY!q first; |
With option 'first', the first quarter of each year would be used instead of summing the quarters. Here, the variable is taken from the databank qbank.
Note
If a frequency indicator is omitted, Gekko will use the current frequency.
You can also use PRT<collapse> to get similar transformations in prints.
See also IMPORT<collapse> regarding higher frequencies than quarters.
Related commands
INTERPOLATE, SERIES, CREATE, PRT