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

RE: st: obtaining AUC at each iteration when bootstrapping a logistic reg ression model


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   RE: st: obtaining AUC at each iteration when bootstrapping a logistic reg ression model
Date   Tue, 20 Jul 2004 17:23:06 +0100

Of course, I forgot about -macrolists-... the code would become:

 local vinf : list v in finvars
 return scalar `v'=`vinf'

As for the lousiness of stepwise, this approach might at least highlight how dependent the selection of variables is on the sample!

David
[email protected]

-----Original Message-----
From: Nick Cox [mailto:[email protected]]
Sent: 20 July 2004 16:56
To: [email protected]
Subject: RE: st: obtaining AUC at each iteration when bootstrapping a
logistic reg ression model


Whatever function you use may also suffer 
from the limit on the length of string 
expressions, so this problem, qua programming 
problem, probably calls from something from 
-macrolists-. 

Having said that, my tuppenceworth of pure unadulterated 
prejudice is that applying a lovely method (bootstrapping) 
to a lousy one (stepwise) won't make it any less lousy. 

Nick 
[email protected] 

David Harrison
 
> A word of warning about the code I just sent: the use of the 
> -index()- function below is rather ropey. It relies on none 
> of the variable names being substrings of any of the other 
> variable names (e.g. if variables were named x and x2 then 
> this code would not work because the -index()- function would 
> flag x whenever x2 was present). Something more robust, but 
> more complex, could be done with the -word()- function.
> 

> The following returns (in addition to the AUC) a 0/1 variable 
> for each candidate variable from the stepwise model which is 
> 1 if the variable is included in the final model and 0 if it isn't:
> 
>  program myboot, rclass
>  sw logit for rep wei len turn, pr(.05)
>  matrix B=e(b)
>  local finvars : colfullnames(B)
>  lroc, nograph
>  return scalar area=r(area)
>  foreach v of varlist rep wei len turn {
>      return scalar `v'=(index("`finvars'","`v'")>0)
>  }
>  end
> 
>  clear
>  sysuse auto
>  sw logit for rep wei len turn, pr(.05)
>  lroc, nograph
>  bootstrap "myboot" r(area) r(rep78) r(weight) r(length) 
> r(turn), reps(5) saving(bootresults) replace
> 
>  clear
>  use bootresults
>  list

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



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