[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Nonlinear model using maximum likelihood

From   Magnus Soderberg <>
To   "" <>
Subject   st: Nonlinear model using maximum likelihood
Date   Wed, 4 Mar 2009 09:09:18 +1030

Dear All,

I want to estimate the following nonlinear function:

Y = b0 + b1*exp(b2*x1)*b4*x2*x3 + Xb 

Where b0 to b3 are parameters (b vector of parameters), x1 to x3 variables (X a vector of variables). 

I could estimate this by using the Stata command nl, but I want to use ML. 

There is a similar problem and a solution posted at which looks like

program mlnexpgr
	version 10
	args lnf b1x b0 sigma
	tempvar res
	quietly gen double `res' = $ML_y1 - `b0'*(1-exp(-`b1x'))
	quietly replace `lnf' = -0.5*ln(2*_pi)-ln(`sigma')-0.5*`res'^2/`sigma'^2

ml model lf mlnexpgr (b1: rep78 = headroom, nocons) (b0:) (sigma:)
ml max

I guess my problem is the specification of the "ml model"-line but despite numerous attempts I can't get a reasonable output.

Does anyone know how to do this?

All the best,

*   For searches and help try:

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