Plot of longitudinal data {MXM} | R Documentation |
Plot of longitudinal data
Description
Plot of longitudinal data.
Usage
tc.plot(target, tp, id, type = "l", ylab = "Values", xlab = "Time points",
col = 2, lwd = 1, lty = 2, pch = 1, main = "Spaghetti plot")
Arguments
target |
A numerical vector with the longitudinal data. |
tp |
The time points. It can either be a vector with length either equal to the number of time points or equal to the legnth of the target. |
id |
A numerical vector specifying the subjects. It can either be a vector with length either equal to the number of subjects or equal to the legnth of the target. |
type |
This is a graphical parameter. You can have lines "l" everywhere or lines with points at each time point "p". |
ylab |
This is a graphical parameter. The label on the y axis. |
xlab |
This is a graphical parameter. The label on the x axis. |
col |
This is a graphical parameter. The color of the lines. |
lwd |
This is a graphical parameter. The thickness of the lines. |
lty |
This is a graphical parameter. The type of line, e.g. dashed, dotted, etc. |
pch |
This is a graphical parameter. If the type is "b", then you can specify if you want different signs, for example circles, crosses, diamonds etc. |
main |
This is a graphical parameter. The title of the graph. |
Details
The data must be longitudinal (the same subject measured multiple times at different time points) and for one variable only. For the graphical parameters see plot
or par
.
Value
A plot with the longitudinal data over time.
Author(s)
Michail Tsagris
R implementation and documentation: Giorgos Athineou <athineou@csd.uoc.gr> Michail Tsagris mtsagris@uoc.gr
References
Tsamardinos I., Aliferis C. F. and Statnikov, A. (2003). Time and sample efficient discovery of Markov blankets and direct causal relations. In Proceedings of the 9th ACM SIGKDD international conference on Knowledge discovery and data mining (pp. 673-678).
See Also
Examples
y <- rnorm(70)
Days <- rep(1:7, each = 10)
id <- rep(1:10, 7)
tc.plot(y, Days, id)
tc.plot(y, Days, id, type = "b")