Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: User-written commands and vce() support


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: User-written commands and vce() support
Date   Wed, 11 Jun 2008 18:34:16 -0500

Richard Williams <[email protected]> asks how to get a user-written
estimation command to accept the replication based vcetypes, -vce(bootstrap)-
and -vce(jackknife)-:

> One of the things that impresses me about Stata is that it is easy to 
> write ml programs for it that support all sorts of options (including 
> many that I have no idea what they do!)  Anyway, one of my programs 
> is called oglm (available from SSC), and the following two commands both work:
> 
> oglm  warm yr89 male, vce(oim)
> oglm  warm yr89 male, vce(robust)
> 
> Alas, the following does not:
> 
> . oglm  warm yr89 male, vce(bootstrap)
> vcetype 'bootstrap' not allowed
> 
> So, my question is, what do I need to do to tweak my programs to 
> support more of the vce options?
> I don't explicitly define vce as an option in my program.  Instead, 
> the option gets captured by this command:
> 
> mlopts ml_options, `options'
> 
> Is mlopts letting some vce options through while blocking others?  If 
> so, do I need to explicitly include the vce otion in my syntax 
> statement, and then check to make sure that the options specified are 
> legit?  If so, is there some nice code I can just cut and paste?

There is an "undocumented" programmers utility that parses the -vce()- option
for the replication based VCE methods.  The "undocumentation" for this parse
utility is available within Stata:

	. help _vce_parserun

Based on the help file for -oglm-, I believe the following code segment can be
added to the top of the -oglm.ado- file just before the -version- statement.

***** BEGIN:
	if _by() {
		local BY `"by `_byvars'`_byrc0':"'
	}
	`BY' _vce_parserun oglm, mark(	Exposure		///
					OFFset			///
					CLuster			///
					HETero			///
					SCALE			///
					eq2) : `0'
	if "`s(exit)'" != "" {
		version 9.2: ereturn local cmdline `"oglm `0'"'
		exit
	}
***** END:

--Jeff
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index