[R] nls model fitting errors

From: Graves, Gregory <ggraves_at_sfwmd.gov>
Date: Thu, 10 Jun 2010 10:27:59 -0400


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]]

______________________________________________
R-help_at_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. Received on Thu 10 Jun 2010 - 14:32:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 Jun 2010 - 18:50:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive