开发者

Using sim() with lmer()

I have run two multilevel logistic regressions using the same predictors, but on two different respon开发者_运维百科ses:

fruitMLM <- lmer(InsuffFruit ~ Income + HDI + Income:HDI + (1 + Income | Country),family=binomial(link="logit"))  
fuelMLM <- lmer(Pollution ~ Income + HDI + Income:HDI + (1 + Income | Country),family=binomial(link="logit"))

Income is discrete with values c(-2,-1,0,1,2), HDI is continuous between 0 and 1, Country is categorical, and the responses are both 1/0.

To plot confidence bands I run a simulation using the sim() function from the arm package:

sim(fruitMLM,100)  
sim(fuelMLM,100)

The first one computes fine. The second one returns the following error:

Error in mvnorm(n.sims, bhat[j,], V.beta) :  
  'Sigma' is not positive definite

I actually am doing this with 8 different responses. Six of them worked fine and two of them returned this error.

Does anyone know how to rectify this?


Can you see if the error message is correct, i.e., check "by hand" whether the covariance matrix from the failing model is actually positive semi-definite? I'm not sure, but I imagine there are some checks you could perform - maybe there's something here: http://en.wikipedia.org/wiki/Positive-definite_matrix

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜