Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Re: st: Postlist for bootstrap


From   Vincenzo Carrieri <vincenzo.carrieri@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re:Re: st: Postlist for bootstrap
Date   Tue, 4 Jun 2013 11:15:48 +0200

Thanks Nick for your suggestion.
I changed the name of the predicted variable as you suggested. However
I get anyway a new error message. Now the message is:
insufficient observations to compute bootstrap standard errors-no
results will be saved

Maybe the problem is on the use of postfile. I am new on the use of
postfile, but I follow suggestions contained in stata help.

Any help is appreciated.
Thanks
V.


-----------------------------

Date: Mon, 3 Jun 2013 17:11:21 +0100
From: Nick Cox <njcoxstata@gmail.com>
Subject: Re: st: Postlist for bootstrap
We can't see your dataset but in

regress sesso eta

- -sesso- must be an existing variable, while in

predict sesso

- -sesso- must be a new variable name. That won't work therefore.

Nick
njcoxstata@gmail.com


On 3 June 2013 16:26, Vincenzo Carrieri <vincenzo.carrieri@gmail.com> wrote:
> Dear Statalisters,
> I am trying to implement bootstrap estimations of standard errors for
> concentration indexes but I get an error like: the variable "sesso"
> (name of the first variable that I use in the regression) was not
 found. I think that the problem is mostly on the use of postfile but
I  cannot find the solution.

 Here an example of what I did using just few variables.

 I first using data:

 use "C:\Users\User\Desktop\TEST.dta", replace

 Then I Declare variable names and filename of dataset where results
 will be stored

 postfile test2 my ciy m01 b01 ci01 using
 "C:\Users\User\Desktop\TEST.DTA",replace

 Then I launch my programme

 capture program drop index
 program define index
 regress sesso eta
 predict sesso
 sum sesso
 scalar my = r(mean)
 sum eta
 scalar m01=r(mean)

 tempname my ciy m01 b01  ci01
 sca b01 = _b[eta]
 gen rank=reddito

 I compute  concentration indices
   corr rank sesso        , c
      sca ciy           = 2*r(cov_12)/my
   corr rank eta        , c
      sca ci01           = 2*r(cov_12)/m01

 post stak my ciy m01 b01 ci01

 end

Up to now everything is ok.


 Finally I do boostrap:

 bootstrap , reps(10) : index

 Here I get the error message: variable sesso not found an error
 occurred when bootstrap executed index


 My code  would continue:

 I close the postfile

 postclose test2

 use "C:\Users\User\Desktop\test.dta", replace

 sum my ciy m01 b01 ci01


 Anyone can help me to understand what is wrong in my bootstrap programming
Any help is appreciated.
Thanks,

 Vincenzo
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index