I am trying to translate the following S-PLUS script for use in Stata
for (i in 1:ng){
p <- solve(r1 +vu/ns[i],r1)
q <- r2 %*% (idd-p)
xtilde[i,] <- xmean[i,] %*% p +mux %*% (idd-p) +dz[i,] %*% q
}
How can I work with matrix rows? I thoght that, if dz is a matrix, -dz[1,.]- order Stata to take the first row. However, given that both dz[1,.]*q and dz[.,1]*q produce a result (while one should produce an error given that dz is [63,30] and q is [30,15]), my thought must be wrong. So, how can I take a row from dz in order to do the loop?
Nicola
P.S. I use version 9.2
*
* 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/