# Forum: help

Monitor Forum | Start New ThreadRE: SUR: Var-Cov matrix becomes singular if maxiter>1 [ reply ] By: Arne Henningsen on 2017-07-06 18:16 | [forum:45229] |

“predicted budget shares of SUR estimation sum up to zero:” I meant that if you impose adding-up (which you need to do in order to comply with microeconomic theory), the predicted budget shares that you calculate based on your estimated (SUR) coefficients sum up to one. |

RE: SUR: Var-Cov matrix becomes singular if maxiter>1 [ reply ] By: Johannes P on 2017-06-30 06:27 | [forum:45211] |

Hi Arne and thanks for useful advices! It seems that singularity occurred as I had defined the equations poorly. According to Shonkwiler and Yen the constant term should be inside the bracket: w1 ~ 0 + cdf1:(constant+lp1+lp2+lp3+lp4+lp5 + BetaTerm1 + se1+….+se11) +df1 After this correction also ISUR works. Predicted budget sum up to (approximately) one and I am able to impose almost all restrictions (except adding-up for some parameters) to the system. I should have enough observations for my explanatory variables but I will check whether coefficients change if I omit something. Sorry, but I don’t think I am following what you meant with “predicted budget shares of SUR estimation sum up to zero”. If you meant beta coeffs, they sum up to (nearly) zero. However, now I get reasonable results even though the coefficients are still rather small and therefore elasticities are close to (+/-) unity. Best Regards Johannes |

RE: SUR: Var-Cov matrix becomes singular if maxiter>1 [ reply ] By: Arne Henningsen on 2017-06-29 08:20 | [forum:45207] |

Unfortunately, I don't know the reason. Do I correctly understand that SUR works but iterated SUR (ISUR) does not work? IIRC, iterated SUR converges to ML estimates and the log-likelihood value increases with decreasing values of the determinant of the residual covariance matrix. Hence, a singular residual covariance matrix results in an infinitely large (positive) log-likelihood value so that coefficients that result in a singular residual covariance matrix maximise the (log-)likelihood value. Do certain combinations of values of the coefficients of the censored LA-AIDS make the predicted budget sum up to one? Do the predicted budget shares of the SUR estimation(s) sum up to (approximately) zero? Given the many explanatory variables in each equation, could it be that you have too few degrees of freedom? |

RE: SUR: Var-Cov matrix becomes singular if maxiter>1 [ reply ] By: Johannes P on 2017-06-27 15:08 | [forum:45206] |

Hi Arne and thanks for quick answer! With censored LA-AIDS system (zeros taken into account by procedure of Shonkwiler and Yen 1999) the observed budget shares should not sum up to one anymore. At least Yen et al (Applied Economics 01 September 2002, Vol.34(14), p.1799-1806) claim that in censored system “the right-hand side of the system do not add up to unity in general and consequently the error terms do not add up to zero across equations” and “Therefore, second-step estimation of the system should be based on the full n-vector, that is, based on the entire set of n equations, not n - 1 equations as in singular demand systems.” Link: http://www.tandfonline.com/doi/abs/10.1080/00036840210125008 Unfortunately, this does not seem to work for me yet – not even without homogeneity and symmetry restrictions. I attach my first equation here if it helps: w1 ~ cdf1:(lp1 + lp2 + lp3 + lp4 + lp5 + BetaTerm1 + se1+se2+se3+se4+se5+se6+se7+se8+se9+se10+se11) + df1 , where cdf is value of Cumulative Density Function from first step, lpi is log of prices, BetaTerm is value which connect to beta, se:s are socio-demographic variables and df is Probability Density Function. Do you have any other ideas why ISUR doesn`t work? I would be very grateful for any help or hint! Best Regards Johannes |

RE: SUR: Var-Cov matrix becomes singular if maxiter>1 [ reply ] By: Arne Henningsen on 2017-06-27 13:13 | [forum:45205] |

Hey Johannes As the *observed* budget shares sum up to one and the *predicted* budget shares (should) also sum up to one, the residual covariance matrix is expected to be singular so that (at least iterated) SUR cannot estimate the values of the residual covariance matrix. In contrast, OLS and WLS return estimates, because they do not estimate the off-diagonal elements of the residual covariance matrix (but assume that they are zero). You have to omit one equation in order to estimate your model. If you have correctly specified your model, the estimation results should not depend on the choice of the equation that is omitted. Please note that OLS and WLS likely give you consistent (although inefficient) estimates. /Arne |

SUR: Var-Cov matrix becomes singular if maxiter>1 [ reply ] By: Johannes P on 2017-06-27 06:56 | [forum:45204] |

Hey! Could you help me with following: I try to run 5eq simultaneously in systemfit but I have problems with singularity. My coefficients become very small if maxiter>1. If maxiter>4, R returns the error code “Error in .solve.dgC.lu(as(a, "dgCMatrix"), b = b, tol = tol) : LU computationally singular: ratio of extreme entries in |diag(U)| = 3.696e-17” I am estimating censored LA-AIDS model and the estimation should be possible without dropping any equations. With OLS and WLS everything works fine but the results are biased according to theory.. With SUR convergence is not achieved before the run crashes. A couple of tables from summary output: systemfit results when maxiter=1 method: SUR N DF SSR detRCov OLS-R2 McElroy-R2 system 16885 16805 595 0 0.042 -0.201 N DF SSR MSE RMSE R2 Adj R2 eq1 3377 3358 55.4 0.016 0.128 0.034 0.029 eq2 3377 3358 87.5 0.026 0.161 0.025 0.020 eq3 3377 3358 87.2 0.026 0.161 0.053 0.048 eq4 3377 3358 197.8 0.059 0.243 0.053 0.049 eq5 3377 3358 166.8 0.050 0.223 0.035 0.031 The covariance matrix of the residuals used for estimation eq1 eq2 eq3 eq4 eq5 eq1 0.01594 -0.00227 -0.00165 -0.00662 -0.00516 eq2 -0.00227 0.02558 -0.00333 -0.01114 -0.00848 eq3 -0.00165 -0.00333 0.02579 -0.01248 -0.00796 eq4 -0.00662 -0.01114 -0.01248 0.05758 -0.02703 eq5 -0.00516 -0.00848 -0.00796 -0.02703 0.04922 The covariance matrix of the residuals eq1 eq2 eq3 eq4 eq5 eq1 0.01648 -0.00193 -0.00169 -0.00729 -0.00561 eq2 -0.00193 0.02605 -0.00347 -0.01170 -0.00895 eq3 -0.00169 -0.00347 0.02597 -0.01284 -0.00796 eq4 -0.00729 -0.01170 -0.01284 0.05889 -0.02707 eq5 -0.00561 -0.00895 -0.00796 -0.02707 0.04966 The correlations of the residuals eq1 eq2 eq3 eq4 eq5 eq1 1.0000 -0.0931 -0.0816 -0.234 -0.196 eq2 -0.0931 1.0000 -0.1333 -0.299 -0.249 eq3 -0.0816 -0.1333 1.0000 -0.328 -0.222 eq4 -0.2339 -0.2988 -0.3282 1.000 -0.501 eq5 -0.1962 -0.2488 -0.2217 -0.501 1.000 Do you have any idea what could be wrong? Thanks in advance! Best Regards Johannes |