I'd suggest taking a look at:
Cox, N. J. 2007. Speaking Stata: Identifying Spells. Stata Journal 2: 249-65.
I've worked quit a bit with data in which I needed to identify periods of different behavior patterns. I found Nick's article very helpful. Thanks Nick!
Brad Anderson
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jakob Petersen
Sent: Wednesday, February 25, 2009 9:02 AM
To: [email protected]
Subject: st: Identifying coherent periods of events with irregular reoccurrence from a time sequence
Statalisters,
I have a problem identifying compliant vs. non-compliant periods in patients' prescription history. I assume that this type of problems is known from other areas with temporal sequences (climate, transactional, reoffending, etc.).
How would it be possible to flag and number a) coherent periods of prescriptions; b) gaps; c) beginning dates; and d) end dates to each period?
Example (with two clearly separated periods):
order day
1 0
2 29
3 57
4 89
5 114
6 293
7 309
8 342
9 363
10 407
11 434
12 461
Any advice or suggestions will be much appreciated.
Jakob Petersen
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual
or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified
that any disclosure, copying, distribution or taking of any action in reliance on the information contained in
this e-mail is prohibited. If you have received this e-mail in error, please notify sender by reply e-mail and
delete this message and any attachment(s) immediately. Thank you for your consideration in this matter.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/