Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: inequal7 and bs


From   [email protected] (Jeff Pitblado, Stata Corp.)
To   [email protected]
Subject   Re: st: inequal7 and bs
Date   Mon, 20 Oct 2003 11:01:56 -0500

Katja Hoelsch <[email protected]> asks how to use -bootstrap- with the
user-written command -inequal7-:

> I want to bootstrap e.g. the gini coefficient with inequal7 in Stata8. In
> version 7 I used the command line
> 
> bs "inequal7 i11101" "S_4", reps(10)
> 
> and it worked.
> 
> Now the command line seems to have change for Stata8 as it should be
> 
> bs "command" exp_list [, reps(#)]
> 
> What I have tried is
> 
> bs "inequal7 i11101" S_4, reps(10)
> 
> Then Stata responds:
> S_4 not found
> error in statistic: S_4
> 
> I also tried
> 
> bs "inequal7 i11101" r(gini), reps(10)
> 
> and Stata responds:
> type mismatch
> error in statistic: r(gini)
> 
> Of course I could use 
> 
> version 7
> bs "inequal7 i11101" "S_4", reps(10)
> 
> but isn't there a way to do it in Stata8?

Katja's second attempt using -r(gini)-,

	. bs "inequal7 i11101" r(gini), reps(10)

is the correct idea.  Unfortunately, the author of -inequal7- saved the
contents of -r(gini)- using -return local- (generates a string) instead of
-return scalar- (generates a number), this is the cause of the "type mismatch"
in the error message.

Katja can easily overcome the "type mismatch" by using the -real()- function:

	. bs "inequal7 i11101" real(r(gini)), reps(10)

--Jeff
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index