Saving results of an equation in a matrix

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

IgnacioG
Posts: 2
Joined: Sat Apr 04, 2009 2:25 pm

Saving results of an equation in a matrix

Postby IgnacioG » Sat Apr 04, 2009 2:50 pm

Hello:
I'd like to ask a question about saving results of a calculation into a matrix so I could copy it and saving it into an Excel spreadsheet.
I am actually calculating variance ratios for 9 series with the formula VR(q)= [Var (rt(q))] / [q* Var(rt)]
I have to calculate these ratios for q= 2 to 60 for these 9 series.

What I already did was to calculate them with the next program:

for !i=1 to 9
for !j=1 to 60
genr VR!jgrupo!i=@var((grupo!i(+!j)-grupo!i))/(!j*@var(diferenciados!i))
next
next

in which (grupo!i) is the name of my series.
Eviews creates these new series but I would like to perform a matrix with the values. I was thinking to do:

Matrix(60,9) VR
for !i=1 to 9
for !j=1 to 60
VR(!j,!i)=@var((grupo!i(+!j)-grupo!i))/(!j*@var(diferenciados!i))
next
next

But It doesn't work. How could I solve this problem?
Thank you very much

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Saving results of an equation in a matrix

Postby EViews Gareth » Sat Apr 04, 2009 4:20 pm

Not quite sure I follow exactly what you're asking, since I don't see an equation object in your current code.

But assuming you are able to achieve the result you want as a series (which seems to be the case), and you'd rather it was in a matrix, then you could simply use the stom command to convert your series into a matrix.
Follow us on Twitter @IHSEViews

IgnacioG
Posts: 2
Joined: Sat Apr 04, 2009 2:25 pm

Re: Saving results of an equation in a matrix

Postby IgnacioG » Thu Apr 30, 2009 6:42 am

Ok, thank you very much!

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: Saving results of an equation in a matrix

Postby EViews Glenn » Thu Apr 30, 2009 11:23 am

It appears to be an attempt to construct Lo-MacKinlay variance ratio tests on a group of series.

There are a couple of issues with the way the original poster is trying to do the test. Most importantly, the way the computations are being done, the mean is computed differently for each lag difference, as are the denominators in the variance estimates. This isn't per se wrong, but doesn't match the descriptions in Lo-MacKinlay and others.

I've taken the liberty of cobbling together a subroutine that computes the simplest form of the test statistic which matches the published formulae. It should do what the original poster wanted, plus a bit more in the way of SEs and p-vals. Note however, that these p-vals assume homoskedasticity. Additional comments are in the subroutine itself.

It may be worth a quick look at the code to see how I handled the evaluations that were given the original poster difficulty.

[url]
viewtopic.php?f=15&t=777
[/url]


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 42 guests