Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Identifying coherent periods of events with irregular reoccurrence from a time sequence


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Identifying coherent periods of events with irregular reoccurrence from a time sequence
Date   Wed, 25 Feb 2009 08:47:07 -0600

It is not clear to me what constitutes the two separate periods in
your example - I assume the large change in day variable from order 5
to order 6.

You might find Nick Cox's -tsspell- helpful with this task.

For example

clear
input 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
end
tsset order
tsspell day, fcond(d.day>100)
l, sepby(_spell) noobs

Scott


On Wed, Feb 25, 2009 at 8:02 AM, Jakob Petersen <j.petersen@ucl.ac.uk> wrote:
> 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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index