Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: creating a matrix by adding rows inside a loop: conformability error


From   [email protected]
To   [email protected]
Subject   st: creating a matrix by adding rows inside a loop: conformability error
Date   Mon, 12 Nov 2007 14:09:52 +0100

I would like to create a matrix xtilde such that the i-th row is the sum of three components:
(1) the i-th row of matrix xmean[63,15] multiplied by matrix p[15,15] 
(2) the vector mux[1,15] multiplied by the difference between idd[15,15] and p[15,15]
(3) the i-th row of matrix dz[63,30] multiplied by matrix q[30,15]
What's wrong in line 4. of the following syntax? All matrixes appearing in it have 15 columns, and thus there should be not any conformability error.

. forvalues i = 1/63 {
  2. mat p=inv((r1+vu)/ns[`i'])*r1
  3. mat q=r2*(idd-p)
  4. matrix xtilde[`i',.] = (nullmat(xtilde) \  xmean[`i',.]*p +mux*(idd-p)+dz[`i',.]*q))
  5. }
conformability error
r(503);

Nicola

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index