-------------------------------------------------------------------------------
help for evhistplot
-------------------------------------------------------------------------------

Plot individual event histories with one or two time scales (Lexis diagram)

evhistplot event_varlist [if] [in] , id(varname) start(date_string) end(date_string) [evtype(varname) birth(varname) nsub(integer 100) agescale(real 365.25) scatter options]

Description

evhistplot plots individual event histories with different event types indicated by differently colored dots resulting in one string of beads for each individual. Different event types may reside in different variables in event_varlist, or they may be identified in the evtype(typevar) option.

When birth(varname) is not specified, the individual histories are given as horizontal lines with calendar time on the X-axis. When birth(varname) is specified, the individual histories are plotted in a Lexis diagram with calendar time on the X-axis and age on the Y-axis.

Options

id(varname[, plot]) specifies the variable holding the identifier of each individual. If the option plot is given, then the original ID numbers are used on the Y-axis for identifying individuals in plots with horizontal lines. If the plot option is omitted, then the n individuals in the plot are associated with random integers 1,...,n.

start(date_string) specifies the starting time of the observation window. The date must be specified in the format of the d(l) function, cf. the help for d(). All events before this date are omitted from the plot.

end(date_string) specifies the end time of the observation window. The date must be specified in the format of the d(l) function, cf. the help for d(). All events after this date are omitted from the plot.

evtype(varname) is optional and specifies a variable holding the type of event recorded in the variable given as main argument. If more variables are given in varlist, then the event types refer to the first variable only of varlist. The remaining variables of varlist then each holds a unique type of events.

birth(varname) is optional and specifies a variable holding birth dates of individuals. If specified, a Lexis diagram is plotted with calendar time on the X-axis and age on the Y-axis.

nsub(integer) is optional and limits the number of individuals included in the plot to the specified count. Subjects are chosen at random for inclusion in the graph. If not specified, all subjects are included.

agescale(real) is optional and indicates the scale on the age axis of the Lexis diagram, ie. the Y-axis. Requires specification of birth( varname) to have effect. The default value corresponds to age in years, when variables hold date values.

scatter_options are optional and allow fine tuning of the resulting plot. In particular, the msize and msymbol options are useful for modifying the size and shape of markers used.

Examples

Consider a dataset where the variable recdate holds dispensing dates for medications for a group of patients identified by a unique key in the variable patid. Dates of birth and death are held in variables with obvious names.

. evhistplot recdate birthdate deathdate, id(patid) start(1jan1993) end(31dec2000) (births and deaths are only plotted for those born in the observation window)

. evhistplot recdate birthdate deathdate, id(patid) start(1jan1993) end(31dec2000) evtype(medictype) (different medications are plotted in different colors)

. evhistplot recdate deathdate, id(patid) start(1jan1993) end(31dec2000) evtype(medictype) birth(birthdate) (makes a Lexis-diagram)

The ancillary file -rrdat1_plot.do- shows how the commands can be used to plot individual event histories with respect to jobs and marriage.

Author

Henrik Stovring (hstovring@health.sdu.dk), Research Unit for General Practice, University of Southern Denmark, Denmark.

Also see

Online: help for twoway, scatter