Learn R Programming

longitudinalData (version 2.1.2)

plotTraj,LongData: ~ Function: plotTraj for LongData or LongData3d~

Description

Plot the LongData or LongData3d optionnaly relatively to a Partition. For joint trajectories, one graphe for each variable trajectory is displayed.

Usage

## S3 method for class 'LongData,Partition':
plotTraj(x,y,parTraj=parTRAJ(),parMean=parMEAN(),parWin=windowsCut(x['nbVar'],addLegend=TRUE),nbSample=1000,...)
## S3 method for class 'LongData3d,Partition':
plotTraj(x,y,parTraj=parTRAJ(),parMean=parMEAN(),parWin=windowsCut(x['nbVar'],addLegend=TRUE),nbSample=1000,...)

Arguments

x
[LongData] or [LongData3d]: Object containing the trajectories to plot.
y
[numeric]: Partition that will be use to plot the object. If y is missing, a Partition with a single cluster is considered.
parTraj
[ParLongData]: Set the graphical parameters used to plot the trajectories. See ParLongData and examples for details.
parMean
[ParLongData]: Set the graphical parameters used to plot the mean trajectories of each clusters (only when y is non missing). See ParLongData and examples for details.
parWin
[ParWindows]: Set the graphical display of the windows. See ParWindows for details.
nbSample
[numeric]: Graphical display of huge sample can be time consumming. This parameters fixe the maximum number of trajectories (randomly chosen) that will be drawn.
...
Arguments to be passed to methods, such as graphical parameters.

Author

Christophe Genolini 1. UMR U1027, INSERM, Universit� Paul Sabatier / Toulouse III / France 2. CeRSM, EA 2931, UFR STAPS, Universit� de Paris Ouest-Nanterre-La D�fense / Nanterre / France

Details

Plot either a LongData, or each variable of a LongData3d optionnaly according to the Partition define by y. Graphical option concerning the individual trajectory (col, type, pch and xlab) can be change using parTraj. Graphical option concerning the cluster mean trajectory (col, type, pch, pchPeriod and cex) can be change using parMean. For more detail on parTraj and parMean, see object of class ParLongData.

References

[1] C. Genolini and B. Falissard "KmL: k-means for longitudinal data" Computational Statistics, vol 25(2), pp 317-328, 2010 [2] C. Genolini and B. Falissard "KmL: A package to cluster longitudinal data" Computer Methods and Programs in Biomedicine, 104, pp e112-121, 2011

See Also

LongData, LongData3d, plotTraj3d.

Examples

Run this code
##################
### Construction of the data
data(artificialJointLongData)
ld <- longData3d(artificialJointLongData,timeInData=list(var1=2:12,var2=13:23))
part <- partition(rep(1:3,each=50))

### Basic plotting
plotTraj(ld)
plotTraj(ld,part)

### Change the windows orientation
plotTraj(ld,parWin=windowsCut(c(1,2),addLegend=FALSE))


##################
### Changing graphical parameters 'par'

### No letters on the mean trajectories
plotTraj(ld,part,parMean=parMEAN(type="l"))

### Only one letter on the mean trajectories
plotTraj(ld,part,parMean=parMEAN(pchPeriod=Inf))

### Color individual according to its clusters (col="clusters")
plotTraj(ld,part,parTraj=parTRAJ(col="clusters"))

### Mean without individual
plotTraj(ld,part,parTraj=parTRAJ(type="n"))


### No mean trajectories (type="n")
### Color individual according to its clusters (col="clusters")
plotTraj(ld,part,parTraj=parTRAJ(col="clusters"),parMean=parMEAN(type="n"))

### Only few trajectories
plotTraj(ld,part,nbSample=10,parTraj=parTRAJ(col='clusters'),parMean=parMEAN(type="n"))


##################
### single variable trajectory

data(artificialLongData)
ld2 <- longData(artificialLongData)
part2 <- partition(rep(1:4,each=50))
plotTraj(ld2)
plotTraj(ld2,part2)

Run the code above in your browser using DataLab