Steps I will have to take:
1) Run VAR for each stock
2) Run GIRF for each stock and store coefficients + S.E.s
3) Take average of the coefficients
4) Sum the squared S.E.s and divide by the number of stocks squared (this is in line with the paper I mentioned)
(5) Make graphs of the averaged data)
I have attached a mockup dataset with random data (the actual dataset is much larger and contains 100 stock symbols). This is what I have come up with so far:
Code: Select all
'Create a for loop to run the VAR and GIRF for each stock
for %sym AAPL GOOG MFB
smpl if symbol=%sym
var var_{%sym}.ls(noconst) 1 4 data1 data2 data3
var_{%sym}.impulse(10, t,a, imp = gen,se=a,matbyr=estimates_{%sym})
next
'Do the averaging of the coefficients + S.E.'s
'??Could anyone help me out? Many thanks in advance.
EDIT: after spending quite some time reading through documentation I have come up with the (inelegant) solution below. There are still some issues though. The biggest inconvenience is that I have to explicitly name the stock symbols (instead of using a function to get a list of all unique characters in the series for example). Moreover, if I understand the reference paper correct then the average SE is equal to square root(sum of the variances/number of stocks squared) but I don't know how to take the element-wise square root of a matrix (I am using EViews 8 by the way).
Code: Select all
'Create a for loop to run the VAR and GIRF for each stock
for %sym AAPL GOOG MFB
smpl if symbol=%sym
var var_{%sym}.ls(noconst) 1 4 data1 data2 data3
var_{%sym}.impulse(10, t,a, imp = gen,se=a,matbyr=estimates_{%sym})
next
'Do the averaging of the coefficients
matrix avg_coef = estimates_aapl
for %sym GOOG MFB
avg_coef = avg_coef + estimates_{%sym}
next
avg_coef=avg_coef/3
'Do the averaging of the S.E.s (method of the reference paper, but I'm not 100% sure that this is what they propose though??)
matrix avg_se = @emult(estimates_aapl_se,estimates_aapl_se)
for %sym GOOG MFB
avg_se = avg_se + @emult(estimates_{%sym}_se,estimates_{%sym}_se)
next
avg_se=avg_se/9
It would be nice if anyone responded. I put quite some time in clearly formulating the question and I provided a reference, some sample data and a sample code.
