Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: exchangeability stata mata matrix and variable


From   Abdel Rahmen El Lahga <rahmen.lahga@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: exchangeability stata mata matrix and variable
Date   Fri, 25 Jun 2010 22:21:44 +0100

Hi,
In my function evaluator program used with nlsur command
I have many expression like this
 forvalues k = 1/20 {
     tempname b`k'
     scalar `b`k''=`at'[1,`k']
        }
tempvar y
     qui gen double `y' = `b1'*`x1' +  `b2'*`x2' + .....`b20'*`x3'
where b_i are my coeff and x_i are variables in my dataset
TO avoid writing this too long expression many time I would like that
variable y will be crated within mata
using expression like this
matrix B=`at'[1,1...20]
matrix X=(x1,....x20)
y=X*B' // within mata to avoid Stata matsize limit
and finally recuperate  the variable y within Stata
Any advice?



-- 
AbdelRahmen El Lahga
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index