Skip to content
Prev 13940 / 20628 Next

multiple random effects and correlation structure in nlme

Thierry,
Thanks for your reply. 

I hadn?t used ?cost? as a fixed effect because I thought it had to be considered random. I have 10 simulated landscapes composed a combination of costs 1 and 4 in random fractal patterns. My ?cost? column refers to the cost at regular points across the landscapes. Because they were randomly generated, I thought that meant that they should be random effects. But if that?s not the case, that could simplify things.

If I run it this way,
    lme(fixed = He ~ barr + mort + cost, random = ~ N | lr, data = ibr4, 
             correlation = corExp(form = ~ x + y | lr), method = ?ML?,
             control=lmeControl(opt = "nlminb"))

It gives this error:
Error in lme.formula(fixed = He ~ barr + mort + cost, random = ~N | lr,  : 
  nlminb problem, convergence error code = 1
  message = iteration limit reached without convergence (10)

And if I change the optimizer to ?optim? it gives me this error:
Error in logLik.reStruct(object, conLin) : 
  NA/NaN/Inf in foreign function call (arg 3)

However, it works for me to run it this way, with barr and mort merged into one grouping factor ?road?, nested in ?land":
    lme(fixed = He ~ barr + mort + cost, random = ~ N | land, data = ibr4, 
             correlation = corExp(form = ~ x + y | land/road), method = ?ML?,
             control=lmeControl(opt = "nlminb"))

    lme(fixed = He ~ barr + mort + cost, random = ~ N | land/road, data = ibr4, 
             correlation = corExp(form = ~ x + y | land/road), method = ?ML?,
             control=lmeControl(opt = "nlminb?))

I know that ?land" has a much greater influence on ?N" than either ?barr? or ?mort? does, but I know that all 3 (land, barr, and mort) affect N. But AIC tells me that ?land? works better as a grouping factor than land/road. So maybe I shouldn?t worry about nesting in that case and can ignore the issues with trying to cross the factors. Does that make sense, or do you have other ideas about getting it to work? 
Karl