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: svy bootstrap


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   Re: st: svy bootstrap
Date   Wed, 9 Mar 2011 22:22:34 -0500

Your -twopart- program expected weights, but you did not supply any
when you called it for the first time without any arguments. A more
protective code would have something like

if "`weight'" == "" {
  display as error "twopart was expecting [pweight=variable], but none
was specified"
  exit 198
}

to make sure all the required inputs were provided by the user (or by
the -bootstrap-).

On Wed, Mar 9, 2011 at 9:13 PM, Michael Palmer
<[email protected]> wrote:
> Thanks so much for your reply. I went ahead with the suggested code in the single program.
> However, I was met with the error message: '=unknown weight type'.
>
> The revised do file is:
>
> capture program drop twopart
> program twopart, rclass
> syntax [pweight /]
> logit inpat_public $xlist1 if age > 5 [`weight'=`exp']
> predict `pr_y', pr
> reg ipexp_public_log $xlist1 if age > 5 & inpat_public==1 [`weight'=`exp']
> predict `yhat', xb
> predict `ehat', residuals

etc.

> return scalar bpwd = `m_1'*`m_3' - `m_2'*`m_4'
>
> end
>
> set more off
> twopart
> return list
> bsweights bsw, reps(100) n(-1)
> bs4rw (bpwd=r(pwd)), rw(bsw*): twopart [pw=psindwt]
>


-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   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