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: bootstrap means of several variables in one command


From   "Mitchell F. Berman" <[email protected]>
To   [email protected]
Subject   Re: st: bootstrap means of several variables in one command
Date   Wed, 26 Mar 2014 15:09:06 -0400

Thank you so much.

This works nicely.

M Berman
Columbia University

On 3/26/2014 2:44 PM, Nick Cox wrote:
You need to write your own program therefore, say as here:

sysuse auto, clear

program myprog, rclass
       version 9
       syntax varlist(min=2 max=2 numeric) [if] [in]
       tokenize "`varlist'"
       args v1 v2

      su `v1'  `if' `in', meanonly
      return scalar mean1 = r(mean)

      su `v2'  `if' `in', meanonly
      return scalar mean2 = r(mean)
end

bootstrap  mean1=r(mean1) mean2 = r(mean2) : myprog turn trunk

Nick
[email protected]




*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index