systemfit - SUR
On Tuesday 30 November 2004 09:34, contact at thomasalmer.com wrote:
Arne Henningsen <ahenningsen at email.uni-kiel.de> schrieb am 29.11.2004, 17:02:12:
On Monday 29 November 2004 16:42, contact at thomasalmer.com wrote:
Hello to everyone,
I have 2 problems and would be very pleased if anyone can help me:
1) When I use the package "systemfit" for SUR regressions, I get two
different variance-covariance matrices when I firstly do the SUR
regression ("The covariance matrix of the residuals used for
estimation") and secondly do the OLS regressions. In the manual for
"systemfit" on page 14 I see however, that the variance-covariance
matrix for SUR is obtained from OLS. How can this be explained?
Hi Thomas,
I get identical residual covariance matrices:
R> library(systemfit)
R> data( kmenta )
R> demand supply labels system fitols fitols$rcov
[,1] [,2]
[1,] 3.725391 4.136963
[2,] 4.136963 5.784441
R> fitsur fitsur$rcovest
[,1] [,2]
[1,] 3.725391 4.136963
[2,] 4.136963 5.784441
It is a pity, but my matrices are not as nice :-(
Please show how you obtained these results.
This is what I did:
R> data( kmenta )
R> demand <- q ~ p + d
R> supply <- q ~ p + f + a
R> labels <- list( "demand", "supply" )
R> system <- list( demand, supply )
R>
R> # OLS estimation:
R> fitols <- systemfit("OLS", system, labels, data=kmenta )
R> # (non-iterated) SUR estimation
R> fitsur <- systemfit("SUR", system, labels, data=kmenta )
R> iterated SUR estimation
R> fitsurit <- systemfit("SUR", system, labels, data=kmenta, maxit=100 )
R>
R> fitols$rcov
[,1] [,2]
[1,] 3.725391 4.136963
[2,] 4.136963 5.784441
R> fitsur$rcovest
[,1] [,2]
[1,] 3.725391 4.136963
[2,] 4.136963 5.784441
R> fitsurit$rcovest
[,1] [,2]
[1,] 6.199071 7.493383
[2,] 7.493383 9.128547
An excerpt:
fitsur$rcovest
[,1] [,2] [,3] ...
[1,] 0.015097517 0.018005050
[2,] 0.018005050 0.276259834
...
fitols$rcov
[,1] [,2] [,3] ...
[1,] 1.010326e-02 0.0096103837
[2,] 9.610384e-03 0.2329884378
...
fitsur "The covariance matrix of the residuals used for estimation":
eq1 eq2 eq3 ...
eq1 0.01317429 0.01504719 0.007981307
eq2 0.01504719 0.25233860
...
fitols "The covariance matrix of the residuals":
eq1 eq2 eq3 ...
eq1 9.51154e-03 0.009137884 0.002648577
eq2 9.13788e-03 0.220435063
...
By the way: Why are the figures larger for SUR?
OLS minimizes the residuals and, thus, also the variance of the residuals (=diagonal of the residual covariance matrix). Iterated SUR is equivalent to a maximum likelihood estimation. Maximizing the likelihood value is equivalent to minimizing the determinant of the residual covariance matrix. Thus, the determinant of the residual covariance matrix and not the residuals itself are minimized: R> det(fitols$rcov) [1] 4.434845 R> det(fitsurit$rcov) [1] 0.4376941 R> det(fitsurit$rcovest) [1] 0.4377184
Did you do _iterated_ SUR?
Yes: "systemfit results method: iterated SUR convergence achieved after 30 iterations"
If you use iterated SUR, the SUR estimations are iterated. In the first SUR estimation the residual covariance matrix of the OLS estimation is used. In all following iterations the residual covariance matrix of the previous step SUR estimation is used.
I do not know how to change that.
Please read the documentation. It says to set argument "maxit" to 1 - or do not provide this argument, since 1 is the default.
Best wishes, Arne
THANKS A LOT FOR YOUR IMMEDIATE HELP!!!
2) Is there an easy possibility to test a) the OLS equations, and b) the SUR system for SUR structures? In other words: Is the LM-Test from Breusch and Pagan available in R?
I don't understand what you want to test. Does the hausman test what you are looking for (see ?hausman.systemfit). If you have questions regarding this test, you might ask my co-author of systemfit, Jeff Hamann. Best wishes, Arne
Thanks for the attention! Best Regards, Thomas Almer
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 ahenningsen at agric-econ.uni-kiel.de http://www.uni-kiel.de/agrarpol/ahenningsen/
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 ahenningsen at agric-econ.uni-kiel.de http://www.uni-kiel.de/agrarpol/ahenningsen/