Hi there, I have been trying to fit an NLME to my data. My dataset has two category levels - one is a fixed effect (level1) and one is a random effect (level2), though so far I have only experimented with the highest level grouping (fixed, level1), with the following code: mod1 <- nlme(H ~ a*(1-exp(-b*D^c)), data=sizes, fixed=a+b+c~factor(Loc), start=c(a=75,b=0.05,c=0.7)) This returns the error: Error in getGroups.data.frame(dataMix, eval(parse(text = paste("~1", deparse(groups[[2]]), : Invalid formula for groups Other points that it may be useful to note in diagnosing the problem are that: 1) I have tried both specifying Loc=as.factor and not specifying this. 2) I have tried other configurations of writing fixed=list(...) or fixed=c(...) and that always generates an error 3) I have not specified groupedData 4) My groups do not have equal sample sizes (unbalanced?) Look forward to hearing back! Thanks in advance, Lindsay
Lindsay Banin wrote:> > Hi there, > > I have been trying to fit an NLME to my data. My dataset has two category > levels - one is a fixed effect (level1) and one is a random effect > (level2), though so far I have only experimented with the highest level > grouping (fixed, level1), with the following code: > > mod1 <- nlme(H ~ a*(1-exp(-b*D^c)), > data=sizes, > fixed=a+b+c~factor(Loc), > start=c(a=75,b=0.05,c=0.7)) > > This returns the error: > Error in getGroups.data.frame(dataMix, eval(parse(text = paste("~1", > deparse(groups[[2]]), : > Invalid formula for groups > > Other points that it may be useful to note in diagnosing the problem are > that: > 1) I have tried both specifying Loc=as.factor and not specifying this. > 2) I have tried other configurations of writing fixed=list(...) or > fixed=c(...) and that always generates an error > 3) I have not specified groupedData > 4) My groups do not have equal sample sizes (unbalanced?) > >(1) You haven't given us a reproducible example ... (2) You might try asking this on the r-sig-mixed-models list instead (3) I suspect your problem might be that nlme can't fit models with no random effect. Have you tried the analogous model in gnls ? good luck Ben Bolker -- View this message in context: http://www.nabble.com/Error-in-NLME-%28nonlinear-mixed-effects-model%29-tp23488199p23489069.html Sent from the R help mailing list archive at Nabble.com.