Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • matrix not positive definite error with aweight

    hello, im not sure if my question is related to theory or to programming but i figure people here might be helpful either way. i'm trying to fit a two fixed effects model that has clustered errors and that weights the regressors by the value of the same cross section in 1999. my equation is:

    xi: regress mco2 ETS_effect i.cXy i.cXi i.iXy [aweight = co2 ] , cluster(country_indus) robust

    where co2 is the co2 level in 1999. and cXy represents the two-way fixed effect for country year, cXi for country industry, iXy for industry year

    upon running this i get the error that the matrix is not positive definite and im not quite sure why this is happening since for example when the mco2 is replaced by gross value added, the regression runs fine. any help is very much appreicated!

  • #2
    Well, the first thing that jumps out at me is that,if I understand your cXy, cXi and Xy variables you are modeling interactions without the corresponding main effects. There are only a few situations where that makes sense, and I would be quite surprised if this is one of them.

    Next, you should abandon the obsolete -xi- in favor of factor variables. And, relying on factor variables, you should also not "roll your own" interaction terms. I think your model would be better specified as:

    Code:
    regress mco2 ETS-effect i.country##i.year i.country##i.industry i.industry##i.year, vce(cluster country_indus)
    If you truly want to not represent the main effects of country, industry, and year, then change all the ##s to #.

    It may be that with clustering on country_indus (which I take to be a pairing of country and industry) it is appropriate to omit country and industry main effects. But I can see no reason to omit the year effect.

    As for why you get a non-positive definite problem, I cannot say. But the fact that a change of the dependent variable makes it go away is not necessarily surprising. If different observations have missing values on those two dependent variables, then each estimation is carried out on a different sample, so what is non-positive-definite in one might not be in the other. To get a better since of why you are encountering this problem, though, it would probably be helpful to see, in addition to the command you gave, the actual full regression output and error messages, pasted from the Results window into a code block. (See FAQ if you aren't sure how to create a code block.)

    A few more comments about the overall model. CO2 concentration is an odd variable to use as an aweight. In -regress-, aweights are usually used to deal with heteroscedasticity resulting from different observations having their outcomes measured with different amounts of measurement error. The classic example is when each observation is actually the mean of grouped observations and the groups underlying the observations differ in size, so that the measures in the larger groups have smaller variance. There one specifies the group size as an aweight. I don't know enough about your situation to say for sure, but it really doesn't sound like this kind of reasoning applies to your model. Perhaps iweights would be better?

    I also wonder if your model might not be more sensible if you were to treat country and industry as crossed random effects and use -mixed- instead of regress. But now I'm really venturing into speculation.

    Hope at least some of this is helpful.

    Comment


    • #3
      thanks very much for your input! you've definitely given me a lot to think about!

      Comment

      Working...
      X