# real raw periodogram
mvspec(soi)
mvspec(soi, log='y') # on a log scale
# smooth and some details printed
mvspec(soi, spans=c(7,7), taper=.1)$details[1:45,]
# bivariate example
deth = cbind(mdeaths, fdeaths) # two R data sets, male/female monthly deaths ...
tsplot(deth, type='b', col=c(4,6), spaghetti=TRUE, pch=c('M','F'), addLegend=TRUE)
dog = mvspec(deth, spans=c(3,3), taper=.1)
dog$fxx[,,1:5] # look at a few spectral matrix estimates
dog$bandwidth # bandwidth with time unit = year
dog$df # degrees of freedom
mvspec(deth, spans=c(3,3), taper=.1, plot.type='coh') # coherence
# multivariate example
mvspec(diff(log(econ5)), spans=c(5,5), col=5, lwd=2, ci=NA, gg=TRUE, minor=FALSE,
plot.type='coh')
mvspec(diff(log(econ5)), spans=c(5,5), col=5, lwd=2, ci=NA, gg=TRUE, minor=FALSE,
plot.type='coh', addLegend=FALSE)
Run the code above in your browser using DataLab