# Forum: help

Monitor Forum | Start New ThreadRE: Singularity and panel data issues [ reply ] By: Arne Henningsen on 2016-08-24 09:08 | [forum:43466] |

Dear Thomas Regarding issue 1: If you need to estimate different equations for the different firms (e.g. because some explanatory variables should only be used for some firms but not for all firms, because there is no variation in these variables for some firms), you need to specify a separate formula for each firm. Regarding issues 2+3: Please post the exact econometric structure of the model that you want to estimate, e.g. including the correlation structure of the error terms. Best, Arne |

Singularity and panel data issues [ reply ] By: Thomas Greene on 2016-08-08 13:48 | [forum:43411] |

I have been browsing the web extensively, as well as this forum. Although some issues have been adressed, I have not found a solution for my problem(s), which makes me wonder whether I can still use systemfit for my model or if there are work arounds or other alternatives or software available: I have a panel dataset (cross-section=firms), on which I would like to estimate a 3SLS regression. In doing so, I face the following 3 problems: 1) Singularity My problem is that for some firms, there is not always variation for every variable. More specifically: one of the variables is a dummy variable for advertising, but not every firm uses advertising in my data (and thus has zero values throughout all its observations). This gives the error: "Error in LU.dgC(a) : cs_lu(A) failed: near-singular A (or out of memory)" 2) Panel data & instrumental regressions For the intrument equation, it does not seem to recognize my data as panel data, as I get the following error: "the instrumental variables of each equation must have the same number of observations as the corresponding regressors (including observations with NAs)" [ similar to described in this topic: https://r-forge.r-project.org/forum/forum.php?thread_id=28895&forum_id=788&group_id=242 ] 3) I have 2 endogenous variables, system fit seems to allow for only 1? A reproducible example for issue 1 and 2: require(systemfit) require(plm) require(car) data("GrunfeldGreene") #Line below simulates the singularity issue GrunfeldGreene$capital <- ifelse(GrunfeldGreene$firm=='General Motors', 0, GrunfeldGreene$capital) GGPanel <- plm.data( GrunfeldGreene, c( "firm", "year" ) ) formulaGrunfeld <- invest ~ value + capital # SUR (Issue 1) greeneSur <- systemfit(formulaGrunfeld, "SUR", data = GGPanel) # 3SLS (Issue 2) inst=~GGPanel$capital+GGPanel$year greeneSur <- systemfit(formulaGrunfeld, "3SLS", inst=inst, data = GGPanel) I would be incredibly grateful for any advice or tips on how to estimate this. |