Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Iteratively re-weighted least squares (IRLS)


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: Iteratively re-weighted least squares (IRLS)
Date   Sat, 07 Apr 2007 12:45:21 +0900

Richard Sperling wrote:

I would like to use Stata (9.2 SE) to estimate the following
inherently non-linear function by IRLS:

C = (a + b*X^g)*e,

where e is multiplicatively normal with mean 1 and standard deviation
0.15. I cannot use -nl- to estimate this function because it assumes
that the error term enters additively. One suggestion I have received
is to take logs of both sides:

ln(C) = ln(a+b*X^g) + ln(e).

Is there an alternative way of estimating this equation?

--------------------------------------------------------------------------------

Take a look at the -lnlsq()- option of -nl-.  I've illustrated its
application to your problem in the do-file below.  (Pharmacokineticists have
a variety of so-called error models or variance models.  Yours is the
"constant-coefficient-of-variation" or "proportional" variance model.)

You can also use -ml- in lieu of -nl- for nonlinear regression where you
want to model the variance explicitly.  It's illustrated in the FAQ section
of StataCorp's website at www.stata.com/support/faqs/stat/nl_ml.html .
(It's called "extended least squares" in the pharmacokinetics literature.)

Joseph Coveney

clear
set more off
set seed `=date("2007-04-07", "ymd")'
set obs 500
// C = (a + b*X^g)*e
local a 2
local b 3
local g 0.75
generate double X = uniform()
generate double e = 0.15 * invnormal(uniform())
generate double C = (`a' + `b' * X^`g') * (1 + e)
nl (C = {a} + {b} * X^{g}), lnlsq(-1) initial(a `a' b `b' g `g')
exit

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index