[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: access subsets of a matrix
I am new to Stata programming so I have a problem to translate the following
line of mathlab code into Stata code.
lambda(z==0) = - normpdf(X(z==0,:)*gamma)
Here lambda is an (nx1) matrix, X is (nxk), gamma is (kx1), z is (nx1), and
for example X(z==0) denotes subset of the matrix X for which (z==1), i.e.
the condition in parenthesis holds true.
In Stata, how can I access this subset of my X matrix? It should be
matrix lambda = -normde(X[if z==1]*gamma)
but I can't Stata to access the matrix subsets as I need it. Thanks for your
* For searches and help try: