[R] weights in nls
ben@zoo.ufl.edu
ben at zoo.ufl.edu
Tue Sep 26 19:21:15 CEST 2000
Thanks for your help.
Ben Bolker
On 26 Sep 2000, Douglas Bates wrote:
> Douglas Bates <bates at cs.wisc.edu> writes:
>
> > In the meantime, you can use the approach that John Chambers and I
> > describe in chapter 10 of "Statistical Models in S" (a.k.a. the white
> > book) and write the model as a one sided formula giving the weighted
> > residual.
>
> I should have checked before I wrote that. A one-sided formula
> doesn't work. You must use a vector of zeroes of the appropriate
> length on the left hand side.
>
> > library(nls)
> > data(Puromycin)
> > nls(rate ~ Vm * conc/(K + conc), data = Puromycin, weights = 1/conc,
> + subset = state == "treated", start = c(Vm = 200, K = 0.05))
> Nonlinear regression model
> model: rate ~ Vm * conc/(K + conc)
> data: Puromycin
> Vm K
> 212.68357970 0.06412103
> residual sum-of-squares: 1195.449
> > nls(rep(0, length(conc)) ~ (rate - Vm * conc/(K + conc))* sqrt(conc),
> + data = Puromycin, subset = state == "treated", start = c(Vm = 200, K = 0.05))
> Nonlinear regression model
> model: rep(0, length(conc)) ~ (rate - Vm * conc/(K + conc)) * sqrt(conc)
> data: Puromycin
> Vm K
> 218.15162032 0.07471006
> residual sum-of-squares: 137.4447
>
>
--
318 Carr Hall bolker at zoo.ufl.edu
Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker
Box 118525 (ph) 352-392-5697
Gainesville, FL 32611-8525 (fax) 352-392-3704
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list