Skip to content

Phase spectrum

2 messages · Gunnar Hoyer, stephen sefick

#
Hello,

I have trouble to interpret the phase spectrum correctly.

Here is the code (with different data) I used to get the phase spectrum:

mfdeaths.spc <- spec.pgram(ts.union(mdeaths, fdeaths), spans = c(3,3))
plot(mfdeaths.spc, plot.type = "phase")

I would like to know whether positive or negative values indicate that 
the time series mdeaths leads or lags.

Thanks in advance
Gunnar Hoyer
#
lag.plot2=function(data1,data2,max.lag=0,corr=TRUE,smooth=FALSE){
   name1=paste(deparse(substitute(data1)),"(t-",sep="")
   name2=paste(deparse(substitute(data2)),"(t)",sep="")
   data1=as.ts(data1)
   data2=as.ts(data2)
   max.lag=as.integer(max.lag)
   m1=max.lag+1
   prow=ceiling(sqrt(m1))
   pcol=ceiling(m1/prow)
   a=ccf(data1,data2,max.lag,plot=FALSE)$acf
  par(mfrow=c(prow,pcol), mar=c(2.5, 4, 2.5, 1), cex.main=1.1, font.main=1)
  for(h in 0:max.lag){
   plot(lag(data1,-h), data2, xy.labels=F,
main=paste(name1,h,")",sep=""), ylab=name2, xlab="")
    if (smooth==TRUE)
    lines(lowess(ts.intersect(lag(data1,-h),data2)[,1],
                 ts.intersect(lag(data1,-h),data2)[,2]), col="red")
    if (corr==TRUE)
    legend("topright", legend=round(a[m1-h], digits=2), text.col
="blue", bg="white", x.intersp=0)
   }
}

I believe that it is neither

library(zoo)
plot(coredata(mdeaths)~coredata(fdeaths))

But I am still learning about timeseries analysis.

Stephen Sefick


On Thu, Mar 19, 2009 at 6:04 PM, Gunnar Hoyer
<gunnar.hoyer at uni-oldenburg.de> wrote: