Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: matrix subsetting


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: matrix subsetting
Date   Fri, 9 Oct 2009 14:14:00 +0100

In addition, those still using this matrix language will find extra
functions in this trilogy of articles from 1997, 1999, 2000: 

STB-56  dm79  . . . . . . . . . . . . . . . . . . Yet more new matrix
commands
        (help matcorr, matewmf, matvsort, svmat2 if installed)  . .  N.
J. Cox
        7/00    pp.4--8; STB Reprints Vol 10, pp.17--23
        commands to produce a correlation matrix, elementwise monadic
        function of another matrix, selected subsets of matrix rows
        and columns, vec or vech of a matrix, elements sorted within
        a vector, matrix from a vector, and commands to save matrices
        see mata matrix language incorporated into Stata 9.0

STB-50  dm69  . . . . . . . . . . . . . . . . . .  Further new matrix
commands
        (help matdelrc, matewm, matmad, matpow if installed)  . . .  N.
J. Cox
        7/99    pp.5--9; STB Reprints Vol 9, pp.29--34
        collection of new matrix commands providing additional matrix
        checking, management, element-wise operators, maximum absolute
        difference, and power

STB-39  dm49  . . . . . . . . . . . . . . . . . . . . Some new matrix
commands
        (help matfunc, varfunc if installed)  . . . . . . . . . . .  J.
Weesie
        9/97    pp.17--20; STB Reprints Vol 7, pp.43--48
        collection of new matrix commands; several for explicit matrices
        and a few for implicit matrices (i.e., variables)
        see mata matrix language incorporated into Stata 9

Although it's not explicit above, -matselrc- from STB-56 is a
convenience program for selecting particular rows and columns of a
matrix. 

Nick 
n.j.cox@durham.ac.uk 

Sergiy Radyakin

. mat x = (1,2,3,4 \ 5,6,7,8 \ 9,10,11,12)
. mat z = x[1..3,1],x[1..3,3]
. mat l z

z[3,2]
    c1  c3
r1   1   3
r2   5   7
r3   9  11


On Thu, Oct 8, 2009 at 6:53 AM, Thomas <tpt21@cam.ac.uk> wrote:

> I am trying to extract non-adjacent columns (1 and 3) from a matrix
(in
> Stata not Mata):
>
> mat x = (1,2,3,4 \ 5,6,7,8 \ 9,10,11,12)
> mat z = x[1..3,(1,3)]
>
> I get a type mismatch error. What am I doing wrong?

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



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