# Re: st: Is maximum likelihood lf method appropriate for lagged (timeseries) data?

 From "Brian P. Poi" To statalist@hsphsun2.harvard.edu Subject Re: st: Is maximum likelihood lf method appropriate for lagged (timeseries) data? Date Thu, 11 Mar 2004 14:11:27 -0600 (CST)

```Earlier today John Hund wrote:

> I am new to Stata and especially new to the maximum likelihood command
> in Stata, and I am trying to assess whether the lf method is possible
> for the likelihood function I need to maximize.  The fundamental problem
> is to estimate the mean and standard deviation of an (unobserved)
> geometric diffusion process.  The unobserved data is a nonlinear
> function of the observed data under a particular model; I can (and
> already have written a Stata function to) numerically invert the
> function to get observations to apply to the density.  If the data was
> observed, the density would simply be the lognormal distribution; as it
> is, the density is the lognormal distribution multiplied by the Jacobian
> of the nonlinear transformation (which I have in closed form).

> I think that the lf method would work fine given that the transformation
> is a one-to-one mapping...but the likelihood of each individual
> observation depends on the observation previous to it.  That is, the
> likelihood contains the ratio of two successive observations, since the
> diffusion process describes the change through time.  Specifically, if
> the data at t is Vt, the likelihood incorporates the term: ln(Vt/Vt-1).
> I can't just transform the data before I hand it to the maximizer since
> I have to invert the data inside the maximization step (the
> transformation depends on the estimated parameters).  I have tried to
> pass two sets of data into my program...the data and the lagged data,
> but haven't gotten it to work, and I'm not sure whether that has to do
> with my inexperience or if this incorporates a violation of the linear
> form restrictions.

> Does anyone have any experience with either fitting diffusions in Stata,
> or more generally, using the ml command to fit time-series models (where
> this sort of issue would naturally arise)?  Is there a reference
> somewhere for writing Stata likelihoods for time-series
> maximization...nearly all of the examples I've seen are cross-sectional?

Although there are probably exceptions, most time-series models would
require you to use a type d0, d1, or d2 evaluator because it is not
possible to write the log likelihood of a single observation without
referring to prior values of some of the variables.

In John's case, a type lf evaluator cannot be used because the term
ln(Vt/Vt-1) depends on Vt-1, which is itself a function of the parameters.

If John would like to send me his likelihood function, programs, and data
privately, I would be more than happy to help him further.

-- Brian Poi
-- bpoi@stata.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```