Statalist


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

[no subject]



My guess is neither. Look at the -ereturn post- command you used.

But you don't need to write a program after all. You can -bootstrap- -diagt- directly.
The fact that it is r-class is secondary.
-bootstrap-  will squawk a bit, but will still deliver the goods.

Nick
[email protected]


-----Original Message-----
From: Alessandro A. Leidi
Sent: 11 May 2009 15:57
To: '[email protected]'
Subject: bootstrap with a user-contributed command

Dear Stata users,

I am using
Stata/IC 10.1 for Windows
Born 02 Feb 2009

I got as far as the commands below when trying to bootstrap sensitivity and specificity,
(i.e. a vector) from the -diagt- command installed from SSC.

Stata 10 reference manual A-H page 210 has an example of -rclass- function only,
not for a user-written -eclass- command.

All examples I found in the Stata list server are using system commands
that already have a -function e(sample)- in the -ereturn list-

So, based on the FAQ titled "How do I bootstrap a vector of results?"
from http://www.stata.com/support/faqs/stat/bs_b_trick.html
I wrote the following:

* BEGIN ===============================================================

ssc install diagt

diagti 80 17 11 44

capture program drop myeprog
program myeprog, eclass
version 10
tempname bb
diagt true test
matrix `bb'=(r(sens),r(spec))
matrix colnames `bb' = sens spec
ereturn post `bb'
ereturn local cmd="bootstrap"
end

myeprog
matrix list e(b)

e(b)[1,2]
         sens       spec
y1  82.474227         80


bootstrap _b, reps(100): myeprog
(running myeprog on estimation sample)

Warning:  Since myeprog is not an estimation command or does not set e(sample),
bootstrap has no way to determine which observations are used in calculating
the statistics and so assumes that all observations are used.
This means no observations will be excluded from the resampling because of
missing values or other reasons.
If the assumption is not true, press Break, save the data, a
nd drop the observations that are to be excluded.
Be sure that the dataset in memory contains only the relevant data.

Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
post __000003 not found
post __000003 not found
r(111);

* END =====================================================================

There are no missing values in the dataset.

Is this error something to do with -estimates esample- missing in -myeprog-,
or anything to do with the user-contributed program -diagt- itself?

Thank you for your help
Sandro Leidi


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

CONFIDENTIALITY  NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information. If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system. Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.

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



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