[R] Again question about filter()

Sergey Goriatchev sergeyg at gmail.com
Sun Aug 10 18:47:57 CEST 2008


Hello,

I thought I understood filter() with the help from Prof. Grothendieck,
but I guess I did not.
For example, how does this work:

 filter(1:10, c(0.1, 0.5, 1, 0.5), "recursive", init=c(1,2,3,4))
Time Series:
Start = 1
End = 10
Frequency = 1
 [1]   7.10000   6.71000   9.22100  15.87710  21.45821  28.66037
41.08274  55.83522  74.51437 100.78197

If I understand it correctly, the time series, together with initial
values, looks like
1,2,3,4,1,2,3,4,5,6,7,8,9,10

The first value is calculated as 1*0.1+2*0.5+3*1+4*0.5+1=7.1,
where the first four arguments are initial values times coefficients,
and the last argument is the first value
of the timeseries, that is 1.
But how are the consecutive values calculated?
Totally at a loss. Please, help.

/Sergey

-- 
I'm not young enough to know everything. /Oscar Wilde
Experience is one thing you can't get for nothing. /Oscar Wilde
When you are finished changing, you're finished. /Benjamin Franklin
Tell me and I forget, teach me and I remember, involve me and I learn.
/Benjamin Franklin
Luck is where preparation meets opportunity. /George Patten



More information about the R-help mailing list