On Fri, 26 Mar 2010, Henrique Andrade wrote:
I have a trivariate VAR (v1, v2, v3) and I would like to save
responses of
"v1" to a one-standard error shock in the "v2".
Using the GUI, after estimating a VAR, I can select Analysis -> Impulse
responses and then save the results as a .txt file and edit this file to
obtain what I want.
How can I do this using a script?
Use the outfile command along with the --impulse-responses option
to the var command. Or, if you prefer, calculate the response
yourself in a matrix:
<script>
open data9-12
scalar order = 4
list Y = 1 2 3
var order Y --impulse-responses
matrix A = $compan
matrix C = zeros(nelem(Y)*order, nelem(Y))
C[1:3,] = cholesky($sigma)
# pick your target and shock variables
target = 1
shock = 2
matrix response = zeros(20,1)
response[1] = C[target, shock]
loop i=2..20 --quiet
C = A * C
response[i] = C[target, shock]
endloop
print response
</script>
Allin Cottrell