Learn R Programming

kml3d (version 0.7)

generateArtificialLongData: ~ Function: generateArtificialLongData (or gald) ~

Description

This function builp up an artificial longitudinal data set an turn it into an object of class ClusterLongData or LongData.

Usage

gald(nbEachClusters=c(50,50,50),time=0:10,varNames=c("V1","V2"),
    functionClusters=list(function(t){c(0,0)},function(t){c(10,10)},function(t){c(10-t,10-t)}),
    functionNoise=function(t){c(rnorm(1,0,3),rnorm(1,0,3))},
    decimal=2,percentOfMissing=0,clusterLD=TRUE)

generateArtificialLongData(nbEachClusters=c(50,50,50),time=0:10,varNames=c("V1","V2"),
    functionClusters=list(function(t){c(0,0)},function(t){c(10,10)},function(t){c(10-t,10-t)}),
    functionNoise=function(t){c(rnorm(1,0,3),rnorm(1,0,3))},
    decimal=2,percentOfMissing=0,clusterLD=TRUE)

Arguments

nbEachClusters
[vector(numeric)]: number of trajectories that each cluster must contain.
time
[vector(numeric)]: time at which measures are made.
varNames
[vector(character)]: names of the variables.
functionClusters
[vector(numeric) <- function(t)] or [list(vector(numeric <- function(t))]: lists the functions defining the average trajectories of each cluster. The function shall return a value for each variable of varName
functionNoise
[vector(numeric) <- function(t)] or [list(vector(numeric <- function(t))]: lists the functions generating the noise of each trajectory within its own cluster. The function shall return a value for each variable of
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 (see detail).
clusterLD
[logical]: if TRUE, the function create an object ClusterLongData. If FALSE, it create an object LongData.

Value

  • Object of class LongData or ClusterLongData, according to clusterLD.

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

generateArtificialLongData (gald 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 functionClusters. Within a group, the individual undergoes individal variations. Individual variations are given via the argument functionNoise. The number of individuals in each group is given by nbEachClusters. Finally, it is possible to add missing values randomly striking the data thanks to percentOfMissing.

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

Examples

Run this code
### Default example
ex1 <- generateArtificialLongData()
ex1
kml3d(ex1,3,1)
plot3d(ex1)

Run the code above in your browser using DataLab