[R] Plotting the complex fft in 3D?

Oliver Bandel oliver at first.in-berlin.de
Sat Sep 6 13:26:26 CEST 2008

```Hello Martin,

Zitat von Martin Maechler <maechler at stat.math.ethz.ch>:

> Just another remakr on this thread.
>
> I you have  time series and think about its fourier transform
> (EE language) then you should know that the statistical language
> of that is "spectral analysis" or maybe
>  "frequency domain time-series analysis"
> and the R function to consider should definitely be
[...]

"Yes, I'm coming from the EE world, but I also know the other terms.
The term "spectral analysis" is also used in EE, maybe not that often.
Also "frequency domain time-series analysis" is used in EE, but
maybe only at the university, later at the job, short terms
"spectral analysis" or "fft" are used. (But it may differ from country
to country.)

I tried "spectrum" now on my example data, and it looks quite different
to the result of fft().
It looks very close to what one gets as output from a spectrum analyzer
(measurement harware).
So it's quite nice to use this. :-)

>
> spectrum()  which is a wrapper (among others) to spec.pgram()
> -- which calls fft() -- for computing the so-called
> "periodogram".
> all cases you'd consider a *smoothed* version of the
> periodogram, etc etc (because the so-called *raw* periodgram is
> *in*consistent as an estimate fo the underlying true spectrum).

Well, what do you mean with inconcistent?
And why is spectrum() better?

Do you talk about things like windowing for becoming more appropriate
results?

Even if the output from spectrum() looks more like what I know from
measurement hardware, it might not always be better.
Can yo explain, why better using this?
The FFT only creates coefficients for certain seperated
frequencies. It depends on number of samlpes how accurate the
result is. And if the samples aren't an integer multiple of the
frequency in the measured signal, this creates errors in the results.

Possibly this is, what you are talking about?

Why is spectrum() better? Would be nice to have an explanation,
on how it's results are created, so that I can understand,
when which kind of analysis is better.

For the non-EE analysis, why is there fft() used and not
spectrum()?

For what kind of analysis is what function better?

> The Time-Series chapter/section of the MASS book is very helpful
> here, IIRC.

"MASS book"? Do you mean the documentation of the MASS package?

Well, so much packages.... R is very powerful and provides a lot of
things.

But where to start?

Any idea?  I started with some introductional papers and got a
good overview. But a more systematical approach might be better.

Can you recommend some things to read?
I also have seen that there is one german book about programming in R.
I will look at it in more detail, when the new edition will be published
(sept/oct).

But maybe you can recommend other readings as well?

Thanks,
Oliver

```