*!1.0.0 Brent Mcsharry brent@focused-light.net 6Mar2011
help boxpanel

Title

boxpanel -- Box plots for panel data

Syntax

boxpanel

[if] [in]
[, options]

Main
trackby(varname) track outliers by the specified variable.

joinmedian draw a line detween the median values.

barw(#) specify the width of the box plot.

legendcols specify the number of columns in the legend describing outliers. Only relevant if a trackby variable is specified.

Description

boxpanel creates a boxplot where the x variable represents a scalar time variable
(each distinct value grouping each set of observations), such that the spacing between
box plots relates to the time interval between each panel.

Options

Main

trackby. By specifying the subject id, outliers representing the same individual will
have the same color scheme. When a subject remains an outlier over sequential time points,
a line will connect the markers for that particular subject.

joinmedian Plot a line joining the median values over time.

barw The width of the box. If ommitted, will be 50% of the minimum distance between
time categories.

legendcols The number of colums to use when displaying the legend of outliers. Only relevant if a trackby variable is specified, otherwise no legend is displayed. Default value is 1.

Remarks

This command is designed to visually assess trends in the distribution of panel data over time.
In contrast to the graph box command, the time variable (xvar), while denoting distinct sets of observations (according to time post enrollment), is also assumed
to be scaled. This is particularly useful for assesing trends when panels of observations have been collected more intensively at certain times, such as when entering
a study, or after a point of treatment crossover.

Used with the trackby option, subjects with observations which are persistently outlying can be tracked over time.

Authors

Brent McSharry, Starship Children's Hospital, Auckland New Zealand

brentm@adhb.govt.nz

Acknowledgment

the code borrows heavily from an article written by Nicholas J. Cox in the Stata Journal, along with a correction by Sheena Sullivan, published in statalist (See below).

Examples

Setup

webuse epilepsy

replace visit=1 if abs(visit-.3) < 0.0001

Plot

boxpanel seizures visit if treat, track(subject)

Also see

[G] graph_box

Article: Stata Journal, volume 9, number 3: gr0039

Article: Stata List, Subject: calculating the whiskers on a boxplot using -twoway- msg00917