Statalist The Stata Listserver

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

Re: st: nonlinear sureg

From   Joseph Coveney <>
To   Statalist <>
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.

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

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

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

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)

*   For searches and help try:

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