[R] Help with 'spectrum'
oliver at first.in-berlin.de
Wed Sep 10 12:50:20 CEST 2008
> Message: 41
> Date: Tue, 9 Sep 2008 9:44:34 -0700
> From: <rkevinburton at charter.net>
> Subject: [R] Help with 'spectrum'
> To: r-help at r-project.org
> Message-ID: <20080909124434.WMMQ2.1008129.root at mp11>
> Content-Type: text/plain; charset=utf-8
> For the command 'spectrum' I read:
> The spectrum here is defined with scaling 1/frequency(x), following
> S-PLUS. This makes the spectral density a density over the range
> (-frequency(x)/2, +frequency(x)/2], whereas a more common scaling is
> 2? and range (-0.5, 0.5] (e.g., Bloomfield) or 1 and range (-?, ?].
> Forgive my ignorance but I am having a hard time interpreting this.
Hehe, better ignore, if it's unclear ;-)
The term frequency might be used differently,
depending on the context. :)
I just want to add a note regarding fft(vect).
fft() for example does not scale with 1/n
(n is length(vect)).
This is, how fft() is used like a continous
The discrete fourier transform is defined with
1/N (N here is te nmber of samples).
This would mean, that fft() even if it is working on discrete data,
is calculatd like the classical non-discrete fourier transform.
To get a DFT out of fft() one must divide by length of the
On the other hand, fft()'s result is then really rather
a FFT than a DFT and therefore the name of that function is
good choice, IMHO.
But I'm just new to R and there may be more issues
that one can think about. spectrum() for me also is new
and I didn't looked at it in detail. As far as I understand,
the result is divided by a factor also.
The R-Help enry for frequency gives:00
"'frequency' returns the number of samples per unit time".
Maybe that means 1/N ? But I'm not used to R's timeseries
attributes, so I can't give you more help here.
BTW: I've bought the book from Venable and Ripley
and it's quite good. There you can find many hints.
If it is sufficient information to you, I don't know.
But it's a good fingerpost I think.
More information about the R-help