ClusterLongData-class | R Documentation |
ClusterLongData
is an object containing trajectories and associated
Partition
(from package LongitudinalData).
kml
is an algorithm that builds a set of
Partition
from longitudinal data. ClusterLongData
is the object containing the original longitudinal data
and all the Partition
that kml
finds.
When created, an ClusterLongData
object simply contains initial
data (the trajectories). After the execution of kml
, it
contains
the original data and the Partition
which has just been calculated by kml
.
Note that if kml
is executed several times, every new Partition
is added to the original ones, no pre-existing Partition
is erased.
idAll
[vector(character)]
: Single identifier
for each of the trajectory (each individual). Usefull for exporting clusters.
idFewNA
[vector(character)]
: Restriction of
idAll
to the trajectories that does not have 'too many' missing
value. See maxNA
for details.
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
[vector2(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 restaure the original data after a
scaling operation.
criterionActif
[character]: Store the criterion name that will be used by functions that need a single criterion (like plotCriterion or ordered).
initializationMethod
[vector(chararcter)]: list all
the initialization method that has already been used to find some
Partition
(usefull to not run several time a deterministic method).
sorted
[logical]
: are the Partition
curently hold in the object sorted in decreasing order ?
c1
[list(Partition)]: list of
Partition
with 1 clusters.
c2
[list(Partition)]: list of
Partition
with 2 clusters.
c3
[list(Partition)]: list of
Partition
with 3 clusters.
...
c26
[list(Partition)]: list of
Partition
with 26 clusters.
Class LongData
, directly.
Class ListPartition
, directly.
Class ClusterizLongData
objects can be constructed via function
clusterLongData
that turn a data.frame
or a matrix
into a ClusterLongData
. Note that some artificial data can be
generated using gald
.
object['xxx']
Get the value of the field
xxx
. Inherit from LongData
and ListPartition
.
object['xxx']<-value
Set the field xxx
to value
.
xxx
. Inherit from class ListPartition
.
plot
Display the
ClusterLongData
according to a class Partition
.
Special thanks to Boris Hejblum for debugging the '[' and '[<-' operators (the previous version was not compatible with the matrix package, which is used by lme4).
Overview: kml-package
Classes :
classes Partition, LongData, ListPartition
Methods : clusterLongData
, kml
, choice
Plot : plot(ClusterLongData)
,
plotCriterion
### Move to tempdir
wd <- getwd()
setwd(tempdir()); getwd()
################
### Creation of some trajectories
traj <- matrix(c(1,2,3,1,4, 3,6,1,8,10, 1,2,1,3,2, 4,2,5,6,3, 4,3,4,4,4, 7,6,5,5,4),6)
myCld <- clusterLongData(
traj=traj,
idAll=as.character(c(100,102,103,109,115,123)),
time=c(1,2,4,8,15),
varNames="P",
maxNA=3
)
################
### get and set
myCld["idAll"]
myCld["varNames"]
myCld["traj"]
################
### Creation of a Partition
part2 <- partition(clusters=rep(1:2,3),myCld)
part3 <- partition(clusters=rep(1:3,2),myCld)
################
### Adding a clusterization to a clusterizLongData
myCld["add"] <- part2
myCld["add"] <- part3
myCld
### Go back to current dir
setwd(wd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.