What am I failing to understand here?    

 

The script below works fine if the dataset being used is 

DNase1 <- DNase[ DNase$Run == 1, ]  per the example given in
help(nlrob).  

Obviously, I am trying to understand how to use nls and nlrob to fit
curves to data using R.

 

#package=DAAG

attach(codling)

plot(pobs~dose)

#next command returns 'step factor reduced below min factor error'

m.nls <- nls( pobs ~ a/(1 + exp(( b - log(dose) )/c ) ),

                  data = codling,

                  start = list( a = 3, b = 0, c = 1 ),

                  trace = TRUE )

s<-seq(min(pobs), max(pobs), .01)  

p.nls<-predict(m.nls,list(pobs=s))  

lines(s,p.nls,col='blue')  #generates 'x and y lengths differ' error

 

Gregory A. Graves, Lead Scientist

Everglades REstoration COoordination and VERification (RECOVER) 

Restoration Sciences Department

South Florida Water Management District

Phones:  DESK: 561 / 682 - 2429 

                   CELL:  561 / 719 - 8157

 


	[[alternative HTML version deleted]]

