# Forum: help

Monitor Forum | Start New ThreadRE: SUR with many equations [ reply ] By: Arne Henningsen on 2017-04-06 14:17 | [forum:45083] |

You are right, nothing regarding serial correlation has happened yet. Anyway, (in some cases) you can use lagged (dependent or explanatory) variables as additional explanatory variables. |

RE: SUR with many equations [ reply ] By: Felix Grey on 2017-03-24 12:54 | [forum:45058] |

Hi Arne, Sorry to bother you with another question. I am wondering if there is any way of dealing with serial correlation when using the systemfit package? Reading through the older posts in this forum I see this was raised in the past and you said it may be a useful addition at some point. I don't suppose this has now happened and is ready to go...? Thanks! Felix |

RE: SUR with many equations [ reply ] By: Felix Grey on 2017-03-21 12:53 | [forum:45034] |

Hi Arne, Thanks once again for your help. Felix |

RE: SUR with many equations [ reply ] By: Arne Henningsen on 2017-03-20 08:45 | [forum:45033] |

The variance-covariance matrix is symmetric. If you have G equations, the residual variance-covariance matrix is of size G x G and has G x ( G + 1 ) / 2 independent elements. |

RE: SUR with many equations [ reply ] By: Felix Grey on 2017-03-17 15:19 | [forum:45032] |

Hi Arne, Thanks again for your help. I now see why you included this comment in your first post! I am still not completely clear on exactly what counts as a parameter in this estimation procedure, and therefore how many 'degrees of freedom' I need. In the variance co-variance matrix (37x37), there are only 703 independent parameters (where does this come from?). I have a T=41 panel, so certainly won't be able to go all the way to 625x625 degrees of freedom. I have tried reading up about this in the systemfit article you linked me to, but can't find it. Do you know of a good reference? Thanks again for your help. Felix |

RE: SUR with many equations [ reply ] By: Arne Henningsen on 2017-03-16 18:21 | [forum:45031] |

The error message is *not* caused by your computer's limited memory but it is most likely a theoretical econometric problem: you try to estimate more parameters than you have observations in your data set! Please note that with 37 individuals, you need to estimate 703 independent parameters of the 37x37 variance covariance matrix of the residuals plus the model parameters in the coefficient vector 'b' and you most like have less observations than independent parameters, right? |

RE: SUR with many equations [ reply ] By: Felix Grey on 2017-03-16 18:08 | [forum:45030] |

P.S. Sorry, reported wrong error message above. (Re-ran the code removing an individual that was causing a problem.) I have the same problem as above, only now I can do 36 individual equations (takes <10s), but when I go to 37 then I get the following error message: Error in .solve.dgC.lu(as(a, "dgCMatrix"), b = b, tol = tol) : LU computationally singular: ratio of extreme entries in |diag(U)| = 5.44e-22 |

RE: SUR with many equations [ reply ] By: Felix Grey on 2017-03-16 17:56 | [forum:45029] |

Hi Arne, Thanks so much for your prompt and helpful reply. Section 4.4 was exactly what I was looking for! Yes, I am aware that that what I am looking to do might be computationally taxing. I was going to just give it a go with larger and larger subsets of individuals in the panel, and see how I got on. So far this is as follows: with 11 covariates, I can estimate 7 equations. If I expand the sample system fit works on to estimate 8 equations, then I get the error message: "Error in LU.dgC(a) : cs_lu(A) failed: near-singular A (or out of memory)" Is there anything I can do about this? My computer runs the 7 equation calculation very quickly (<1 second), so it feels like it could do more if I asked it. [I have 16 GB of RAM (and processor Inter(R) Core i7-4770, at 3.40 GHz).] Thanks very much, again, for your invaluable help. Best regards Felix |

RE: SUR with many equations [ reply ] By: Arne Henningsen on 2017-03-16 14:16 | [forum:45028] |

Hi Felix You do not need to write out the many equations manually but you can specify the model equation only once as done, e.g., in section 4.4 of [1]. [1] http://dx.doi.org/10.18637/jss.v023.i04 However, please note that you need a huge number of observations (and a computer with a lot of memory) to estimate this model, because estimating this models requires the estimation of variance-covariance matrix with dimension 625x625 and, thus, 195,625 independent parameters (plus the model parameters in the coefficient vector 'b'). Do you have enough observations for estimating so many parameters? Best regards, Arne |

SUR with many equations [ reply ] By: Felix Grey on 2017-03-16 12:56 | [forum:45027] |

Hi All, I am wondering if anyone can help me with the following estimation. I have an N=625 panel, and wish to estimate a the same simple linear regression equation (y = X'B + e) for each of the 625 members of the panel. The errors are likely to be correlated, hence I am looking to estimate a 625 equation system (where each equation is the same, but for a different individual) by SUR. I have successfully used systemfit to do this for a few equations in my system, but am wondering if I can avoid manually writing out 625 equations somehow. I am quite new to R (though reasonably capable with Stata). If anyone can give me any help I would be very grateful indeed. Thanks, Felix Grey |