Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: more informative cusums
From 
 
"Brent McSharry" <[email protected]> 
To 
 
"Statalist" <[email protected]> 
Subject 
 
st: more informative cusums 
Date 
 
Mon, 7 Mar 2011 17:45:37 +1300 
I am trying to write 2 ADO files to assist in graphical representation of 
the performance of intensive care unit survival over time, and would be 
grateful for help.
a) The first ADO file is to graph the variable life adjusted display (VLAD), 
which is basically the same as the cusum command with the yfit option, but 
also displaying the tails of the distribution (referred to as `rocket tails' 
in some medical literature). I am calculating these tails according to the 
Bernoulli distribution, i.e. if p = calculated probability of death per 
patient:
variance = sum(p*(1-p))
tail = sum(p) - sum(died) +/- (z*sqrt(variance))
The problem here is that the tails of distribution are very "jagged" on the 
graph (as the VLAD or cusum jumps up and down), as opposed to literature I 
have seen. An example is free to download from 
http://ejcts.ctsnetjournals.org/cgi/reprint/26/5/1032?ijkey=507e13cc57ccc4c782a4e7928bf08df3c6fd5a51 
(top of page 1034).
Is there a problem with my logic? Is there a Stata command to apply a smooth 
of some kind to each calculated tail (to be plotted against case number), 
bearing in mind some data sets will have 20 000 + cases, and so any smooth 
must be computationally efficient, as well as statistically valid (well, 
valid-ish, as I guess any running total plotted against probability 
distributions has the potential to be misinterpreted).
b) The second ADO file is to graph risk adjusted sequential probability 
ratio tests. Medical applications of this graphical method were described by 
Speigelhalter et al. and is a free download here:
http://intqhc.oxfordjournals.org/content/15/1/7.full.pdf
The commands are:
qui gen `si' = (ln(`or')* `depvar')  - ln(1 + `yfit')
qui gen `Ticum' = sum(`si')
where Ticum = cumulative log likelihood ratio
yfit = calculated probability of death per patient
or = odds ratio
The problem here is that whatever data or model I graph, the line heads 
quickly downward, invariably crossing the lower threshold for rejecting the 
alternative hypothesis almost immediately.
I have also tried (with the same results):
gen `si' = ln(1-`yfit'+ (`or' * `yfit')) / ln(`or')
gen `Ticum' = sum(`si')
qui replace `Ticum' = `Ticum'[_n-1] + (`depvar' - `si') in 2/l
What is the problem with my logic in these 2 pieces of Stata code?
Thank you very much for all your expertise and time.
Brent McSharry
Starship Children's Hospital
Auckland 
*
*   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/