Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Keeping values in upper triangle of matrix


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Keeping values in upper triangle of matrix
Date   Wed, 7 Dec 2011 08:37:19 +0000

Now the limits on -matsize- in Stata will bite you, and really hard.

http://www.stata.com/help.cgi?limits shows that no current Stata
allows more than 11,000 rows. You can at most put that vector in a
variable.

Nick

On Wed, Dec 7, 2011 at 3:36 AM, Michael Betz
<[email protected]> wrote:
> Awesome Brendan, that's the command I needed! I'm having a problem now with the next step, getting the column vector into Stata. When I use -st_matrix- Stata freezes up. I'm trying to put a 4729350x1 column vector, so I don't know if I'm running into a size problem. I'm using Stata 11 SE. My revised code is below.
>
> foreach x of varlist amenityscale-wages{
>        use "Merged1993", clear
>        mkmat `x'
>
>        mata: a=st_matrix("`x'")
>        mata: b=J(3075,3075,1)
>        mata: c=b:*a
>        mata: d=c:-a'
>        mata: e=vech(d)
>        mata: st_matrix("`x'", e)               //This is the step where Stata freezes up
>
>        svmat `x'
>        keep `x'
>        if `j'>0 merge 1:1 _n using "Finalmat93_00", nogen
>        save "Finalmat93_00", replace
>        local j=`j'+1
> }
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Brendan Halpin
> Sent: Tuesday, December 06, 2011 5:36 PM
> To: [email protected]
> Subject: Re: st: Keeping values in upper triangle of matrix
>
> On Tue, Dec 06 2011, Michael Betz wrote:
>
>> I wondered if there was a way to
>> save all the elements of the upper triangle of the matrix as a column
>> vector.
>
> Check out the vech() function in Mata.
>
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index