[R] Difference between spec.pgram & spec.ar

peter dalgaard pdalgd at gmail.com
Mon Apr 9 18:00:42 CEST 2012


On Apr 9, 2012, at 16:55 , Uwe Ligges wrote:

> 
> 
> On 08.04.2012 20:39, Bazman76 wrote:
>> Hi there,
>> 
>> Can someone explain what the difference between spec.pgram and spec.ar is?
>> 
>> I understand that they attempt to do the same thing one using an AR
>> estimation of the underlying series to estimate teh sensity the other using
>> the FFT. However when applied to teh same data set they seem to be giving
>> quite different results?
>> 
>> http://r.789695.n4.nabble.com/file/n4541358/R_example.jpg
>> 
>> 
>> Clearly the spec.ar() result seems to be smoothed but the results are also
>> generally very different only really sharing the peak as the frequencies go
>> towards zero.
>> 
>> Can someone please explain why these two functions produce such different
>> results on the same data set?
> 
> Because they really measure different things? Why do you expect to get the same output in time as well as in frequency domain?


That wasn't the question.... There is a raw series and two spectra, and it is the difference between the latter that is remarkable. Offhand, this is of course a bit like comparing a model fit to a nonparametric smoother of ordinary measurements: Sometimes the data just do something that the model says that they can't do and you get huge discrepancies. So the first reaction must be that an autoregressive model is just wrong for these data. My second reaction would be that the original series look a bit like they might have an asymmetric distribution, so perhaps a log or a square root transformation is warranted. 

That being said, I'm still quite stumped trying to explain the pattern in the raw periodogram. Notice that what you are seeing is not so much an initial peak as a region in which the spectrum drops effectively to zero. Have the data by any chance been subject to some sort of preprocessing that removes low-frequency components?

At any rate, this isn't really about R, is it?

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list