Learn R Programming

kml3d (version 0.6)

plot,LongData: ~ Function: plot for LongData ~

Description

plot the a LongData object, optionnaly relatively to a Partition.

Usage

## S3 method for class 'LongData,missing':
plot(x,paramTraj=parTraj(),paramWindows=windowsCut(x['nbVar'],addLegend=FALSE),nbSample=200)
## S3 method for class 'LongData,Partition':
plot(x,y,paramTraj=parTraj(),paramMean=parMean(),paramWindows=windowsCut(x['nbVar']),nbSample=200)

Arguments

x
[LongData]: Object containing the trajectories to plot.
y
[Partition]: Partition defining clusters.
paramTraj
[parLongData]: Set the graphical parameters used to plot the trajectories of the LongData. See ParLongData for details.
paramMean
[parLongData]: Set the graphical parameters used to plot the mean trajectories of each clusters LongData (only when y is non missing). See ParLongData for detail
paramWindows
[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 numbre of trajectories (randomly chosen) that will be drawn.

Author(s)

Christophe Genolini INSERM U669 / PSIGIAM: Paris Sud Innovation Group in Adolescent Mental Health Modal'X / Universite Paris Ouest-Nanterre- La Defense Contact author : genolini@u-paris10.fr

Details

plot each variable of a LongData.

References

Article "KmL: K-means for Longitudinal Data", in Computational Statistics, Volume 25, Issue 2 (2010), Page 317. Web site: http://christophe.genolini.free.fr/kml

See Also

LongData

Examples

Run this code
##################
### Real example on array

time=c(1,2,3,4,8,12,16,20)
id3=1:12000
f <- function(id,t)((id-1)%%3-1) * t
g <- function(id,t)(id%%2+1)*t
ld3 <- as.longData(array(cbind(outer(id3,time,f),outer(id3,time,g))+rnorm(12000*8*2,0,3),dim=c(12000,8,2)))
par(ask=TRUE)

### Basic plot
plot(ld3)

### Change the windows orientation
plot(ld3,paramWindows=windowsCut(c(2,1)))

### Change some parameters
plot(ld3,paramTraj=parTraj(col="red"))

### Plot only 1000 trajectories
plot(ld3,nbSample=1000)

### Plot all the trajectories
plot(ld3,nbSample=Inf)
par(ask=FALSE)

Run the code above in your browser using DataLab