Dear R-experts,
I have a problem to formulate non linear mixed effects when more than one
explanatory variable is present. I'm using R 1.1.1 under Linux. The
version number of the nlme library is 3.1-7.
"help(nlme)" says that among several possibilities it is possible to
code
fixed effects according to
fixed = a1 + a2 + ... + an ~ X1 + X2 + ... + Xm
where the left hand side contains the coefficients of the non linear model
and the right hand side contains the factors or explanatory variables.
Generally it is said that the right hand side has to follow the
conventions for linear models, thus interaction effects might be present
as well (I guess its not all word by word. Our machine R usually runs on
is down at the moment, so this is what I remember. Please don't be angry
...).
The authors of nlme give an example [1] on page 28:
CO2.fit2 <- update(CO2.fit1,fixed=list(A + C ~ Treatment * Type, lB ~ 1),
start=c(32.55,0, 0, 0, 41.56, 0, 0, 0, -4.6))
(The code that has been run before is given below)
When running the example as well as own code (biexponential model
depending on two crossed factors) I receive the following error
message:
Error: comparison (2) only possible for vector types
No output is produced. I tried to convert the relevant factors into
numeric vectors without succes. The error likewise occurs in additive and
interactive models. I also tried different contrast codings (Helmert,
sum).
When only one factor is given, everything works fine: It is possible to
code any model as long as the coefficients depend only on one factor.
Any suggestions? Admittedly nlme originally has been designed for S/Splus.
Is this a specific problem of R or any fault of mine (installation,
version, severe misunderstanding) or something else?
Many thank in advance ...
####################
Code:
library(nlme)
data(CO2)
CO2.func <- deriv(~A*(1-exp(-exp(lB)*(conc-C))),
c("A","lB","C"),
function(conc,A,lB,C))
CO2.fit1 <- nlme(model=uptake ~ CO2.func(conc,A,lB,C),
fixed = A + lB + C ~ 1, data=CO2,
start=c(30,log(0,01),50)
)
References:
[1] Pinheiro, Jose and Douglas M. Bates: lme and nlme, Mixed-Effects
Methods and Classes for S and Splus, Version 3.0, October 1998,
Bell Labs, Lucent Technologies and University of
Wisconsin-Madison. Available from http://nlme.stat.wisc.edu/
Uli Flenker
Institute of Biochemistry
German Sports University Cologne
Carl-Diem-Weg 6
50933 Cologne / Germany
Phone 0049/0221/4982-493
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._