Learn R Programming

kml3d (version 0.7)

plot3d,ClusterLongData: ~ Function: plot3d for ClusterLongData ~

Description

Plot two variables of a ClusterLongData object in 3D, optionnaly relatively to a Partition.

Usage

## S3 method for class 'ClusterLongData,missing':
plot3d(x,y,varY=1,varZ=2,paramTraj=parTraj(),paramMean=parMean(),nbSample=200)
## S3 method for class 'ClusterLongData,numeric':
plot3d(x,y,varY=1,varZ=2,paramTraj=parTraj(type="n"),paramMean=parMean(),nbSample=200)

Arguments

x
[ClusterLongData]: Object containing the trajectories to plot.
y
[numeric]: Define Partition P that will be use to plot the object. P is a Partition hold in the field c2, c3, ... c26. If y=c(a,b), then
varY
[numeric] or [character]: either the number or the name of the first variable to display. 1 by default.
varZ
[numeric] or [character]: either the number or the name of the second variable to display. 2 by default.
paramTraj
[parClusterLongData]: Set the graphical parameters used to plot the trajectories of the ClusterLongData. See ParLongData for details.
paramMean
[parClusterLongData]: Set the graphical parameters used to plot the mean trajectories of each clusters ClusterLongData (only when y is non missing). See ParLongData
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 two variables of a ClusterLongData object in 3D. It use the rgl library. The user can make the graphical representation turn using the mouse.

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

ClusterLongData

Examples

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

time=c(1,2,3,4,8,12,16,20)
id2=1:120
f <- function(id,t)((id-1)%%3-1) * t
g <- function(id,t)(id%%2+1)*t
h <- function(id,t)(id%%4-0.5)*(20-t)
ld4 <- as.longData(array(cbind(outer(id2,time,f),outer(id2,time,g),outer(id2,time,h))+rnorm(120*8*3,0,3),dim=c(120,8,3)))

### Basic plot
plot(ld4)

### plot3d, variable 1 and 2
plot3d(ld4)

### plot3d, variable 1 and 3
plot3d(ld4,varZ=3)
plot3d(ld4,paramTraj=parTraj(col="red"))

Run the code above in your browser using DataLab