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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

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

Subject |
st: RE: Non-Linear Least Squares Programming Question |

Date |
Thu, 16 Aug 2007 19:01:18 +0100 |

You can't include full matrices on the LHS of a -replace- command. The syntax of -replace- is replace oldvar =exp [if] [in] [, nopromote] and so what occurs on the LHS can _only_ be an existing variable name. The situation for the RHS is not quite so clear-cut, but the whole of the RHS could not be, or evaluate to, a full matrix, if only for the reason above. In Stata 9, Mata or the matrix programming language might be enough for your problem. Nick n.j.cox@durham.ac.uk Randall K. Q. Akee, Ph.D. > I have a program that I want to use with the NL (non-linear least > squares) command in Stata. I just have a simple question > with regard to > Stata v.9, for my objective function that gets "replaced" in the NL > program, is it possible to have the Left Hand side and the ride hand > side both be matrices? Typically, I have seen examples (in the stata > manual and other people's do files), where the right hand > side is simply > a single equation. > > For instance: > > capture program drop nltest > program define nltest > version 9.0 > if "`1'"== { global S_1 b1 b2 b3 > } > replace `1'=$b1*X+exp($b2*$b3) > end > > nl test data1 X etc. . . > > I want to know if Stata v.9 can handle a matrix on both the right hand > side and left hand side (can data1 and X be matrices?) in the > line above > that begins with "replace". I have several equations that I > would like > to fit with the same parameters. > > I know Stata v.10 has the NLSUR command, I just want to know > if I should > wait for this version. * * 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/

**References**:**st: Non-Linear Least Squares Programming Question***From:*"Randy Akee " <akee@iza.org>

- Prev by Date:
**st: RE: programming problem** - Next by Date:
**Re: st: RE: programming problem** - Previous by thread:
**st: Non-Linear Least Squares Programming Question** - Next by thread:
**st: re: date and if fn** - Index(es):

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