[R] nls and factor
Manuel Gutierrez
manuel_gutierrez_lopez at yahoo.es
Thu Apr 20 11:18:02 CEST 2006
Is it possible to include a factor in an nls formula?
I've searched the help pages without any luck so I
guess it is not feasible.
I've given it a few attempts without luck getting the
message:
+ not meaningful for factors in:
Ops.factor(independ^EE, a)
This is a toy example, my realworld case is much more
complicated (and can not be solved linearizing an
using lm)
a<-as.factor(c(rep(1,50),rep(0,50)))
independ<-rnorm(100)
respo<-rep(NA,100)
respo[a==1]<-(independ[a==1]^2.3)+2
respo[a==0]<-(independ[a==0]^2.1)+3
nls(respo~independ^EE+a,start=list(EE=1.8),trace=TRUE)
Any pointers welcomed
Many Thanks,
Manu
More information about the R-help
mailing list