Statalist The Stata Listserver


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

Re: -nestreg- (was: st: saving a sample after a regression)


From   jpitblado@stata.com (Jeff Pitblado, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: -nestreg- (was: st: saving a sample after a regression)
Date   Mon, 12 Mar 2007 16:40:34 -0500

Michael S. Hanson <mshanson@mac.com> expressed an interested in getting
-nestreg- to support a command:

> 	So I am very intrigued by -nestreg- as mentioned by Richard:  I am 
> working on an application right now that could benefit from this tool.  
> Looking in the on-line help, it does not support the estimation 
> commands I am interested in using (newey or ivreg), but I notice that 
> it is possible to write one's own programs to run with -nestreg-.  
> Great!  Unfortunately, the documentation for doing so does not appear 
> to exist;  my copies of the version 9 [R] manuals has no entry for 
> -nestreg- -- as indicated in the on-line help file, which says 
> "forthcoming".  The on-line help also makes reference to using -sw- or 
> -swml- as -program- properties for the user-written program.... But 
> neither the on-line help nor the manuals have turned up any information 
> on such properties (although I concede I may have missed them).
> 
> 	So, can anyone recommend further information about implementing 
> user-written commands with -nestreg-?  Thanks!

Program properties are documented in -[P] program properties-, which is also
present in the online help.  In Stata type

	. help program properties

Note that the paretheses in -ivreg-'s varlist syntax are in conflict with the
standard syntax required by -nestreg-.  Here is a simple wrap-around routine
for -ivreg- that allows you to fix the instrumental variables when it is
prefixed with -nestreg-:

	program myivreg, prop(sw)
		version 9.2
		syntax [varlist] [if] [in] [aw fw iw pw] [, ivlist(string) *]
		ivreg `varlist' (`ivlist')			///
			`if' `in' [`weight'`exp'], `options'
	end

In -myivreg-, all we really did was provide the standard syntax and the -sw-
program property; -ivreg- handles all the other things like -e(b)-, -e(V)-,
and -e(sample)-.

--Jeff
jpitblado@stata.com
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index