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]

From |
Sergiy Radyakin <[email protected]> |

To |
[email protected] |

Subject |
Re: Re: st: no room to add more double literals |

Date |
Tue, 18 Jan 2011 11:31:20 -0500 |

On Tue, Jan 18, 2011 at 11:02 AM, Nick Cox <[email protected]> wrote: > In response to > >> 1) if I try to input a matrix with 1,1,1,1\2,2,2,2\3,3,3,3.... it hits >> the limit as well with a different error >> message, but still pretty soon to be practical. > > I may be wrenching this out of context, but I note that there is no > obvious need to spell out every value of a matrix with such simple > structure. Consider > > : J(1,4,(1..20)') > 1 2 3 4 > +---------------------+ > 1 | 1 1 1 1 | > 2 | 2 2 2 2 | > 3 | 3 3 3 3 | > 4 | 4 4 4 4 | > 5 | 5 5 5 5 | > 6 | 6 6 6 6 | > 7 | 7 7 7 7 | > 8 | 8 8 8 8 | > 9 | 9 9 9 9 | > 10 | 10 10 10 10 | > 11 | 11 11 11 11 | > 12 | 12 12 12 12 | > 13 | 13 13 13 13 | > 14 | 14 14 14 14 | > 15 | 15 15 15 15 | > 16 | 16 16 16 16 | > 17 | 17 17 17 17 | > 18 | 18 18 18 18 | > 19 | 19 19 19 19 | > 20 | 20 20 20 20 | > +---------------------+ > > which can be generalised for "any value of 20" (or 4 for that matter). > On the other hand, this behaviour of J() was not in the very first > release of Mata > > SJ-8-3 pr0043 . . . . . Stata tip 67: J() now has greater replicating powers > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox > Q3/08 SJ 8(3):450--451 (no commands) > tip detailing Mata J() function recent enhancements That is certainly worth reading, but in my case there is no functional dependency between the element's index (in the matrix) and its value. I just have 792 numbers (and in general case more) to store in a (792 by 1) matrix. You can think of them as model coefficients estimates that are predefined and need to be stored securely in Mata code. The above 1,1,1,1\2,2,2,2... line was just an example of the notation (is there an official name for this notation of spelling out a matrix's content?). I find http://www.stata.com/help.cgi?limits one of the most important Stata documentation parts. But I can't find its Mata counterpart. Perhaps, some restrictions are mentioned in the documentation here and there, but not in such a crisp and clear form. Thank you, Sergiy > > and so may not be old-fashioned enough for Sergiy. But there are other > ways to do it. Even the pedestrian > > (1..20)',(1..20)',(1..20)',(1..20)' > > looks a better solution to me. What am I missing? > > Nick > > On Tue, Jan 18, 2011 at 3:44 PM, Sergiy Radyakin <[email protected]> wrote: >> Hello Kit, >> >> On Tue, Jan 18, 2011 at 9:23 AM, Christopher Baum <[email protected]> wrote: >>> <> >>> On Jan 18, 2011, at 2:33 AM, Sergiy wrote: >>> >>>> What is the best way to define, e.g. 100000x1 matrix in the Mata code? >>>> (Another software is writing the Mata program, so I am not concerned >>>> about the amount of labor). >>> >>> Why not just define the matrix (or the vec() of the matrix) as a Stata variable and view it in Mata? >> >> >> Because it goes against the encapsulation paradigm ("a language >> mechanism for restricting access >> to some of the object's components" -- Wikipedia). >> >> My two other observations are: >> 1) if I try to input a matrix with 1,1,1,1\2,2,2,2\3,3,3,3.... it hits >> the limit as well with a different error >> message, but still pretty soon to be practical. >> >> 2) if I run the original commands without wrapping them into a >> function - everything works well >> (presumably because the literals are not stored, but rather executed >> right away). >> >> >> I have found by now the response of David Drukker from 2007 regarding >> the problem: >> http://www.stata.com/statalist/archive/2007-08/msg00149.html >> Since I need the program to be compatible with Stata 9, further >> updates will not be applicable. >> >> Thank you, Sergiy > * > * 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/ > * * 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/

**Follow-Ups**:**RE: Re: st: no room to add more double literals***From:*Nick Cox <[email protected]>

**References**:**Re: Re: st: no room to add more double literals***From:*Christopher Baum <[email protected]>

**Re: Re: st: no room to add more double literals***From:*Sergiy Radyakin <[email protected]>

**Re: Re: st: no room to add more double literals***From:*Nick Cox <[email protected]>

- Prev by Date:
**Re: st: Keep observations in panel data** - Next by Date:
**st: RE: generalized Dunnett's test?** - Previous by thread:
**Re: Re: st: no room to add more double literals** - Next by thread:
**RE: Re: st: no room to add more double literals** - Index(es):