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

st: bootstrap with a user-contributed command

From   "Alessandro A. Leidi" <>
To   <>
Subject   st: bootstrap with a user-contributed command
Date   Mon, 11 May 2009 15:57:16 +0100

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?" 
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"

matrix list e(b)

         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

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

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