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   "Nick Cox" <[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 16:56:22 +0100

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/



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