Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | <Dominic.Thorrington@lshtm.ac.uk> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Program syntax for svy bootstrap or bs4rw (Out of office reply) |
Date | Tue, 26 Jun 2012 17:29:20 +0100 |
Thank you for your email. I am away on annual leave. I will be back in the office on Thursday 5th July. If your email refers to an urgent matter then please contact my PhD supervisor, Dr Ken Eames (Ken.Eames@lshtm.ac.uk). I will address all other matters when I return. Dom >>> Jeffrey Pitblado <jpitblado@stata.com> 06/26/12 17:11 >>> Mark McGovern<markemcgovern@gmail.com> asked a question about programming syntax and using -svy bootstrap- or my -bs4rw- prefix command. Stas Kolenikov and Steve Samuels replied with several good suggestions, but Mark is still having some trouble: > Thank you Steve and Stas for your suggestions. For now I can work with > bs4rw, although at some point I think I might need to use some of the > functionality of svy, so I may have to return to this in the future. > > As you pointed out Steve, from the Stata 12 programming manual (p.326): > > 1. Command must be eclass and allow iweights and accept the standard > estimation syntax. > 2. Command must save the model coefficients and ancillary parameters > in e(b) and the estimation sample size in e(N), and it must identify > the estimation subsample in e(sample); > 3. svy?s vce(bootstrap), vce(brr), and vce(sdr) require that command > have svyb as a property. > > I thought these were satisfied as the original code below does return > results in e() in the usual way from "regress". For example, > specifically overwriting e() does not help as in the below. Here is Mark's code: > capture program drop test1 > program define test1, eclass properties(svyb) > syntax [if] [in] [pw iw] > marksample touse > tempvar b V > qui xi:reg age race [`weight'`exp'] if `touse' > capture drop re1 > predict re1 > qui xi:reg birthwgt re1 [`weight'`exp'] if `touse' > local nobs = e(N) > matrix `b' = e(b) > matrix `V' = e(V) > ereturn post `b' `V', esample(`touse') > ereturn local cmd="test1" > ereturn scalar N = `nobs' > ereturn display > end > > svy : test1 The problem here is that . svy : test1 looks like a replay call to -svy-. Mark put all the model specfication information in the -test1- program. Mark can add something to the syntax to -test1- that will prevent -svy- from trying to replay nonexistent results. I would suggest . svy : test1 in 1/l -- Jeff Pitblado jpitblado@stata.com * * 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/