**announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Antony Chapoto <achapoto@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: ML program in Stata 12.1 for a nonlinear equation of the form Y=F(x)*G(z) |

Date |
Sat, 6 Apr 2013 20:35:24 +0000 |

I would like your assistance to write an ML program in Stata 12.1 for the following nonlinear model: Y=F(x)*G(z) where F(x)=a1X1 +a2X2 +a3X3 +a4X4 and G(z) =exp[-(b0+b1Z1+b2Z2 +b3Z3 +b4Z4 +b5Z5)^2] where a1 – a4, b0, b1-b5 are parameters to be estimated and X, Z are explanatory variables Essentially, I would like the effect of x on Y to be adjusted by G(z). What is the correct ML program assuming that we have normally distributed errors. The expanded model is as follows: Y=(a1X1 +a2X2 +a3X3 +a4X4)*exp[-(b0+b1Z1+b2Z2 +b3Z3 +b4Z4 +b5Z5)^2] +e I attempted to write a program following an example at http://www.stata.com/support/faqs/statistics/nonlinear-models-using-ml/ but failed to come up with the t " ml model " for the program to run. Your assistance is greatly appreciated. capture program drop myprog program myprog version 12.1 args lnf b1x a1x sigma tempvar res qui gen double `res' = $ML_y1 – (`b1x')*exp(-(`a1x')^2)) qui replace `lnf' = -0.5*ln(2*_pi)-ln(`sigma')-0.5*`res'^2/`sigma'^2 Best regards, Antony * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: ML program in Stata 12.1 for a nonlinear equation of the form Y=F(x)*G(z)***From:*"JVerkuilen (Gmail)" <jvverkuilen@gmail.com>

- Prev by Date:
**Re: st: Find the fiscal year for each obs** - Next by Date:
**st: indicator variable and interaction term different signs but both significant** - Previous by thread:
**st: Find the fiscal year for each obs** - Next by thread:
**Re: st: ML program in Stata 12.1 for a nonlinear equation of the form Y=F(x)*G(z)** - Index(es):