reduceTraj: ~ Function: reduceTraj ~

Description Usage Arguments Details Value Examples

Description

This function 'summerize' a (big) population in a smaller groups of individual, then simplify the trajectories by reducing their number of points. It use reduceNbId and reduceNbTimes. Main difference with these two function, its applies on a Clds object.

Usage

1
2
reduceTraj(myClds, nbSenators = NA, nbTimes = NA, spar = 0.5,
   imputationMethod = "linearInterpol")

Arguments

myClds

[Clds]: object holding the trajectories that should be simplified.

nbSenators

[integer] number of trajectories that will be use to represent the population (i.e., number of clusters used by k-means).

nbTimes

[numeric]: fixe the number of that the simplified trajectories should have.

spar

[numeric]: smoothing parameter that is used if the trajectories shall be smoothed before being simplified.

imputationMethod

[character]: Method that will be used to impute the missing values.

Details

This function 'summerize' a (big) population in a smaller groups of individual, then simplify the trajectories by reducing their number of points. If 'nbSenators' is not NA, then reduceNbId is called. If 'nbTimes' is not NA, then reduceNbTimes is called. Note that 'nbSenators' and 'nbTimes' should not be both missing.

If both are non-missing, reduceNbId is called first. The results is store in the field 'senators' of the Clds object.

Value

A Clds object in which the fields 'senators', 'mySenators' and 'senatorsWeight' are now filled.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
### Generating artificial data
nbLignes <- 200
trajG <- matrix(0,nbLignes,51)
for(i in 1:(nbLignes/2)){
   trajG[i,] <- dnorm(0:50,runif(1,15,35),5)*rnorm(1,10,0.1)
}
for(i in (nbLignes/2+1):nbLignes){
   trajG[i,] <- dnorm(0:50,runif(1,15,35),5)*rnorm(1,5,0.1)
}
myClds <- cldsWide(data.frame(1:200,trajG))
plot(myClds)

### Reducing the number of time measurement
reduceTraj(myClds,nbTimes=7)
plotSenators(myClds)

### Reducing the number of individual
reduceTraj(myClds,nbSenators=32)
plotSenators(myClds)

### Reducing both
reduceTraj(myClds,nbSenators=32,nbTimes=7)
plotSenators(myClds)

Example output

Loading required package: class
Loading required package: longitudinalData
Loading required package: clv
Loading required package: cluster
Loading required package: rgl
Loading required package: misc3d
Loading required package: kml
Loading required package: lattice

Attaching package: 'kmlShape'

The following object is masked from 'package:longitudinalData':

    distFrechet

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 

kmlShape documentation built on May 1, 2019, 7:50 p.m.