问题
Thanks in advance for anyone who gives this a look over. I've seen this problem once on the archives but I'm a bit new to R and had a lot of trouble understanding both the problem and the solution...
I'm trying to use the lmer function to create a minimum adequate model. My model is Mated ~ Size * Attempts * Status + (random factor).
as.logical(Mated)
as.numeric(Size)
as.factor(Attempts)
as.factor(Status)
(These have all worked on previous models)
So after all that I try running my model:
Model1<-lmer(Mated ~ Size*Status*Attempts + (1|FemaleID),data=mydata)
And it can be submitted without fault.It's only when I try to apply this update that it goes wrong:
Model2<-update(Model1, REML=FALSE)
Here is the error message supplied: Error in fn(x, ...) : Downdated VtV is not positive definite
If I make a third model without the interaction and do an ANOVA between that and model one, then it says the two are significantly different.
Model3<-update(Model1,~.-Size:Status:Attempts
anova(Model1,Model3)
What am I doing wrong? Is the three way interaction really significant or have I made some mistake?
Thank you
回答1:
If Mated
is binary, then you should probably be using glmer
with a logit or probit link function instead, something like:
model <- glmer(Mated ~ Size * Status * Attempts + (1|FemaleID),
data = mydata, family = binomial)
It would help if you could let us know what your data looks like (head(mydata)
might be fine, or see here for how to make a reproducible example).
Also, I would avoid making Mated
logical (see this question and answer for how it can make your life more difficult). Instead, as.factor(Mated)
will explicitly make your response variable discrete.
After that, you can compare your full and reduced models with anova()
.
来源:https://stackoverflow.com/questions/27990948/error-message-error-in-fnx-downdated-vtv-is-not-positive-definite