I am seriously at a loss in front of this, what does the stats filter command in R do how is the "Convolution" method implemented. I understand the case when filter is 1 but for any other value of filter things get confusing. From another question in stackoverflow (simple examples of filter function, recursive option specifically) I understood how "convolution" works for filter =1 eg:
f1<-1,f2<-1,f3<-1
x<-c(1:5)
filter(x,c(f1,f2))
3 5 7 9 NA
#which translates to
x[1]*f1+x[2]*f2
x[2]*f1+x[3]*f2
x[3]*f1+x[4]*f2
x[4]*f1+x[5]*f2
x[5]*f1+x[6]*f2 #x[6] is NA
#filter other than 1
#filter<-c(1,2)
filter(x,c(1,2))
4 7 10 13 NA
#and not the below ones
x[1]*f1+x[2]*f2=5
x[2]*f1+x[3]*f2=8
x[3]*f1+x[4]*f2=11
and so on, what exactly is happening here? this might be trivial and because of the lack of understanding Convolution method, but I am not able to figure it out