[R] Inverse transform after applying function in frequency domain?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Apr 19 15:06:45 CEST 2008


spec.pgram() does not just transform to frquency domain: for a single 
series it then takes the squared amplitude.  You cannot undo that.  Try 
applying (the square root of?) your function to the Fourier fransform 
instead.

Study of the references on ?spec.pgram is recommended, or a discussion 
with your Statistics supervisor about the underlying theory.


On Sat, 19 Apr 2008, Keith Alan Chamberlain wrote:

> Dear R-Help,
>
> I wish to simulate a process so that it has certain properties in the
> frequency domain. What I attempted was to generate a random time-series
> signal, use spec-pgram(), apply a function in the frequency domain, and then
> inverse transform back to the time-domain. This idea does not seem as
> straight forward in practice as I anticipated.
>
> e.g.
> x<-ts(rnorm(1000, 0,1), frequency=256)
> plot(x)				## looks like noise.
> pgm<-spec.pgram(x, taper=0)	## a flat spectra, white noise
> fx<-pgm$freq^(-1)+pgm$spec	## apply a function
> plot(log(fx)~log(pgm$freq))	## scaling properties
> x2<-fft(fx, inverse=T)
> plot(Re(x2))			## not quite what I intended
>
> . Which, although I get some fantastic looking plots, isn't quite what I
> anticipated. How do I apply a function or filter in the frequency domain,
> then inverse transform to the scale of my original time series?
>
> Sincerely,
> KeithC.
> Psych Undergrad, CU Boulder
> RE McNair Scholar [U.S]
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list