2

I am trying to do a mixed linear model for a dataset I am helping a colleague analyze, as in an earlier question I had posted, GLMs were unable to handle random effects.

With the appropriate imports and initialization of the data, the block of code that I have so far is:

mlm = sm.MixedLM(endog=data[physiology_cols[0]], \
                 exog=data[fixed_effects], \
                 groups=data[groups],)

mlm.fit()

However, I get back a LinAlgError: Singular matrix.

Please pardon my ignorance (I'm not very well trained in stats) - but what would cause this error? Is it something about the data? Would it be the presence/absence of nans?

ericmjl
  • 185
  • 1
  • 10
  • 2
    A slightly related thread is at http://stats.stackexchange.com/questions/89754. As with that one, your question might require a lot of speculation because you haven't provided much information to go on. It would be *extremely* helpful to find a minimal amount of data and minimal code that you can post to reproduce the error. – whuber Jun 12 '15 at 21:11
  • i do wish i could provide data, but part of the challenge is that this is unpublished data, which I don't have permission from my colleague to release. I've done the thing where I provided dummy data that highlighted certain features of the data (e.g. presence of zeros, np.nans etc.), but those were in the case that I sort of had an idea of what could be the problem. This time round, however, I'm starting from a blank slate - really not sure what's going on. – ericmjl Jun 13 '15 at 03:57
  • that said, thanks for the link, after reading it, I think i have an idea of what might be going on. hmm... – ericmjl Jun 13 '15 at 04:01

0 Answers0