I'm trying to do some spectral analysis of time series using the function
spectrum().
For testing purposes I tried to compare the variance of the time series
var(x) with the integral of the spectrum for w in the interval (0,pi) which
should be equal - at least I think so...
As they were not for my time series I tried the following example by
simulating an AR process:
x <- arima.sim(n=1000, model=list(ar=0.7)) # simulate AR process
spec <- spectrum(x, span=20) # calculate smoothed spectrum
f <- 10^(spec$spec/10) # convert dB into real numbers
n <- length(f)
w <- 2*pi*spec$freq # convert frequency into angular frequency
sum(f[-n]*diff(w)) # simple integration
[1] 5.603431
but:
var(x)
[1] 1.972082
What am I missing here?
Thank you for your help...
-----------------------------------------------------------------
Jan Schelling
Institute of Process Engineering
ETH Zurich, 8092 Switzerland
phone: ++41-1-633 62 63
fax: ++41-1-633 11 19
email: schelling@ivuk.mavt.ethz.ch
internet: http://www.ivuk.ethz.ch/staff/schelling/
-----------------------------------------------------------------
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news