Statalist


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

st: Mata in an rclass program to bootstrap


From   "Nelson, Carl" <chnelson@illinois.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Mata in an rclass program to bootstrap
Date   Sun, 19 Jul 2009 08:33:55 -0500

I tried to embed mata code in an r class program to bootstrap. The program starts

capture program drop welfareboot
program define welfareboot, rclass
version 10

it executes nlsur to estimate a parametric model

then 

mata:

ndm = st_matrix("ndm")
pdm = st_matrix("pdm")
npar = st_matrix("nonpoor")
ppar = st_matrix("poor")
.
.
.
end 

when I try to return scalars calculated by the mata program I get

return scalar cvnb = cvnbord
non r-class program may not set r()
r(151);

Is there a proper way to embed mata in a program to bootstrap that will not create this error?

Carl Nelson

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