[R] passing local parameters to nls?

From: ivo welch <ivowel_at_gmail.com>
Date: Wed, 09 Jun 2010 09:39:18 -0400


dear R wizards: environment-related programming question:

myformula = y ~ a*x^2+b*x+c
d= data.frame( x=rnorm(20), y=rnorm(20) )

cat("\nunconstrained works: \n");
nls( myformula, data=d, start=list(a=1, b=1, c=1), trace= TRUE)

cat("\nconstrained works: \n");
b=1; nls( myformula, data=d, start=list(a=1, c=1), trace= TRUE); rm(b)

cat("\nbut how do I pass a local parameter into my formula? \n"); f = function(c) nls( myformula, data=d, start=list(a=1, b=1), trace= TRUE)

f(c=1);

advice, as always, appreciated. /iaw



Ivo Welch (ivo.welch_at_brown.edu, ivo.welch_at_gmail.com)

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 Wed 09 Jun 2010 - 16:40:16 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 Wed 09 Jun 2010 - 17: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