A failed experiment with spectral density estimation in R

Spectrum analysis (see wiki entry) is a technical process to visualize a time series data in the frequency domain to find hidden periodicities. As I continue my struggle in data mining with R, I thought I might try looking at a year's worth of USDJPY 1-min exchange rate data in the frequency domain. This is what I got.

Certainly not one of those nice looking graphs in a textbook. Notice that:

  1. there is no distinct frequencies
  2. bandwidth is ridiculously small

What this means is that the USDJPY data is practically white noise. And that there's much work for me ahead before I can produce something useful in R. The source code to produce the graph is printed below. The USDJPY data isn't published as it's not small and you can get it at various places for free on your own. Update: Failed is a harsh word. I should call this a trivial experiment.

 op \<- options(digits.secs=3) \# set option to show milliseconds
cat("loading CSV file to 'data'\\n") print( system.time( data \<-
read.csv( file="data/USDJPY\_20090630-13-27to20101130-22-19\_1Min.csv",
head=TRUE, sep=",") ) ) \# convert long timestamp to POSIX
rownames(data) \<- as.POSIXct(as.numeric(rownames(data))/1000,
origin="1970-01-01", tz="GMT") data \<- data.matrix(data) library(xts)
\# load xts library cat("converting to xts 'data.x'\\n")
print(system.time(data.x \<- as.xts(data))) rm(data) \# remove data
object cat("data.x object size: ") print(object.size(data.x), units =
"auto") cat("spectral analysis\\n") spectrum(data.x\$close)