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]
st: defining matrices in Mata
From
Christopher Baum <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: defining matrices in Mata
Date
Tue, 3 Jan 2012 10:29:37 -0500
Dear tech support,
I am using Stata 12/MP4, s/n 5012041613, fully updated. I have some code in an ado-file that defines a somewhat sizable table of critical values for a statistical test. I would like to define this in a Mata function, rather than an ado-file, so that it may be compiled. However, when I try to define that matrix in Mata, it runs into (undocumented) size limits on the number of tokens (at about 246 elements):
clear all
mata:
void cdsy( )
{
real matrix ivbias5
ivbias5 = (
. , . , . \
. , . , . \
13.91 , . , . \
16.85 , 11.04 , . \
18.37 , 13.97 , 9.53 \
19.28 , 15.72 , 12.20 \
19.86 , 16.88 , 13.95 \
20.25 , 17.70 , 15.18 \
20.53 , 18.30 , 16.10 \
20.74 , 18.76 , 16.80 \
20.90 , 19.12 , 17.35 \
21.01 , 19.40 , 17.80 \
21.10 , 19.64 , 18.17 \
21.18 , 19.83 , 18.47 \
21.23 , 19.98 , 18.73 \
21.28 , 20.12 , 18.94 \
21.31 , 20.23 , 19.13 \
21.34 , 20.33 , 19.29 \
21.36 , 20.41 , 19.44 \
21.38 , 20.48 , 19.56 \
21.39 , 20.54 , 19.67 \
21.40 , 20.60 , 19.77 \
21.41 , 20.65 , 19.86 \
21.41 , 20.69 , 19.94 \
21.42 , 20.73 , 20.01 \
21.42 , 20.76 , 20.07 \
21.42 , 20.79 , 20.13 \
21.42 , 20.82 , 20.18 \
21.42 , 20.84 , 20.23 \
21.42 , 20.86 , 20.27 \
21.41 , 20.88 , 20.31 \
21.41 , 20.90 , 20.35 \
21.41 , 20.91 , 20.38 \
21.40 , 20.93 , 20.41 \
21.40 , 20.94 , 20.44 \
21.39 , 20.95 , 20.47 \
21.39 , 20.96 , 20.49 \
21.38 , 20.97 , 20.51 \
21.38 , 20.98 , 20.54 \
21.37 , 20.99 , 20.56 \
21.37 , 20.99 , 20.57 \
21.36 , 21.00 , 20.59 \
21.35 , 21.00 , 20.61 \
21.35 , 21.01 , 20.62 \
21.34 , 21.01 , 20.64 \
21.34 , 21.02 , 20.65 \
21.33 , 21.02 , 20.66 \
21.32 , 21.02 , 20.67 \
21.32 , 21.03 , 20.68 \
21.31 , 21.03 , 20.69 \
21.31 , 21.03 , 20.70 \
21.30 , 21.03 , 20.71 \
21.30 , 21.03 , 20.72 \
21.29 , 21.03 , 20.73 \
21.28 , 21.03 , 20.73 \
21.28 , 21.04 , 20.74 \
21.27 , 21.04 , 20.75 \
21.27 , 21.04 , 20.75 \
21.26 , 21.04 , 20.76 \
21.26 , 21.04 , 20.76 \
21.25 , 21.04 , 20.77 \
21.24 , 21.04 , 20.77 \
21.24 , 21.04 , 20.78 \
21.23 , 21.04 , 20.78 \
21.23 , 21.03 , 20.79 \
21.22 , 21.03 , 20.79 \
21.22 , 21.03 , 20.79 \
21.21 , 21.03 , 20.80 \
21.21 , 21.03 , 20.80 \
21.20 , 21.03 , 20.80 \
21.20 , 21.03 , 20.80 \
21.19 , 21.03 , 20.81 \
21.19 , 21.03 , 20.81 \
21.18 , 21.03 , 20.81 \
21.18 , 21.02 , 20.81 \
21.17 , 21.02 , 20.82 \
21.17 , 21.02 , 20.82 \
21.16 , 21.02 , 20.82 \
21.16 , 21.02 , 20.82 \
21.15 , 21.02 , 20.82 \
21.15 , 21.02 , 20.82 \
21.15 , 21.02 , 20.83 \
21.14 , 21.01 , 20.83 \
21.14 , 21.01 , 20.83 \
21.13 , 21.01 , 20.83 \
21.13 , 21.01 , 20.83 \
21.12 , 21.01 , 20.84 \
21.12 , 21.01 , 20.84 \
21.11 , 21.01 , 20.84 \
21.11 , 21.01 , 20.84 \
21.10 , 21.00 , 20.84 \
21.10 , 21.00 , 20.84 \
21.09 , 21.00 , 20.85 \
21.09 , 21.00 , 20.85 \
21.08 , 21.00 , 20.85 \
21.08 , 21.00 , 20.85 \
21.07 , 21.00 , 20.85 \
21.07 , 20.99 , 20.86 \
21.06 , 20.99 , 20.86 \
21.06 , 20.99 , 20.86 )
ivbias5
}
end
How can I define a matrix of this (admittedly not very large) size in Mata? I don't want to refer to a Stata matrix, as that would defeat the whole purpose of putting these
matrix definitions into Mata compiled code.
Happy new year!
Cheers
Kit
Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html
*
* 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/