[R] Difference between spec.pgram & spec.ar
Bazman76
h_a_patience at hotmail.com
Mon Apr 9 17:59:02 CEST 2012
oops sorry
n 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?
« [hide part of quote]
*Because they really measure different things? Why do you expect to get
the same output in time as well as in frequency domain? *
Uwe Ligges
>
> code shown below:
>
> library("waveslim")
>
> vols=read.csv(file="C:/Users/ocuk/My Documents/Abs Vol.csv", header=TRUE,
> sep=",")
> x<-ts(vols[,1])
> #x
>
> ## LA(8)
> vol.la8<- mra(x, "la8", 4, "modwt")
> names(vol.la8)<- c("d1", "d2", "d3", "d4", "s4")
> ## plot multiresolution analysis of IBM data
> #par(mfcol=c(6,1), pty="m", mar=c(5-2,4,4-2,2))
> par(mfcol=c(3,1), pty="m", mar=c(5-2,4,4-2,2))
> plot.ts(x, axes=F, ylab="", main="(abs rtns)")
> #for(i in 1:5)
> # plot.ts(vol.la8[[i]], axes=F, ylab=names(vol.la8)[i])
> #axis(side=1, at=seq(0,1600,by=100),
> # labels=c(0,"",200,"",400,"",600,"",800,"",1000,"",1200,"",1400,"",1600))
>
> spectrum(vol.la8[[1]])
> specx<- spec.ar(x)
>
> --
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
« [hide part of quote]
*OK so I neeed to understan better what it it they are trying to measure.
I understood (incorrectly it seems) that they were simply different methods
to get the same result? *
--
View this message in context: http://r.789695.n4.nabble.com/Difference-between-spec-pgram-spec-ar-tp4541358p4543140.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list