From | "Jun Xu" <[email protected]> |
To | [email protected] |
Subject | re:st: RE: Parse (translate equalities into linear transformation matrix) |
Date | Sun, 04 Apr 2004 21:37:16 -0500 |
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.
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |