Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Binary time series

 From Robert A Yaffee To statalist@hsphsun2.harvard.edu Subject Re: st: Binary time series Date Wed, 22 Sep 2010 00:18:12 -0400

```John,
Just another thought.   You might want to consider using gllamm or xtmelogistic.
Robert

Robert A. Yaffee, Ph.D.
Research Professor
Silver School of Social Work
New York University

Biosketch: http://homepages.nyu.edu/~ray1/Biosketch2009.pdf

CV:  http://homepages.nyu.edu/~ray1/vita.pdf

----- Original Message -----
From: Robert A Yaffee <bob.yaffee@nyu.edu>
Date: Tuesday, September 21, 2010 11:23 pm
Subject: Re: st: Binary time series
To: statalist@hsphsun2.harvard.edu

> John,
>       Irregularly spaced time series has been handled by attempts to
> model intermittend demand.
> Croston's method and variations on it have been used to handle such
> data.  Unfortunately, Stata has no command for Croston's method.   In
> high frequency financial data,  they attempt to model integrated
> volatility or realized volatility by taking the absolute or squared
> value of transactions at various time intervals.  Sometimes the
> interval is a five or ten minute interval.  Sometimes the interval is
> the complete workday, during which the value of the transactions might
> be summed.
> The problem with the square is that jumps in volatility may occur that
> can complicate the assessment of volatility if they are not taken into
> account.  One thing to consider is how to decide upon the proper
> interval in which a variance can be computed.
>     Croston's method uses a simple exponential smoother to handle the
> interval between observations.   A different exponential smoother used
> to account for the magnitude of the observation.
>     Finally, to achieve the mean demand rate, Croston divides the
> magnitude of demand by the interval time, each of which are the
> dependent variables in the simple exponential smoother.
>     There have been modifications of this method by Johnston and
> Boylan and Boylan and Syntetos somewhat later.
>      Siem Jan Koopman with others has set forth a generalized scoring
> algorithm handling such time series models.  But I haven't seen the
> software yet.
>      These may give you some ideas.
>          Cheers,
>                 Robert
>
>
>
>
>
> Robert A. Yaffee, Ph.D.
> Research Professor
> Silver School of Social Work
> New York University
>
> Biosketch: http://homepages.nyu.edu/~ray1/Biosketch2009.pdf
>
> CV:  http://homepages.nyu.edu/~ray1/vita.pdf
>
> ----- Original Message -----
> From: John Morton <john.morton@optusnet.com.au>
> Date: Tuesday, September 21, 2010 8:14 pm
> Subject: st: Binary time series
> To: statalist@hsphsun2.harvard.edu
>
>
> > Hi again,
> >
> > Same message as 90 minutes ago, this time with a subject heading. My
> > apologies for overlooking this in the previous post.
> >
> >
> > I am seeking advice on analysis of a time series dataset in Stata.
> The
> > same
> > site was visited irregularly 30 times over 3 years (median interval
> between
> > visits 35 days, range 18 to 68 days). At each visit, usually 5
> > sometimes 6 or 9) were sampled (numbers were limited because this is
> an
> > endangered species). Different tadpoles were sampled at each visit.
> Each
> > tadpole was tested and categorised as test positive or test negative.
> > Apparent prevalences were 1.00 at about half of the visits and 0.00
> at
> > 25% of visits.
> >
> > The researcher?s question is whether prevalence varies by month (ie
> Jan,
> > Feb, Mar etc) or by season.
> >
> > The features of this data that seem important are that the errors
> > would be
> > expected to be serially correlation over time, the dependent
> variable
> > is
> > binary, prevalences of 0 and 1 were common, the very small number of
> > tadpoles sampled at each visit, and these are not panel data (ie different
> > tadpoles were sampled at each visit).
> >
> > I have done some exploratory modelling treating prevalence as a continuous
> > dependent variable (using -regress-) after declaring the data to be
> > time-series data (with sequential visit number rather than day
> number
> > as the
> > time variable, using -tsset-). With a null model, tests for serial
> > correlation (Durbin-Watson test (-estat dwatson-), Durbin?s
> > alternative (h)
> > test (-estat durbinalt-),Breush-Godfrey test ( -estat bgodfrey,lag(6)-),
> > Portmaneau (Q) test (-wntestq-) and the autocorrelogram (-ac-)(all
> > from Baum
> > 2006) indicate serial correlation. In contrast, after fitting month
> as
> > a
> > fixed effect, these tests do not support rejecting the null
> hypothesis
> > that
> > no serial correlation exists. However treating prevalence (a
> > proportion) as
> > a continuous dependent variable (using -regress-) is inappropriate.
>
> >
> > Any suggestions on approaches to answer the research question would
> be
> > much
> > appreciated.
> >
> > Many thanks for any help.
> >
> > John
> >
> > ***************************************************************
> > Dr John Morton BVSc (Hons) PhD MACVSc (Veterinary Epidemiology)
> > Veterinary Epidemiological Consultant
> > Jemora Pty Ltd
> > PO Box 2277
> > Geelong 3220
> > Victoria Australia
> > Ph:  +61 (0)3 52 982 082
> > Mob: 0407 092 558
> > Email: john.morton@optusnet.com.au
> > ***************************************************************
> >
> >
> >
> > *
> > *   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/
>
> *
> *   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/

*
*   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/
```