How to form coefficients covariance matrix object

For questions regarding programming in the EViews programming language.

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

strongbarce
Posts: 5
Joined: Thu Jan 06, 2011 5:51 pm

How to form coefficients covariance matrix object

Postby strongbarce » Sun Jan 09, 2011 8:55 pm

Hi,

I wonder how to form a covariance matrix object for selected coefficients after estimation. For example, I got c(1) to C(10), ten coefficients from an estimation commend, but I only need form a matrix object which is the covariance matrix of C(1), C(5), and c(10). How can I achieve it?


Thanks

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

Re: How to form coefficients covariance matrix object

Postby EViews Gareth » Mon Jan 10, 2011 9:39 am

That's actually quite tricky. You'll have to extract the entire matrix, using the @coefcov data member. Once you have the entire matrix, you'll have to take out the pieces you want into a new matrix using the @subextract command.

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

Re: How to form coefficients covariance matrix object

Postby EViews Glenn » Mon Jan 10, 2011 1:29 pm

You can simplify Gareth's suggestion somewhat by using the method you would use if doing a Wald test by hand.

Suppose that you extract the @coefcov into the matrix COEFCOV. Then to get the 3 x 3 matrix of coefficients for C(1), C(5) and C(10) (assuming that they coefficients are ordered 1-10), you can create the selection matrix

Code: Select all

matrix(3,10) select select = 0 select(1,1) = 1 select(2,5) = 1 select(3,10) = 1
which is the restriction matrix for the corresponding joint Wald test. This matrix has the number of rows equal to the number of subcoefficient elements you have and the number of columns corresponding to the original coefficient matrix, and has 1's in the columns of interest (1, 5, 10). Then form the matrix expression

Code: Select all

sym subcov = select*COEFCOV*@transpose(select)
You should be able to verify that this gives you the desired matrix. Given SELECT and the equation EQ1, you can do this in one line as

Code: Select all

sym subcov = select*EQ1.@coefcov*@transpose(select)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest