Skip to content

Fourier Analysis and Curve Fitting in R

3 messages · Carson Farmer, stephen sefick, Spencer Graves

#
Rolf Turner wrote:
#
well if you want to find the spectral density aka what frequencies
explain most of the variance then I would suggest the spectral
density.  This can be implemented with spec.pgram().  This is
conducted with the fast fourier transform algorithm.
and you should be able to take it from here

This will give you the raw periodogram and the dominant frequencies
after you smooth the periodogram.  If your intention is to just fit a
curve to your data there are many types of cuve fitting options moving
average etc.

What are you trying to do find the dominant periodicy? make a
prediction equation? fit a smooth line? or...

give us some more information and maybe we can help
On 1/28/08, Carson Farmer <cfarmer at uvic.ca> wrote:

  
    
#
The 'fda' package supports fitting finite Fourier series with examples 
in 'canadian-weather.R' and 'gait.R' in the 'demo' subdirectory of 
'~R\library\fda\fda';  see also 'fda-ch01.R' in the 'scripts' 
subdirectory.  Also, the 'percur' funcction in the 'DierckxSpline' 
package supports fitting periodic splines.
stephen sefick wrote: