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

# Re: st: Slope of a univariate time series

 From Tashi Lama To "statalist@hsphsun2.harvard.edu" Subject Re: st: Slope of a univariate time series Date Sat, 9 Jun 2012 12:36:14 -0400

```Sure thanx, i will def read poisson regression.

On Jun 9, 2012, at 12:13 PM, Nick Cox <njcoxstata@gmail.com> wrote:

>
> 1. I think you are confusing fitting a Poisson distribution with
> Poisson regression, which is a much more general procedure. This may
> be because you have not yet read the documentation for -poisson- or
> any of the supporting references.
>
> 3. This is a matter of taste. My own taste is that if the idea of an
> overall slope makes sense then it makes sense to estimate it with a
> model. The slope between neighbouring data points may seem closer to
> the data but it is in fact more sensitive to individual errors.
> Testing whether slopes are genuine (meaning, not zero) is a problem
> that has served as a sandpit for mathematical statisticians, but data
> analysts in my experience are usually happy to settle the question
> from a plot of the data.
>
> At a wild guess the most common decay rate problems are those of
> exponential or power-law declines, which are most commonly regarded as
> regression problems. The time series aspect of the data is quite
> secondary. When particular functions arise in theoretical discussions
> or are customary in the literature (e.g. exponential decay to a
> positive asymptote) then often -nl- is needed.
>
> The problem with a straight linear regression fitted to a declining
> series is that it predicts negative values beyond some finite time,
> which usually makes neither theoretical or practical sense whenever
> what is being measured is a count or amount. This doesn't bite with
> Poisson regression, but that nice property does not guarantee that
> Poisson regression is what you need.
>
> All that said, the data you posted in
> http://www.stata.com/statalist/archive/2012-06/msg00486.html are not
> even approximately linearized by thinking in terms of log(hits), as a
> plot shows. So you may need some special-purpose model.
>
> Nick
>
> On Sat, Jun 9, 2012 at 2:37 PM, Tashi Lama <ltashi32@hotmail.com> wrote:
>> Three thoughts
>> 1. I have never looked at any distribution as a measure to find slope or rate for that matter. I looked distribution more of finding probability, mean and deviation. How it generates slope is sth i need to go back and do some reading but i do see that the data spread in my dataset resembles that of a poisson.
>> 2. I was actually thinking of running regression which will give me "beta" which is a slope mathematically. But i suspect that would be a overkill. Honestly, i don't even know i use regression although mathematically speaking it could.
>> 3. May be i can find slope at each two consecutive data points and find median or mean.
>>
>> In any case, what is the most common way of finding slope or a decay rate in a univariate time series in stata?
>
> On Jun 9, 2012, at 9:11 AM, Nick Cox <njcoxstata@gmail.com> wrote:
>
>>> Yes, but Tashi's context implies that linear decline is not a good
>>> model. I earlier recommended Poisson regression, for which see
>>> -poisson-.
>
> On Sat, Jun 9, 2012 at 2:00 PM, Muhammad Anees <anees@aneconomist.com> wrote:
>>>> Do you mean d(x)/d(t)?
>>>> Then I guess simple OLS will do that
>>>>
>>>> reg x t
>>>> b is the slope then assuming above.
>>>
>>> On Sat, Jun 9, 2012 at 5:51 PM, Tashi Lama <ltashi32@hotmail.com> wrote:
>>>
>>>>>  Is there a stata command or a module to find the slope of a univariate time series?
>
> *
> *   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/
```