Description Usage Arguments Value Author(s) References See Also Examples

kma jointly performs clustering and alignment of a functional dataset (multidimensional or unidimensional functions). To run kma function with different numbers of clusters and/or different alignment methods see kma.compare.

1 2 3 4 5 | ```
kma(x, y0 = NULL, y1 = NULL, n.clust = 1, warping.method = "affine",
similarity.method = "d1.pearson", center.method = "k-means", seeds = NULL,
optim.method = "L-BFGS-B", span = 0.15, t.max = 0.1, m.max = 0.1, n.out = NULL,
tol = 0.01, fence = TRUE, iter.max = 100, show.iter = 0, nstart=2, return.all=FALSE,
check.total.similarity=FALSE)
``` |

`x` |
matrix |

`y0` |
matrix |

`y1` |
matrix |

`n.clust` |
scalar: required number of clusters. Default value is |

`warping.method` |
character: type of alignment required. If |

`similarity.method` |
character: required similarity measure. Possible choices are: |

`center.method` |
character: type of clustering method to be used. Possible choices are: |

`seeds` |
vector |

.

`optim.method` |
character: optimization method chosen to find the best warping functions at each iteration. Possible choices are: |

`span` |
scalar: the span to be used for the loess procedure in the center estimation step when |

`t.max` |
scalar: |

`m.max` |
scalar: |

`n.out` |
scalar: the desired length of the abscissa for computation of the similarity indexes and the centers. Default value is |

`tol` |
scalar: the algorithm stops when the increment of similarity of each function with respect to the corrispondent center is lower than |

`fence` |
boolean: if |

`iter.max` |
scalar: maximum number of iterations in the k-mean alignment cycle. Default value is |

`show.iter` |
boolean: if |

`nstart` |
scalar: number of initializations with different seeds. Default value is |

`return.all` |
boolean: if |

`check.total.similarity` |
boolean: if |

The function output is a list containing the following elements:

`iterations` |
scalar: total number of iterations performed by kma function. |

`x` |
as input. |

`y0` |
as input. |

`y1` |
as input. |

`n.clust` |
as input. |

`warping.method` |
as input. |

`similarity.method` |
as input. |

`center.method` |
as input. |

`x.center.orig` |
vector |

`y0.center.orig` |
matrix |

`y1.center.orig` |
matrix |

`similarity.orig` |
vector: original similarities between the original functions and the original center. |

`x.final` |
matrix |

`n.clust.final` |
scalar: final number of clusters. Note that, when |

`x.centers.final` |
vector |

`y0.centers.final` |
matrix |

`y1.centers.final` |
matrix |

`labels` |
vector: cluster assignments. |

`similarity.final` |
vector: similarities between each function and the center of the cluster the function is assigned to. |

`dilation.list ` |
list: dilations obtained at each iteration of kma function. |

`shift.list ` |
list: shifts obtained at each iteration of kma function. |

`dilation` |
vector: dilation applied to the original abscissas |

`shift` |
vector: shift applied to the original abscissas |

Alice Parodi, Mirco Patriarca, Laura Sangalli, Piercesare Secchi, Simone Vantini, Valeria Vitelli.

Sangalli, L.M., Secchi, P., Vantini, S., Vitelli, V., 2010. *"K-mean alignment for curve clustering"*. Computational Statistics and Data Analysis, 54, 1219-1233.

Sangalli, L.M., Secchi, P., Vantini, S., 2014. *"Analysis of AneuRisk65 data: K-mean Alignment"*. Electronic Journal of Statistics, Special Section on "Statistics of Time Warpings and Phase Variations", Vol. 8, No. 2, 1891-1904.

`kma.compare, kma.similarity, fdakma, kma.data, kma.show.results `

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 | ```
data(kma.data)
x <- kma.data$x # abscissas
y0 <- kma.data$y0 # evaluations of original functions
y1 <- kma.data$y1 # evaluations of original function first derivatives
## Not run:
# Plot of original functions
matplot(t(x),t(y0), type='l', xlab='x', ylab='orig.func')
title ('Original functions')
# Plot of original function first derivatives
matplot(t(x),t(y1), type='l', xlab='x', ylab='orig.deriv')
title ('Original function first derivatives')
# Example: result of kma function with 2 clusters,
# allowing affine transformation for the abscissas
# and considering 'd1.pearson' as similarity.method.
kma_example <- kma (
x=x, y0=y0, y1=y1, n.clust = 2,
warping.method = 'affine',
similarity.method = 'd1.pearson',
center.method = 'k-means',
seeds = c(1,21)
)
kma.show.results(kma_example)
names(kma_example)
# Labels assigned to each function
kma_example$labels
# Total shifts and dilations applied to the original
# abscissa to obtain the aligned abscissa
kma_example$shift
kma_example$dilation
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.