Hi R-experts,

I have a problem using nlme. I use the following code to group my data:

Parameterg <- groupedData( result ~ time | Batch,
                data = Batchdata,
                labels = list( x = "Time", y = "analysis")
    )

and then uses the nlme function to fit a nonlinear mixed model that includes
Process as a fixed covariate:
nlme.model001epr <- nlme(result ~ A0 * exp(- (   exp(A1) * exp(-Ea /
(0.0083144*TEMP.K))   *  exp(eps)) * time),
                data = Parameterg,
                fixed=list(A0+Ea~1,A1~Process),
                random=eps~1,
                start=c(93, 92, 34.5,37),
                control=list(msVerbose=TRUE, maxIter = 200),
                verbose=TRUE, method="REML",
                na.action=na.pass)
this fit give the following error:
Error in MEEM(object, conLin, control$niterEM) : 
  Singularity in backsolve at level 0, block 1

HOWEVER, in SAS the same model with covariate is WORKING!

When I'm changing the fixed part in nmle as follows
fixed=list(A0+Ea~1,A1~1|Process),

then the following error is popping up:

Error in contr.treatment(n = 0L) : 
  not enough degrees of freedom to define contrasts
In addition: Warning messages:
1: In Ops.factor(1, Process) : | not meaningful for factors
2: In Ops.factor(1, Process) : | not meaningful for factors

However, when adding the process as a random effect it works:
nlme.model001epr <- nlme(result ~ A0 * exp(- (   exp(A1) * exp(-Ea /
(0.0083144*TEMP.K))  *  exp(eps) ) * time),
                data = Parameterg,
                fixed=list(A0+Ea+A1~1),
                random=eps~1|Process/Batch,
                start=c(93, 92, 34.5),
                control=list(msVerbose=TRUE, maxIter = 200),
                verbose=TRUE, method="REML",
                na.action=na.pass)
Does anybody knows what the correct implementation is for adding a covariate
in a nlme and what might be my problem here?

Looking forward to your replies,
Heidi


--
View this message in context: 
http://r.789695.n4.nabble.com/Add-covariate-in-nlme-tp4567189p4567189.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to