*!1.0.0 Brent Mcsharry brent@focused-light.net 14Jan2014
help rasprt

Title

raewma -- Plot a Risk adjusted exponentially weighted moving average chart

Syntax

rasprt

[if] [in]
,

[options]

Options
SMooth(#) The smoothing parameter (denoted by lambda). Default 0.01

Alpha1(#) First threshold line. Default 0.05

Alpha2(#) Second threshold line. Default 0.01

XLABEL(rule_or_values) major ticks plus labels

YTITLE(axis_title) see axis_title_options

YLABEL(rule_or_values) major ticks plus labels. see axis_label_options

LEGEND([contents] [location]) see legend_option

RESolution(#) The point at which the exponential weighting is rounded down to 0. Default 0.0000125

Description

raewma plots a smothed, risk adjusted eqponentially weighted moving average over sequential records.

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.

STartest The y value to begin the plot - A guess at the (unadjusted) proportion of outcomes expected, seen previously or seen elsewhere. See examples.

Main

Options

SMooth The smoothing parameter. Cook, Duke and Hart suggest: "Our experience with RA monitoring in intensive care is that a choice of [a smoothing parameter] between 0.005 and 0.020 is needed so the distributions of the observed and predicted EWMA plots are comparable"[1].

RESolution
This should rarely need to be changed.
Older observations receive exponentially less weight. In order to minimise computational expense in larger data sets, much earlier observations have a weighting of 0 applied.
The value entered assumes a constant predicted outcome for each case, and represents the inverse of the total number of pixels or dots required to create a noticable deflection.
For instance, the default value of 0.0000125 has been chosen as this is roughly the resolution of 1 dot on a 2400 DPI printer at A1 size (33.1 inches high in landscape).
Assign a value of 0 to calculate the exponential weighting for all values in the dataset.

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

note: Assuming that the published unadjusted mortality for a person with a cancer of this type is around 35%

. raewma died study_entry_sequence, pr(predicted_death) start(0.35)

. raewma died study_entry_sequence, pr(xs_pred_death) start(0.35)

Also see

[1] Aticle: BMJ Qual Saf 2011 20: 469-474
Exponentially weighted moving average charts to compare observed and expected values for monitoring risk-adjusted hospital indicators

[2] Aticle: 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