I learned how to solve difference equation
$y(n) = (0.85)y(n-1) + x(n)$
using z Transform, and inverse z Transform, I get
$h(n) = 0.85^n u(n)$
where $u(n)$ is unit step sequence. Now my question is how do I use this solution on my data? I have
[ 4. 3. 2. 8. 4. 4. 10. 4. 10. 7. 4. 7. ]
starting from n=1, and these are supposed to be $x(n)$ values for each year (n). But in the solution, there aren't any parameters to play with for any kind of fitting procedure. Maybe the solution was wrong to begin with. Any ideas?
Based on r.e.s.'s answer, I coded this
patents = np.array([ 4., 3., 2., 8., 4., 4., 10., 4., 10., 7.]) def u(n,k): if n-k < 0: return 0 return 1. def y(n,data): sum = 0 for k in range(len(data)): sum += data[k]*(0.85**(n-k))*u(n,k) return sum for n in range(len(patents)): print y(n,patents)
and it gave the same results I received from Python's lfilter function.
Note: The difference equation above is known as "cumulative sum with deprecitation" in literature.