Follow-up Plot {epicalc} | R Documentation |
Plot longitudinal values of individuals with or without stratification
followup.plot(id, time, outcome, by = NULL, n.of.lines = NULL, legend = TRUE, line.col = "blue", stress = NULL, stress.labels = FALSE, label.col = 1, stress.col = NULL, stress.width = NULL, stress.type=NULL, ...)
id |
idenfication variable of the same subject being followed up |
time |
time at each measurement |
outcome |
continuous outcome variable |
by |
stratification factor if any |
n.of.lines |
number of lines (or number of subjects in the data frame) randomly chosen for drawing |
legend |
whether a legend will be automatically included in the graph |
line.col |
line color(s) for non-stratified plot |
stress |
subset of ids to draw stressed lines |
stress.labels |
whether the stressed lines would be labelled |
label.col |
single integer indicating color of the stressed line labels |
stress.col |
color values used for the stressed line. Default value is '1' or black |
stress.width |
relative width of the stressed line |
stress.type |
line type code for the stressed line |
... |
other graphic parameters |
'followup.plot' plots outcome over time of the individual subjects.
If a stratification variable 'by' is specified, the levels of this variable will be used to color the lines.
'n.of.lines' is used to reduce the number of lines to allow the pattern to be seen more clearly.
'legend' is omitted if 'n.of.lines' is not NULL or the number of subjects exceeds 7 without stratification.
'line.col' works only for non-stratified plot. It can be a single standard color or "multicolor".
Values for 'stress.col', 'stress.width' and 'stress.type', if not NULL, should follow those for 'col', 'lwd' and 'lty', respectively
Virasakdi Chongsuvivatwong <cvirasak@medicine.psu.ac.th>
'plot','lines'
use(Indometh) followup.plot(Subject, time, conc) library(MASS) use(Sitka) followup.plot(tree, Time, size) followup.plot(tree, Time, size, line.col = "brown") followup.plot(tree, Time, size, line.col = "multicolor") followup.plot(tree, Time, size, n.of.lines=20, line.col = "multicolor") # Breakdown of color by treatment group followup.plot(tree, Time, size, by=treat) # The number lines reduced to 40 followup.plot(tree, Time, size, by=treat, n.of.lines=40) # Stress some lines length(table(tree)) # 79 trees followed up # Identifying trees that sometimes became smaller sortBy(tree, Time) next.tree <- c(tree[-1], NA) next.size <- c(size[-1], NA) next.size[tree != next.tree] <- NA pack() smaller.trees <- tree[next.size < size] followup.plot (tree, Time, size, line.col=5, stress=smaller.trees, stress.col=2, stress.width=2, stress.type=2) followup.plot (tree, Time, size, line.col=5, stress=smaller.trees, stress.col=2, stress.width=2, stress.type=2, stress.labels=TRUE)