..- help for ^datmat^ Posted to statalist 09mar1998 ..- Multiplying variables as a matrix times another matrix - ------------------------------------------------------ ^datmat^ [type] newvarlist ^= (^oldvarlist^)*^matname [^if^ exp] [^in^ range] Description - ----------- Consider the k variables in "oldvarlist" as an N x k matrix, where N is the number of observations. The matrix called "matname" is a k x m matrix. Then the resulting matrix product of "oldvarlist"*"matname" is a N x m matrix, whose m columns become m new variables in "newvarlist". Note that the matrix multiplication performed by -datmat- is purely positional; i.e., it does just what you expect based on the order of the variables, observations, and rows and columns of "matname". The row and column names of the matrix "matname" are ignored. This is different from the behavior of ^matrix score^. Example - ------- . matrix list M M[3,4] c1 c2 c3 c4 r1 .05358972 -.00406139 -.00670559 .12557464 r2 -.00007397 .00008362 -.00083646 -.00126231 r3 -3.5525714 -1.5216259 2.2062823 -.40968964 . ^datmat x1 x2 x3 x4 = (mpg weight cons) * M^ . ^datmat double x1 x2 x3 x4 = (mpg weight cons) * M^ Author - ------ Bill Sribney Stata Corporation 702 University Drive East College Station, TX 77840 Phone: 409-696-4600 800-782-8272 Fax: 409-696-4601 email: tech_support@@stata.com Also see - -------- Manual: ^[R] matrix define^ ^[R] matrix score^ On-line: help for @matrix@