Spells in time series (and more generally in any kind of one-dimensional series) may be defined as sequences of observations that are homogeneous in some sense. For example, a categorical variable may remain in the same state, or values of a measured variable may satisfy the same true-false condition. Devices for working with spells in Stata include marking the start of each spell with indicator variables and tagging spells with integer codes. Panel data are easy to handle with the by: prefix. Some kinds of spell identification require two passes through the data, as when only spells of some minimum length are of interest or short gaps are tolerable within spells. Many questions concerning spells are easy to answer given careful use of by : and appropriate sort order, selection of just 1 observation from each panel or spell, and appreciation of the many functions written for egen. Gaps before, between, and after spells can also be important, and 1 suggest a convention for handling them. © 2007 StataCorp LP.
CITATION STYLE
Cox, N. J. (2007). Speaking Stata: Identifying spells. Stata Journal, 7(2), 249–265. https://doi.org/10.1177/1536867x0700700209
Mendeley helps you to discover research relevant for your work.