generateArtificialLongData3d: ~ Function: generateArtificialLongData3d (or gald3d) ~

Description Usage Arguments Details Value Author References See Also Examples

Description

This function builp up an artificial longitudinal data set (joint trajectories) an turn them into an object of class ClusterLongData.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
gald3d(nbEachClusters=50,time=0:10,varNames=c("V","T"),
    meanTrajectories=list(function(t){c(0,0)},
       function(t){c(10,10)},function(t){c(10-t,10-t)}),
    personalVariation=function(t){c(rnorm(1,0,2),rnorm(1,0,2))},
    residualVariation=function(t){c(rnorm(1,0,2),rnorm(1,0,2))},
    decimal=2,percentOfMissing=0)

generateArtificialLongData3d(nbEachClusters=50,time=0:10,varNames=c("V","T"),
    meanTrajectories=list(function(t){c(0,0)},
       function(t){c(10,10)},function(t){c(10-t,10-t)}),
    personalVariation=function(t){c(rnorm(1,0,2),rnorm(1,0,2))},
    residualVariation=function(t){c(rnorm(1,0,2),rnorm(1,0,2))},
    decimal=2,percentOfMissing=0)

Arguments

nbEachClusters

[vector(numeric)]: number of trajectories that each cluster must contain. If a single number is given, it is duplicated for all groups.

time

[vector(numeric)]: time at which measures are made.

varNames

[vector(character)]: names of the variables.

meanTrajectories

[list(function)]: lists the functions that define the average trajectories of each cluster. Each functions shall return a vector containing one value for each variable of varNames.

personalVariation

[function] or [list(function)]: lists the functions defining the personnal variation between an individual and the mean trajectories of its cluster. Note that these function should be constant function (the personal variation can not evolve with time). If a single function is given, it is duplicated for all groups (see detail).

residualVariation

[function] or [list(function)]: lists the functions generating the noise of each trajectory within its own cluster. Each functions shall return a vector containing one value for each variable of varNames. If a single function is given, it is duplicated for all groups.

decimal

[numeric]: number of decimals used to round up values.

percentOfMissing

[numeric]: percentage (between 0 and 1) of missing data generated in each cluster. If a single value is given, it is duplicated for all groups. The missing values are Missing Completly At Random (MCAR).

Details

generateArtificialLongData3d (gald3d in short) is a function that contruct a set of artificial joint longitudinal data. Each individual is considered as belonging to a group. This group follows a theoretical trajectory, function of time. These functions (one per group) are given via the argument meanTrajectories.

Within a group, the individual undergoes individal variations. Individual variations are given via the argument residualVariation.

The number of individuals in each group is given by nbEachClusters.

Finally, it is possible to add missing values randomly (MCAR) striking the data thanks to percentOfMissing.

Value

Object of class ClusterLongData.

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

ClusterLongData3d, clusterLongData3d, generateArtificialLongData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#####################
### Default example

ex1 <- generateArtificialLongData3d()
plot3d(ex1,parTraj=parTRAJ(col=rep(2:4,each=50)))


#####################
### 4 lines with unbalanced groups

ex2 <- generateArtificialLongData3d(
  nbEachClusters=c(5,10,20,40),
  meanTrajectories=list(
     function(t)c(t,t^3/100),
     function(t)c(0,t),
     function(t)c(t,t),
     function(t)c(0,t^3/100)
  ),
  residualVariation = function(t){c(rnorm(1,0,1),rnorm(1,0,1))}
)

plot3d(ex2,parTraj=parTRAJ(col=rep(1:4,time=c(5,10,20,40))))

kml3d documentation built on Aug. 8, 2017, 9:09 a.m.