[R] Plotting the complex fft in 3D?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Sep 6 16:10:50 CEST 2008



Oliver Bandel wrote:
> 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".
>> If you learn more about the topic, you will learn that in almost
>> 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?
> 

spectrum() and spec.pgram() use fft() to calculate results. But some 
information is thrown away, some information is merged appropriately, 
and maybe tapering and padding is applied. Well, it really depends on 
your tasks which functions to use. I found myself frequently using fft() 
and doing the rest manually, because spectrum() is sometimes too 
intelligent for me ...


>> 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?


No, the other way round: the Springer book "Modern Applied Statistics 
with S, 4th edition, 2002, by Venables and Ripley has some package 
(MASS) as supplementary material.

Best wishes,
Uwe Ligges



> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list