Learn R Programming

longitudinalData (version 2.0)

plot,LongData: ~ function: plot 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':
plot(x,y,parTraj=parTRAJ(),parMean=parMEAN(),parWin=windowsCut(x['nbVar'],addLegend=TRUE),nbSample=1000)
## S3 method for class 'LongData3d,Partition':
plot(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.

Author

Christophe Genolini 1. UMR U1027, INSERM, Universit� Paul Sabatier / Toulouse III / France 2. CeRSME, 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, plot3d.

Examples

Run this code
##################
### Construction of the data

ld <- gald3d()
part <- partition(rep(1:3,each=50))

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

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


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

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

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

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

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


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

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

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

ld2 <- gald()
part2 <- partition(rep(1:4,each=50))
plot(ld2)
plot(ld2,part2)

Run the code above in your browser using DataLab