Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: exchangeability stata mata matrix and variable

From   Abdel Rahmen El Lahga <>
Subject   st: exchangeability stata mata matrix and variable
Date   Fri, 25 Jun 2010 22:21:44 +0100

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:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index