Hello,
I was thinking how to implement the following code snippet into a
vectorized form, but I couldn't figure out how to do this effectively. The
issue I face is the lagged value of y which changes over the loop. Does
anybody have an alternative way to run this thing?
scalar T = 100
scalar b1
On Sat, 29 Mar 2014, Artur T. wrote:
> Hello,
>
> I was thinking how to implement the following code snippet into a
> vectorized form, but I couldn't figure out how to do this effectively. The
> issue I face is the lagged value of y which changes over the loop. Does
> anybody have an alternative w
This was my attempt (but results are the expect ones):
set seed 732237
scalar T = 100
scalar b1 = -0.2
scalar b2 = 0.5
matrix u = mnormal(T,1)
matrix dx = mnormal(T,1)
matrix dy = zeros(T,1)
matrix y = zeros(T,1)
loop i=2..T -q
dy[i] = b1*y[(i-1)] + b2*dx[i] + u[i]
y[i] = y[i-1] + dy[i]
Thank you both Jack and Hélio for your suggestions! Both example work well.
Jack's nice version is about 10% less time consuming than my original
example (at least in my procedure here).
Best,
Artur
2014-03-29 16:08 GMT+01:00 Hélio Guilherme :
> This was my attempt (but results are the expect o
On Sun, 30 Mar 2014, Artur T. wrote:
> Thank you both Jack and Hélio for your suggestions! Both example work well.
> Jack's nice version is about 10% less time consuming than my original
> example (at least in my procedure here).
The "varsimul" function is especially useful when generating multiv
I must be having some memory problems!
My example is wrong if you test it you will see that the results differ. I
ment to warn you of that but wrote exactly the opposite (missed the "not"
word): (but results are NOT the expectED ones)
Please double check the script.
Hélio
On Sun, Mar 30, 2014
Actually I already used the varsimul() function before, but totally forgot
about it. But I didn't know about the possible use of the filter function
in this context. Thank you for this hint!
Artur
2014-03-30 19:54 GMT+02:00 Hélio Guilherme :
> I must be having some memory problems!
>
> My exampl