Description Usage Arguments Details Value Examples
This function run k-means for longitudinal data using some shape respecting distance and mean.
1 2 | kmlShape(myClds, nbClusters = 3, timeScale = 0.1, FrechetSumOrMax =
"max", toPlot="both", parAlgo=parKmlShape())
|
myClds |
[ |
nbClusters |
[ |
timeScale |
[ |
FrechetSumOrMax |
[ |
toPlot |
[ |
parAlgo |
[ |
This function run k-means for longitudinal data using a shape
respecting distance (distFrechet
) and a shape
respecting mean (meanFrechet
). See [1] for details.
An object of class Clds
in which the field
'clustersSenators', 'clusters' and 'trajMeans' are now filled.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ###########
### Example
### Generating artificial data
nbLignes <- 20
trajG <- matrix(0,nbLignes,10)
for(i in 1:(nbLignes/2)){
trajG[i,] <- dnorm(1:10,runif(1,3,8),1)*rnorm(1,10,0.1)
}
for(i in (nbLignes/2+1):nbLignes){
trajG[i,] <- dnorm(1:10,runif(1,3,8),1)*rnorm(1,5,0.1)
}
myClds <- cldsWide(data.frame(1:20,trajG))
plot(myClds)
### kmlshape
par(ask=FALSE)
kmlShape(myClds,2)
par(ask=TRUE)
plot(myClds)
###########
### Example 2
### Generating artificial data
nbLignes <- 12
trajH <- matrix(0,nbLignes,10)
for(i in 1:(nbLignes/3)){
trajH[i,] <- pnorm(1:10,runif(1,3,8),1)*rnorm(1,10,1)
}
for(i in (nbLignes/3+1):(2*nbLignes/3)){
trajH[i,] <- dnorm(1:10,runif(1,3,8),1)*rnorm(1,13,1)
}
for(i in (2*nbLignes/3+1):nbLignes){
trajH[i,] <- pnorm(1:10,runif(1,3,8),1)*rnorm(1,5,0.1)
}
myClds2 <- cldsWide(data.frame(1:60,trajH))
plot(myClds2)
### kmlshape
par(ask=FALSE)
kmlShape(myClds2,3)
par(ask=TRUE)
plot(myClds2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.