Statalist The Stata Listserver


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

Re: st: nonlinear sureg


From   Joseph Coveney <jcoveney@bigplanet.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: nonlinear sureg
Date   Thu, 31 Aug 2006 18:06:38 +0900

Camilla Andersson wrote:

Does anyone know how to estimate a nonlinear seemingly unrelated
regressions model in Stata?

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

Take a look at either of the following two posts, and see if it points you
in the right direction.

http://www.stata.com/statalist/archive/2004-01/msg00816.html

http://www.stata.co.uk/statalist/archive/2003-10/msg00820.html

I noticed that your first post on this described the particulars:

"Is it possible to estimate SUREG when the regressions are nonlinear in the
parameters?

I want to estimate a system that looks like this:

Y1=exp(alfa1 X1)*( beta1+beta2 X2)
Y2=exp(alfa1 X3)*( beta1+beta2 X4)

How can I do this?"

The coefficients are the same between the two equations (as if a
multivariate nonlinear regression); would -nl , cluster()- get you close
enough to where you need to go?

Joseph Coveney

clear
set more off
set obs 100
set seed `=date("2006-08-31", "ymd")'
forvalues i = 1/4 {
    generate float x`i' = uniform()
}
local alpha1 1
local beta1 2
local beta2 3
generate float y1 = (`beta1' + `beta2' * x2) * ///
  exp(`alpha1' * x1) + invnorm(uniform())
generate float y2 = (`beta1' + `beta2' * x4) * ///
  exp(`alpha1' * x3) + invnorm(uniform())
*
* Begin here
*
rename x1 x10
rename x3 x11
rename x2 x20
rename x4 x21
rename y1 y0
rename y2 y1
generate byte id = _n
reshape long x1 x2 y, i(id) j(rep)
nl (y = ( {beta1} + {beta2} * x2 ) * exp( {alpha1} * x1) ), cluster(id)
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index