[R] nls object -- how to edit?

Carl Witthoft carl at witthoft.com
Wed Mar 24 23:07:58 CET 2010


Hi,
I recently used columns of a matrix as inputs to nls(), which works just 
fine, but then I get, for example,
(assuming >nls(stuff)->nl30 was the original command)

 >nl30$call
nls(dr[,2]~apowr^(dr[,1])/(b*sqrt(dr[,1])))

Now, I can build a new matrix with same dimensions as dr  and use that 
to run predict, as in

 >predict(nl30,list(dr=newdr))  ,
but I was wondering if there's a way to edit the contents of nl30 itself?

I changed the contents of nl30$call just fine (using expression() on an 
edited version of the formula itself), but that does not change whatever 
items in nl30 are used by predict().
Again, I recognize that I'm much better off running nls() with more 
sensible independent and dependent variables to begin with.  I just 
would like some help to learn how to read the "guts" of the  class 
variable that nls() produces.  (yes, I know how to do "nl30$m" and so 
on; those lists don't show me any of the variables or formulas I can get 
using formula(nl30) and other commands with methods for this type of 
class variable).

Thanks
Carl



More information about the R-help mailing list