Statalist


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

st: working with matrix's rows


From   nicola.baldini2@unibo.it
To   statalist@hsphsun2.harvard.edu
Subject   st: working with matrix's rows
Date   Mon, 26 Nov 2007 12:50:40 +0100

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/



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