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 not reporting observed coefficient as the mean of expression
From
Jaime Ruiz-Tagle <[email protected]>
To
[email protected]
Subject
Re: st: Bootstrap not reporting observed coefficient as the mean of expression
Date
Tue, 19 Apr 2011 11:10:22 -0400
Thanks Charles,
If it was the case you mention, wouldn't it be also that increasing
the number of reps should change the "observed coefficient"?
I tried different number of reps getting that bootstrap standard error
changes (as expected), but the "observed coefficient" remains
unchanged at a value which is not the observed mean....
Any hint?
Jaime.
On Tue, Apr 19, 2011 at 10:42 AM, Charles Koss <[email protected]> wrote:
> I have run your code. Seems to me that your program myderivative is
> bootstrapping the standard error of the expression whereas the first
> procedure is boostrapping both the expression and corresponding
> standard error.
>
> Charles
>
> --
> Charles Koss
> http://charlesonnet.blogspot.com
>
> On Tue, Apr 19, 2011 at 8:52 AM, Jaime Ruiz-Tagle
> <[email protected]> wrote:
>> Hi all,
>>
>> I found a problem in bootstrap, which is not reporting the "mean" of
>> an expression as the "observed coefficient".
>>
>> Here comes an example where bootstrap gives the correct "observed
>> coefficient" only when invoked through a user defined program.
>>
>> Hopefully somebody can help me since I'm very puzzled.
>>
>> Thanks,
>>
>> Jaime.
>>
>>
>> // //////////////////////////////////////////
>> use http://www.stata-press.com/data/r11/auto, clear
>>
>> gen weight2=weight^2
>>
>> regress mpg weight weight2 gear foreign
>>
>> gen derivative1 = (_b[weight] + 2*weight*_b[weight])
>> sum derivative1, detail
>>
>> // Using bootstrap with expression:
>> bootstrap derivative = (_b[weight] + 2*weight*_b[weight]), reps(100)
>> seed(1): regress mpg weight weight2 gear foreign
>>
>> // The "observed coefficient" is reported as -96.14374, but the mean
>> is -99.07872
>>
>> // Now using a user defined program that does the same as expression above
>>
>> capture pr drop myderivative
>> program define myderivative, rclass
>> version 11
>> tempname derivative2
>> quietly regress mpg weight weight2 gear foreign
>> capture drop derivative2
>> gen derivative2 =_b[weight] + 2*weight*_b[weight]
>> quietly summarize derivative2, meanonly
>> scalar `derivative2' = r(mean)
>> return scalar derivative2 = `derivative2'
>> end
>>
>> bootstrap r(derivative2), reps(100) seed(1): myderivative
>>
>> // The "observed coefficient" is now reported as equal to the mean = -99.07872
>>
>> // //////////////////////////////////////////
>>
>>
>>
>>
>>
>> --
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Jaime Ruiz-Tagle V.
>> Profesor
>> Centro de Microdatos, Departamento de Economía, Universidad de Chile
>> Diagonal Paraguay 257, Torre 26, Oficina 1603 A
>> Santiago - CHILE
>>
>> Tel: (56 2) 978 3586 / 978 3421
>> Fax: (56 2) 634 7342
>> [email protected]
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> *
>> * 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/
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jaime Ruiz-Tagle V.
Profesor
Centro de Microdatos, Departamento de Economía, Universidad de Chile
Diagonal Paraguay 257, Torre 26, Oficina 1603 A
Santiago - CHILE
Tel: (56 2) 978 3586 / 978 3421
Fax: (56 2) 634 7342
[email protected]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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/