Two very broad suggestions:
Why not turn the problem so that the user must input this
matrix?
Can you get -test- to do the work for you?
Nick
n.j.cox@durham.ac.uk
Jun Xu
> Thanks to Nick's comments on syntax anything last time and I
> used several
> gettoken and equations get parsed. Now, I try to incorporate more
> comprehensive problems. A reminder of my problem and to make
> my problem more
> generic, I have d1, d2, d3...(k known number of functions
> derived from
> estimated of last estimation), and I like to test if the
> linear combination
> of d1...dk is equal to somthing, something like:
> let's assume there is d1-d5
>
> mytest 2*d1+(3+5)*d2/2+d5*_pi=0
>
> I can successfully parse each element before or after + or
> negative sign,
> but I couldn't figure out how to parse 2*d1, 3*d2/2, d5*_pi
> into matrix. It
> seems to me there are too many ways of writing such
> expressions, thereby
> hard to parse. The end product that I what is two matrices:
>
> The transformation matrix: [2, (3+5)/2, 0, 0, _pi]
> The d matrix: [d1, d2, d3, d4, d5]'
>
> Well, I can easily get d matrix because I can use some info in last
> estimation to derive them, but the key issue here is to grab
> numbers or
> numeric expressions in those equalities, peel off d1,
> d2,...d5, and turn the
> rest part into a transformation matrix. Any suggestions? Thanks a lot.
*
* 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/