The name is absent



Stata Technical Bulletin

45


mean       mean over interval

sum        sum over interval

gmean geometric mean over interval (for a positive variable)
first       first observation in the interval

last        last observation in the interval

If stat is not specified, mean is assumed.

The tscollap command is for use with time series data of monthly, quarterly, or half-yearly frequency. You must tsset
your data before using this command; see [U] tsset. If the data are a panel of time series, that is, if a
panelvar has been specified
in tsset, the specification of the panel identification variable will automatically be retained in the resulting dataset (it need not,
and should not, be specified in the
varlist). Time series operators may not be used.

The tsmktim command (described in dm81; see pages 2-4) is a convenient way to generate the appropriate tsset command
if you do not already have a time variable in the data.

Options

toffreq') specifies the target frequency, which must be specified. It may take on any value lower than the current value as
understood by tsset.
freq must be given as q, h, y in either lowercase or uppercase.

generate (freqvar) may be used to specify the name of the new tsset variable, which will be formatted at the target frequency.

Description

tscollap converts the time series data in memory into a dataset of means, sums, or selected values taken from the specified
interval. It is a variant of collapse, which automatically forms the groups over which statistics are to be calculated from an
understanding of the calendar data. For instance, monthly data may be converted to quarterly, half-yearly, or annual (yearly)
data by specifying to(q), to(h), or to(y), respectively. Data may be averaged over the interval (using either an arithmetic
or geometric mean) or summed (as would be appropriate for income statement data). Either the first or the last observation
of each interval may be selected (so that, e.g., end-of-period values may be readily assembled). Since its syntax (and internal
logic) is taken from collapse, more than one statistic may be generated from a single variable; for example, both average and
end-of-period values may be specified by using different
target-var names). tscollap embodies the June, 2000 correction to
collapse.

All variables not specified in the target list are dropped (including the current tsset variable), and a new tsset variable
is generated as
freqfreq (as long as that variable does not already exist). The generate option may be used to customize the
new tsset variable. If a
panelid variable is in use by tsset, it should not be listed; it will be automatically retained.

Saved results

tscollap saves the items returned by tsset in r().

Remarks

tscollap makes substantial use of _gfilter, part of the egenmore package of N. J. Cox, information about which is
available by issuing the command webseek egenmore.

Examples

Monthly data from Terence Mills’ Econometric Analysis of Financial Time Series on UK FTA All Share stock prices (ftap)
and dividends (ftadiv) are compacted to a quarterly frequency.

. use http ://fmwww.be.edu∕ec-p∕data∕Mills2d∕fta.dta

. tscollap ftap ftadiv, to(q)

Converting from M to Q

time variable: q_q, 1965ql to 1995q4

. use http ://fmwww.be.edu∕ec-p∕data∕Mills2d∕fta.dta

. tscollap ftap (first) ftapf=ftap (last) ftapl=ftapt to(q) gen(qtr)
Converting from M to Q

time variable: qtr, 1965ql to 1995q4

In the first instance, the price and dividend series are averaged over the quarter, and other series in the original dataset discarded.
In the second example, the price series is used to generate three variables: the average price per quarter, the price in the first
month of each quarter, and the price in the last month of each quarter, as ftap, ftapf, and ftapl, respectively.



More intriguing information

1. THE EFFECT OF MARKETING COOPERATIVES ON COST-REDUCING PROCESS INNOVATION ACTIVITY
2. The Nobel Memorial Prize for Robert F. Engle
3. AGRIBUSINESS EXECUTIVE EDUCATION AND KNOWLEDGE EXCHANGE: NEW MECHANISMS OF KNOWLEDGE MANAGEMENT INVOLVING THE UNIVERSITY, PRIVATE FIRM STAKEHOLDERS AND PUBLIC SECTOR
4. WP RR 17 - Industrial relations in the transport sector in the Netherlands
5. Are Japanese bureaucrats politically stronger than farmers?: The political economy of Japan's rice set-aside program
6. Applications of Evolutionary Economic Geography
7. O funcionalismo de Sellars: uma pesquisa histδrica
8. The name is absent
9. Infrastructure Investment in Network Industries: The Role of Incentive Regulation and Regulatory Independence
10. How Low Business Tax Rates Attract Multinational Headquarters: Municipality-Level Evidence from Germany
11. The name is absent
12. Does Market Concentration Promote or Reduce New Product Introductions? Evidence from US Food Industry
13. The Impact of Financial Openness on Economic Integration: Evidence from the Europe and the Cis
14. The name is absent
15. The Modified- Classroom ObservationScheduletoMeasureIntenticnaCommunication( M-COSMIC): EvaluationofReliabilityandValidity
16. Backpropagation Artificial Neural Network To Detect Hyperthermic Seizures In Rats
17. The name is absent
18. The name is absent
19. Design and investigation of scalable multicast recursive protocols for wired and wireless ad hoc networks
20. The name is absent