# re:st: RE: Parse (translate equalities into linear transformation matrix)

 From "Jun Xu" To statalist@hsphsun2.harvard.edu Subject re:st: RE: Parse (translate equalities into linear transformation matrix) Date Sun, 04 Apr 2004 21:37:16 -0500

Nick,

Do you mean I force users to punch in their transformation matrix and restriction matrix?
Something like:

my test, tmat(....) rmat(...)

The reason why I am doing this is that I am trying to test if a particular probability is equal to some numeric values after estimating discrete choice models, and it seems that test command and even testnl command is not very applicable in this case and I try to write my own routines. Not sure if there is any template out there can solve my parsing problems. Thanks a lot.

xj.

***********************************************

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/