Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Cyrus Levy <levy.cyrus@gmail.com> |

To |
statalist <statalist@hsphsun2.harvard.edu> |

Subject |
st: Defining a matrix in ml program |

Date |
Sun, 10 Mar 2013 14:38:56 -0400 |

In the ml program below, I want to define a matrix based on parameter equations and use that matrix later in lnL. But "ml check" command returns an error in the line where I define the matrix MT. I am wondering if it is possible or not at all to create matrices in Stata based on ml parameters in this context. If yes, what is wrong with my code and how can I fix it? sysuse auto, clear capture program drop maxauto program maxauto version 12 args todo b lnf tempvar b1x b0 sigma eta1 eta2 eta3 eta4 mleval `b1x' = `b', eq(1) mleval `b0' = `b', eq(2) mleval `sigma' = `b', eq(3) mleval `eta1' = `b', eq(4) mleval `eta2' = `b', eq(5) mleval `eta3' = `b', eq(6) mleval `eta4' = `b', eq(7) tempname MT matrix define `MT' = [`eta1', `eta2'\ `eta3', `eta4'] // tempvar res epsilon // quietly gen double `epsilon' = $ML_y2 - `b0' // quietly gen double `res' = $ML_y1 - `epsilon'*(1-exp(-`b1x')) // mlsum `lnf' = -0.5*ln(2*_pi)-ln(`sigma')-0.5*`res'^2/`sigma'^2 end ml model d0 maxauto (b1: rep78 = headroom, nocons) (b0: ) (sigma: ) (eta1: ) (eta2: ) (eta3: ) (eta4: ) ml check ml max * * 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**:**st: Re: Defining a matrix in ml program***From:*"Joseph Coveney" <stajc2@gmail.com>

- Prev by Date:
**Re: st: -robust- and -cluster- options in xtreg** - Next by Date:
**Re: st: Treatment of missing values in surveys in Stata (subpop)** - Previous by thread:
**st: Why those packages suddenly all disappeared?** - Next by thread:
**st: Re: Defining a matrix in ml program** - Index(es):