[R] fft: characteristic function to distribution

Thomas Steiner finbref.2006 at gmail.com
Tue May 13 11:22:25 CEST 2008


Matthias Kohl was so kind and provided me the following lines in this issue:

library(distrEx)
chf <- function(t, D){
  E(D, function(x){exp(1i*t*x)}, useApply = FALSE)
}

## Normalverteilung
D <- Norm()
t <- seq(-3, 3, by = 0.05)
chf.norm <- sapply(t, chf, D = D)
chf.exakt <- exp(-t^2/2)
chf.diff <- chf.norm - chf.exakt
plot(chf.diff)
abs(chf.diff)


This is nice BUT:
* Only built-in distributions can be used
* I want to understand the fft() function, instead here you used E()
of the distrEx package.

Apart from this it was exactly what i was looking for: I know the
characteristic function and want to get the distribution. (My porposal
was to use fft(,inverse=T).)
Any help appreciated,
Thomas



More information about the R-help mailing list