Open jfree-man opened 3 months ago
Thanks @jfree-man. I have one observation. If I modify one of the lines above to this:
manual_convolution = k[1] * X_sim$value + k[2] * X_sim$lag_1 + k[3] * X_sim$lag_2
I get a better agreement, although there is still an issue with how the first few outputs are treated:
manual_convolution macpan2_convolution
[1,] 0.750000 1.000000
[2,] 1.500000 1.750000
[3,] 2.625000 2.625000
[4,] 3.937500 3.937500
[5,] 5.906250 5.906250
[6,] 8.859375 8.859375
[7,] 13.289062 13.289062
[8,] 19.933594 19.933594
[9,] 29.900391 29.900391
[10,] 44.850586 44.850586
It looks like both our interpretations are consistent with the equation given in the ms:
I get my interpretation if i
starts at 0
and yours if i
starts at 1
.
@stevencarlislewalker I was assuming i
started at 0
, and $\phi(0)=1$ so the first term is just $X(t)$.
If i
starts at 1, I think it should be this,
manual_convolution = k[1]*X_sim$lag_1 + k[2]*X_sim$lag_2 + k[3]*X_sim$lag_3
Then we get a better agreement than my initial assumption, but it still needs some fixing.
manual_convolution macpan2_convolution
[1,] 0.000000 1.000000
[2,] 0.750000 1.750000
[3,] 1.500000 2.625000
[4,] 2.625000 3.937500
[5,] 3.937500 5.906250
[6,] 5.906250 8.859375
[7,] 8.859375 13.289062
[8,] 13.289062 19.933594
[9,] 19.933594 29.900391
[10,] 29.900391 44.850586
macpan2::convolution
computes different values than manual convolution computation,k
is left out,