Andy Rominger
2010-May-28 00:39 UTC
[R] simulate time series with various "colors" of noise
Hello,
I'm trying to simulate time series with various "colors" of noise
to verify
some other code I've written. I'm using the fractal package,
specifically
FDSimulate. I have a detailed question about this particular function, but
I'd also be happy to receive any suggestions for other packages, functions,
citations.
To the question: FDSimulate takes a delta parameter governing the
fractionally differenced process. Using delta = 0 we get white noise, delta
= 0.5 pink, and delta = 1 red/"brown." Everything seemed to be
working
great for delta = 0 and 1, but at delta = 0.5 there were problems. Using
the FDWhittle function (which should back-calculate delta from a series of
numbers) I investigated what's going on:
#########################
require(fractal)
these.delt <- rep(seq(0,1,length.out=100),rep(10,100))
est.delt <- numeric(1000)
# this takes a few seconds
for(i in 1:1000) {
this.x <-
FDSimulate(rep(these.delt[i],1000),rep(1,1000),method="ce",seed=runif(1,1,10000))
est.delt[i] <- FDWhittle(this.x)
}
plot(these.delt,est.delt,xlab="delta",ylab="estimated
delta")
abline(0,1,col="red")
#########################
This plot shows that for FDSimulate(delta=0,...) we can back-calculate the
right value, but at FDSimulate(delta=0.5,...) there is a big jump from a
back-calculated delta of around 0.1 to one of 0.7 (when it should be 0.5).
At FDSimulate(delta=1,...) the given and back-calculated values line up. So
my question is...which function is not doing its job (or which do I not
understand!), does FDSimulate not produce accurate time series, or does
FDWhittle not accurately estimate delta? I tried using different methods in
FDSimulate but they threw the error:
Error in as.vector(.Call("RS_fractal_bootstrap_circulant_embedding",
S, :
error in evaluating the argument 'x' in selecting a method for
function
'as.vector'
If I am missing other useful functions for producing/estimating time series
of the fractional/long-memory type I would also welcome suggestions.
Thanks for your thoughts and insights!
Andy Rominger
[[alternative HTML version deleted]]
