You don't even need :* for the multiplication. Multiplication of a
scalar and a matrix is covered by common or garden multiplication *. But
the subtraction must be elementwise using :- (the elementwise
subtraction).
Nick
n.j.cox@durham.ac.uk
mjbaker@hunter.cuny.edu
I am trying to do an element-by-element computation in mata but am not
sure if it is possible. Given a matrix Z with elements z[I,j], what I
would like to do is transform the elements of Z using scalars a and b to
create a new matrix W as follows:
w[i,j]=a^2*z[i,j])-b
How might this be done using the element-by-element colon operator in
mata, if it can be done?
*
* 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/