I apologize for my messy post which stems from my own confusion ... and depression as well. In fact I though I was done with a big chunk of a project and to my dismay I found out there is more to do. I am trying to adapt an algorithm, based on advanced wavelet analysis, to my respiration signals. The original algorithm was implemented in Fortran by the mathematician author of the underlying theory. I implemented it in R language with some minor changes due to the nature o fthe phenomenon I am studying. Since my results and the mathematician's results mostly disagree on the same sample signal, I was suggested to remove the low frequencies components in advance of starting wavelet analysis. Upon rereading his suggestion I got more and more confused. As far as I know Moving Average is one of the simplest DSP low-pass filters. Therefore I cannot understand how MA can be used to remove low-frequency components. Nor I can understand hi suggestion that I paste in the following.
"You have a rather short signal - 120 samples only. I avoid regarding wavelet coeffcients on senior detail levels because their main support interval is of the same order as the whole time interval and the circular effect of discrete finite wavelet transform is too strong for them. Thus, if the length of time series equals N=2^k then I work with detail levels from 1 to (k-3). It means that for this time series k=7 and the working detail levels are 1,2,3. Besides that you use periodic extension of the signal whereas I use zero padding till the length nearest N=2^k and I do not include into analysis zero wavelet coefficients which arises due to zero padding. Moreover, the SpAn removes automatically before wavelet analysis low-frequency components from the signal (which are the main source of circular effect) by moving average within time window of the radius 2^(k-3). I advise you to remove low-frequency components as well, for example by local polynomials of the 2-nd order wit! hin moving time window of the radius 8 samples (the length of moving window equals 17, i.e. slightly more than 16 - maximum scale for the 3-rd detail level)." Thank you so much, Maura -----Messaggio originale----- Da: David Winsemius [mailto:dwinsem...@comcast.net] Inviato: gio 26/02/2009 14.54 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: [R] Moving Average I saw Gabor's reply but have a clarification to request. You say you want to remove low frequency components but then you request smoothing functions. The term "smoothing" implies removal of high-frequency components of a series. If smoothing really is your goal then additional R resource would be smooth.spline, loess (or lowess), ksmooth, or using smoothing terms in regressions. Venables and Ripley have quite a few worked examples of such in MASS. -- David Winsemius On Feb 26, 2009, at 7:07 AM, <mau...@alice.it> wrote: > I am looking for some help at removing low-frequency components from > a signal, through Moving Average on a sliding window. > I understand thiis is a smoothing procedure that I never done in my > life before .. sigh. > > I searched R archives and found "rollmean", "MovingAverages {TTR}", > "SymmetricMA". > None of the above mantioned functions seems to accept the smoothing > polynomial order and the sliding window with as input parameters. > Maybe I am missing something. > > I wonder whether there is some building blocks in R if not even a > function which does it all (I do not expect that much,though). > Even some literature references and/or tutorials are very welcome. > > Thank you so much, > Maura > > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. tutti i telefonini TIM! [[alternative HTML version deleted]] ______________________________________________ R-help@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.