LongData-class: ~ Class: LongData ~

Description Objects from the Class Slots Construction Get [ Methods Author References See Also Examples

Description

LongData is an objet containing the longitudinal data (the individual trajectories) and some associate value (like time, individual identifiant,...). It can be used either for a single variable-trajectory or for joint variable-trajectories.

Objects from the Class

Object LongData for single variable-trajectory can be created using the fonction longData on a data.frame or on a matrix.

LongData for joint trajectories can be created by calling the fonction longData3d on a data.frame or on an array.

Slots

idAll

[vector(character)]: Single identifier for each of the longData (each individual). Usefull to export clusters.

idFewNA

[vector(character)]: Restriction of idAll to the trajectories that does not have 'too many' missing value. See maxNA for 'too many' definition.

time

[numeric]: Time at which measures are made.

varNames

[character]: Name of the variable measured.

traj

[matrix(numeric)]: Contains the longitudianl data. Each lines is the trajectories of an individual. Each column is the time at which measures are made.

dimTraj

[vector3(numeric)]: size of the matrix traj (ie dimTraj=c(length(idFewNA),length(time))).

maxNA

[numeric] or [vector(numeric)]: Individual whose trajectories contain 'too many' missing value are exclude from traj and will no be use in the analysis. Their identifier is preserved in idAll but not in idFewNA. 'too many' is define by maxNA: a trajectory with more missing than maxNA is exclude.

reverse

[matrix(numeric)]: if the trajectories are scale using the function scale, the 'scaling parameters' (probably mean and standard deviation) are saved in reverse. This is usefull to restore the original data after a scaling operation.

Construction

Object LongData for single variable-trajectory can be created by calling the fonction longData on a data.frame or on a matrix.

LongData for joint trajectories can be created by calling the fonction longData3d on a data.frame or on an array.

Get [

Object["idAll"]

[vecteur(character)]: Gets the full list of individual identifiant (the value of the slot idAll)

Object["idFewNA"]

[vecteur(character)]: Gets the list of individual identifiant with not too many missing values (the value of the slot idFewNA)

Object["varNames"]

[character]: Gets the name(s) of the variable (the value of the slot varNames)

Object["time"]

[vecteur(numeric)]: Gets the times (the value of the slot time)

Object["traj"]

[array(numeric)]: Gets all the longData' values (the value of the slot traj)

Object["dimTraj"]

[vector3(numeric)]: Gets the dimension of traj.

Object["nbIdFewNA"]

[numeric]: Gets the first dimension of traj (ie the number of individual include in the analysis).

Object["nbTime"]

[numeric]: Gets the second dimension of traj (ie the number of time measurement).

Object["nbVar"]

[numeric]: Gets the third dimension of traj (ie the number of variables).

Object["maxNA"]

[vecteur(numeric)]: Gets maxNA.

Object["reverse"]

[matrix(numeric)]: Gets the matrix of the scaling parameters.

Methods

scale

scale the trajectories. Usefull to normalize variable trajectories measured with different units.

restoreRealData

restore original data that have been modified after a scaling operation.

longDataFrom3d

Extract a variable trajectory form a dataset of joint trajectories.

plotTrajMeans

plot all the variables of the LongData, optionnaly according to a Partition.

plotTrajMeans3d

plot two variables of the LongData in 3 dimensions, optionnaly according to a Partition.

plot3dPdf

create 'Triangle objects' representing in 3D the cluster's center according to a Partition. 'Triangle object' can latter be include in a LaTeX file to get a dynamique (rotationg) pdf figure.

imputation

Impute the missing values of the trajectories.

qualityCriterion

Compute some quality criterion that can be use to compare the quality of differents Partition.

Author

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

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

Overview: longitudinalData-package
Methods: longData, longData3d, imputation, qualityCriterion
Plot: plotTrajMeans, plotTrajMeans3d, plot3dPdf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#################
### building trajectory (longData)
mat <- matrix(c(NA,2,3,4,1,6,2,5,1,3,8,10),4)
ld <- longData(mat,idAll=c("I1","I2","I3","I4"),time=c(2,4,8),varNames="Age")

### '[' and '[<-'
ld["idAll"]
ld["idFewNA"]
ld["varNames"]
ld["traj"]
(ld)

### Plot
plotTrajMeans(ld,parMean=parMEAN(type="n"))

Example output

Loading required package: clv
Loading required package: cluster
Loading required package: class
Loading required package: rgl
Loading required package: misc3d
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
[1] "I1" "I2" "I3" "I4"
[1] "I1" "I2" "I3" "I4"
[1] "Age"
   t2 t4 t8
I1 NA  1  1
I2  2  6  3
I3  3  2  8
I4  4  5 10

   ~~~ Class: LongData ~~~
~ idAll       = [4] I1 I2 I3 I4
~ idFewNA     = [4] I1 I2 I3 I4
~ varNames    = [1] Age
~ time        = [3] 2 4 8
~ maxNA       = [1] 1
~ reverse     = [2x1]
    - mean    = 0
    - SD      = 1

~ traj = [4x3] (limited to 5x10)  :
   t2 t4 t8
I1 NA  1  1
I2  2  6  3
I3  3  2  8
I4  4  5 10

longitudinalData documentation built on May 2, 2019, 8:53 a.m.