Marteen,
Thank you very much for your help.
I was unaware of argument passing through string scalar when passing a matrix with st_matrix.
This is very helpful information.
Carl
________________________________________
From: [email protected] [[email protected]] On Behalf Of Maarten buis [[email protected]]
Sent: Sunday, July 19, 2009 8:52 AM
To: stata list
Subject: RE: st: Mata in an rclass program to bootstrap
--- Nelson, Carl wrote:
<snip>
> Is there a proper way to embed mata in a program to bootstrap
> that will not create this error?
Here is a silly example. More general advise can be found
here: -help m1_ado-
*-------------- begin example ------------
mata: mata clear
sysuse auto, clear
mata:
void foo(string scalar b) {
bb =st_matrix(b)
bb = 2:*bb
st_matrix("b", bb)
}
end
program drop _all
program define silly, rclass
reg mpg foreign
matrix b = e(b)
mata: foo("b")
return scalar b1 = el(b,1,1)
return scalar b2 = el(b,1,2)
end
bootstrap b1=r(b1) b2=r(b2), reps(100): silly
*-------------- end example -----------------
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/