0

This works fine:

lme(fixed=target~target_projection, random= ~ 1|CLINICIAN_USER_ID, data=study_pop)

But if I try to let the slopes vary:

lme(fixed=target~target_projection, random= ~ target|CLINICIAN_USER_ID, data=study_pop)

I get the following error:

Error during wrapup: the leading minor of order 2 is not positive definite

My data set should be large enough, the second level of the model breaks into 60 groups with 30 data points each, what could be causing this?

Jordan Bentley
  • 282
  • 3
  • 14
  • Searching our site for the key words in the error message, "leading minor," turns up the thread at http://stats.stackexchange.com/questions/55925. The information there might help you identify which additional details of your dataset you should share with us--and perhaps it even answers your question. – whuber Mar 20 '15 at 22:22
  • @whuber I did see that post, but it does not make sense for my issue. My data has no missing data points and there are only parameters, one of which is a factor, so it could not be colinear with the other. – Jordan Bentley Mar 23 '15 at 15:46
  • You seem to be using "data" and "parameters" in an unconventional way. In particular, what exactly do you mean by "only parameters"? Please note, too, that the answer in the linked thread points to other potential causes of this problem, including overfitting, which is a possibility you should consider. – whuber Mar 23 '15 at 15:49
  • Sorry, a symbol got left out, I meant to say there are only 2 parameters. I know from manual plotting of the data that it could not be overfit with what I have provided to lme. – Jordan Bentley Mar 23 '15 at 15:56
  • What package is this from? – shadowtalker Mar 23 '15 at 16:06
  • Shouldn't `random= ~ target|CLINICIAN_USER_ID` be `random= ~ target_projection|CLINICIAN_USER_ID`? I can coax a similar error out of the `Oats` data using `m2 – alexforrence Mar 23 '15 at 16:16
  • You can start to rule out a programming/data issue by running `traceback()` after the error – shadowtalker Mar 23 '15 at 17:51
  • @alexforrence You are correct, I had made a syntax mistake. If you repeat that as an answer I will award you the bounty. – Jordan Bentley Mar 23 '15 at 18:36

1 Answers1

3

It looks like a syntax error; the random effect random= ~ target|CLINICIAN_USER_ID should be specified as random= ~ target_projection|CLINICIAN_USER_ID.

It's possible to (sort of) reproduce this using the Oats dataset:

library(nlme)

m1 <- lme(yield ~ nitro, random ~ 1|Block, data = Oats) #fine

m2 <- lme(yield ~ nitro, random = ~yield|Block, data=Oats)
##Error in chol.default((value + t(value))/2) : 
##the leading minor of order 2 is not positive definite
alexforrence
  • 703
  • 1
  • 9
  • 14