[R] help w/ nonlinear regression

S Ellison S.Ellison at lgc.co.uk
Tue Jun 19 19:19:03 CEST 2007


Your B coefficient differs by a suspicious-looking factor of 2.30... (ln(10). 
Does SPSS log() mean log10 or ln? R log(x) uses ln(x).

S

>>> "Eduardo Esteves" <eesteves at ualg.pt> 19/06/2007 17:19:35 >>>
Dear All,
I'd like to fit a "kind" of logistic model to small data-set using nonlinear least-squares regression. A transcript of R-script are reproduced below. Estimated B and T (the model's coeff, herein B=-8,50 and T=5,46) seem appropriate (at least visually) but are quite diff from those obtained w/ SPSS (Levenberg-Marquardt): B=-19,56 and T=2,37. Am I doing something wrong in R (or at least non-comparable "methodologies")? Please, feel free to comment/suggest.
Regards, Eduardo Esteves

# Dados

CO2<-c(141,172,181,227,309,414,641,936)
Prop<-c(0.25,0.34,0.34,0.68,0.85,0.99,0.98,0.99)

# Diagrama dispersão

plot(Prop~CO2, las=1, xlim=c(0,1000),ylim=c(0,1),pch=16,cex=1.5,
 xlab="CO2 (ppm)", ylab="Proporção de respostas correctas")

# Estimaçao (Método Mínimos Quadrados)

ajuste<-nls(Prop~(1/3+exp(B*(T-log(CO2))))/(1+exp(B*(T-log(CO2)))),
 data=data.frame(CO2=CO2,Prop=Prop),start=list(B=-10,T=5))
summary(ajuste)

# Ilustracao do ajuste

PropEsp<-predict(ajuste,newdata=list(CO2=seq(0,1000,length=100)),se.fit=T)
lines(PropEsp~seq(0,1000,length=100),lwd=2,col=6)

# IC

upIC<-PropEsp+qt(.975,summary(ajuste)$df[2])*summary(ajuste)$sigma
loIC<-PropEsp-qt(.975,summary(ajuste)$df[2])*summary(ajuste)$sigma
lines(upIC~seq(0,1000,length=100),col=4)
lines(loIC~seq(0,1000,length=100),col=4)
	[[alternative HTML version deleted]]


*******************************************************************
This email and any attachments are confidential. Any use, co...{{dropped}}



More information about the R-help mailing list