*!1.1.1 Brent Mcsharry brent@focused-light.net 11dec2015
help rasprt

Title

rasprt -- Plot a Risk adjusted sequential probability ratio test chart +/- Risk Adjusted Cumulative Sum chart (CUSUM)

Syntax

rasprt

[if] [in]
,
[options]

Options
OR(#) the odds ratio for the alternative hypothesis. Default is 2

A1(#) alpha1 - upper outer threshold line. Default is 0.01

A2(#) alpha2 - upper inner threshold line. Default is 0.05

B1(#) beta1 - lower outer threshold line. Default is 0.01

B2(#) beta2 - lower inner threshold line. Default is 0.05

noSPRT do not display the sequential probability ratio (displays only the cusum)

noCUSUM do not display risk adjusted CUSUM.

noRESET do not reset the plot to 0 when the outer threshold is crossed.

HEADstart(#) point for CUSUM to reset to as a proportion of upper threshold. Default 0

XLABEL(rule_or_values) major ticks plus labels. see axis_label_options

TITLE(tinfo) overall title. see title_options

NOTE(tinfo) note about graph. see title_options

SUBtitle(tinfo) subtitle. see title_options

XTitle(tinfo) X axis title. see axis_options

XAXis(tinfo) which axis, 1 < # < 9. see axis_choice_options

Description

rasprt Plots the cumulative-log likelihood over sequential observations.

outcomevar The actual outcome being benchmarked. Must be binary.

sequencevar A variable denoting in what order each subject has entered the analysis.

Predicted The predicted value for the outcome under investigation.

Options

Main

noCUSUM A Risk Adjusted Cumulative Sum imposes a lower absorbing barier at the zero line.

noRESET continue the plot outside the outer threshold line, rather than reset to 0.

HEADstart(#) point for CUSUM to reset to as a proportion of upper threshold. Default 0.
This is for creating fast initial response (FIR) CUSUM graphs. Must be a value between 0 and 1.

Authors

Brent McSharry, Starship Children's Hospital, Auckland New Zealand -
brentm@adhb.govt.nz

Examples

Setup

. webuse cancer

. gen int study_entry_sequence=_n

assuming co-efficients from a (fictional) validated benchmarking model - intercept -3.6, age 0.12 per year, coeficient for drug2 -3.5 and drug 3 -3.2

. gen double predicted_death=invlogit(-3.6+ 0.12*age -3.5*(drug==2) -3.2*(drug==3))

Creating another fictional benchmarking model - in this case more outcomes are occuring than would be predicted

. gen double xs_pred_death=invlogit(-5.6+ 0.12*age -5*(drug==2) -3.2*(drug==3))

Plot

. rasprt died study_entry_sequence, pr(predicted_death)

. rasprt died study_entry_sequence, pr(predicted_death) nocusum

. rasprt died study_entry_sequence, pr(predicted_death) nosprt

. rasprt died study_entry_sequence, pr(xs_pred_death)

. rasprt died study_entry_sequence, pr(xs_pred_death) noreset

Working with dates - involves installing mydatelabels

. gen study_entry_date = td(#1jan2010#) in 1

. replace study_entry_date = study_entry_date[_n-1] + (runiform()*20) in 2/l

divide the year into quarters, and label the first case in each quarter

. mydatelabels study_entry_sequence =ceil(month( study_entry_date )/3),local(mymac) start format(%tdMon_'YY)

. rasprt died study_entry_sequence, pr(p) xlabel(`mymac', axis(2)) xaxis(1 2)

Also see

Stata: findit tabcusum command to graph O-E (VLAD) type CUSUM vertically aligned with tabular (SPRT) CUSUM

Article: International Journal for Quality in Health Care 2003; Volume 15, Number 1: pp. 7–13
Risk-adjusted sequential probability ratio tests and longitudinal surveillance methods

Article: Critical Care and Resuscitation 2008; Volume 10, Number 3: pp. 239-251
Review of the application of risk-adjusted charts to analyse mortality outcomes in critical care

Program: CusumARL is a free, open source (MIT license) console application for calculating average run lengths.
ARL0 is the expected number of observations taken from an in-control process until the control chart falsely signals.
ARL1 is the expected number of observations taken from an out-of-control process until the control chart correctly signals.
CusumARL is written by the author of RASPRT in C++ rather than Stata for reasons of performance over millions of Monte Carlo iterations.
Binaries have not been compiled for Mac or Linux - feel free to contact the author if you would like these binaries, or more features.

Change log

0.2.0

Graph commences at 0 rather than first cumulative observation.

Graph line stops after exceeding threshold (instead of circle).

headstart, note and title options introduced.