Hi,
i want to know, how to do estimate the matrix of autocovariance 0 and 1 of a var.
I think, a loop could help me, but i don´t know how to use it.
this is my var
wfcreate u 1 600
smpl @first @first+1
series w= nrnd*@mean(9)*@sqrt(15)
series y= nrnd*@mean(12)*@sqrt(8)
smpl @first+2 @last
series u= nrnd*@sqrt(2)
series e= nrnd*@sqrt(6)
smpl @first+2 @last
series w= 0.2*w(-1) + 0.3*w(-2)+ u
series y= 0.4*y(-1) + 0.1*y(-2)+ e
var var2.ls(noconst) 1 2 w y
var2.results
var2.ls(noconst) 1 1 w y
Anyone knows how to do it??
thank u very much.
Matrix of autocovariance of a var
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- EViews Developer
- Posts: 562
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Matrix of autocovariance of a var
Hello,
EViews is more than capable of calculating the autocovariances and crosscovariances for you, so there's no need to loop through the data yourself. Here's a quick way to calculate what you want,
The above code groups all the relevant data together and then calculates all the pairwise covariances. However, the information you asked for is just a subset of those results. The two @subextract calls copy just the lag 0 and lag 1 autocovariance information to two separate matrices.
EViews is more than capable of calculating the autocovariances and crosscovariances for you, so there's no need to loop through the data yourself. Here's a quick way to calculate what you want,
Code: Select all
group g w y w(-1) y(-1)
g.cov(out=tmp)
matrix ac0 = @subextract(tmpcov, 1, 1, 2, 2)
matrix ac1 = @subextract(tmpcov, 1, 3, 2, 4)
delete g tmpcov
The above code groups all the relevant data together and then calculates all the pairwise covariances. However, the information you asked for is just a subset of those results. The two @subextract calls copy just the lag 0 and lag 1 autocovariance information to two separate matrices.
Who is online
Users browsing this forum: No registered users and 18 guests