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: mata in program define


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: mata in program define
Date   Tue, 5 Jul 2011 08:58:06 +0200

On Tue, Jul 5, 2011 at 5:35 AM, Zhi Su <su.zh@husky.neu.edu> wrote:
>  I need to get bootstrap standard errors in a regression. And I need
> to define a program that produce the standdard errors for a single
> sample. When defining parts of the program that is involved with
> matrix calculation, mata is used.

You should store the Mata part in a function defined outside the Stata
program. Than within you Stata program you call that Mata function in
one line. So the basic structure would be:

mata:
void foo() {
    ...
}
end

program define foo
    ...
    mata: foo()
    ...
end

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------

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