Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Wu Zhang <wuzhang50@yahoo.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: error message about bootstrp |
Date | Mon, 4 Mar 2013 11:54:19 -0800 (PST) |
Hi Nick, It works fine that way.I am just wondering whether we can use e(b) in the rclass program? Thanks, Wu ----- Original Message ----- From: Nick Cox <njcoxstata@gmail.com> To: statalist@hsphsun2.harvard.edu Cc: Sent: Monday, March 4, 2013 7:27 AM Subject: Re: st: error message about bootstrp You should run your program -apese- once by itself on the data to see what it leaves behind. Nick On Mon, Mar 4, 2013 at 7:54 AM, Wu Zhang <wuzhang50@yahoo.com> wrote: > After I adopt your suggestion and modify the code a little bit, I get this error message : > > insufficient observations to compute bootstrap standard errors > no results will be saved > r(2000); > > The Boostrap code is as follows: > > > > cap program drop apese > program apese, rclass > version 12.1 > capture drop xalphat ehat sdhat meanvaluen meanvalue21 > reg odds x1 x2 x3 > mat paraest=e(b) > return scalar alphaj =_b[x2] > predict ehat, residual > mean x1 x2 x3 const > mat xmean=e(b) > mat meanvalue=xmean*paraest' > svmat meanvalue, names(meanvalue2) > sum meanvalue21 > gen meanvaluen=r(mean) > gen sdhat=alphaj*exp(meanvaluen+ehat)/(1+exp(meanvaluen+ehat))^2 > > sum sdhat > return scalar apej=r(mean) > > end > > > > The running code is: bootstrap apej=r(apej): apese > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/