Derek An
2009-Jul-01 15:47 UTC
[R] Iteratively Reweighted Least Squares of nonlinear regression
Dear all, When doing nonlinear regression, we normally use nls if e are iid normal. i learned that if the form of the variance of e is not completely known, we can use the IRWLS (Iteratively Reweighted Least Squares ) algorithm: for example, var e*i =*g0+g1*x*1 1. Start with *w**i = *1 2. Use least squares to estimate b. 3. Use the residuals to estimate g, perhaps by regressing e^2 on *x*. 4. Recompute the weights and goto 2. Continue until convergence i was wondering whether there is a instruction of R to do this? [[alternative HTML version deleted]]
Ravi Varadhan
2009-Jul-01 16:43 UTC
[R] Iteratively Reweighted Least Squares of nonlinear regression
You are describing a "generalized nonlinear least-squares" estimation procedure. This is implemented in the gnls() function in "nlme" package. ?gnls Ravi. ____________________________________________________________________ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan at jhmi.edu ----- Original Message ----- From: Derek An <derekan2 at gmail.com> Date: Wednesday, July 1, 2009 11:50 am Subject: [R] Iteratively Reweighted Least Squares of nonlinear regression To: R-help at r-project.org> Dear all, > > > When doing nonlinear regression, we normally use nls if e are iid normal. > > i learned that if the form of the variance of e is not completely known, > we can use the IRWLS (Iteratively Reweighted Least Squares ) > > algorithm: > > for example, var e*i =*g0+g1*x*1 > > 1. Start with *w**i = *1 > > 2. Use least squares to estimate b. > > 3. Use the residuals to estimate g, perhaps by regressing e^2 on *x*. > > 4. Recompute the weights and goto 2. > > Continue until convergence > > i was wondering whether there is a instruction of R to do this? > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > > PLEASE do read the posting guide > and provide commented, minimal, self-contained, reproducible code.