[R] Nonlinear weighted least squares estimation
Liaw, Andy
andy_liaw at merck.com
Mon Nov 8 16:58:39 CET 2004
This question has been asked before on the list, but I'm not sure if the
answer were posted. Basically, the trick is to write the formula a bit
differently in nls() so that it does weighted least squares. nls() tries to
minimize the sum of squared differences between the two sides of ~. If you
write the formula as
~ sqrt(w) * (y - modelfun)
where modelfun is the nonlinear function being fitted, you get the weighted
nonlinear least squares solution. (Cf. page 241 of MASS4 and Section 10.3.3
of the White Book.) However, you need to watch out for predict(), etc., as
their output corresponds to what you specify in the formula.
HTH,
Andy
> From: Robert Brown FM CEFAS
>
> Hi there,
>
> I'm trying to fit a growth curve to some data and need to use
> a weighted least squares estimator to account for
> heteroscedasticity in the data. A weights argument is
> available in nls that would appear to be appropriate for this
> purpose, but it is listed as 'not yet implemented'. Is there
> another package which could implement this procedure?
>
> Regards,
>
> Robert Brown
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list