Description Usage Arguments Details Value Author(s) References Examples
Distance to all cluster centers is calculated for each curve. Dataset
can be in general format "Format1" or matrix format "Format2" (see formatFuncy
).
1 | dist2centers(data, centers)
|
data |
Dataset in |
centers |
Matrix with cluster center curves in columns. |
Calculates the sum of the squared distances between the curves and the cluster
centers on the available time points and divides it by the total number
of time points for the corresponding curve. If the dataset is in irregular format "Format1"
, center curves must
correspond to evaluations on the unique union of all time points.
Matrix of dimension nr_curves x nr_clusters.
Christina Yassouridis
Christina Yassouridis and Dominik Ernst and Friedrich Leisch. Generalization, Combination and Extension of Functional Clustering Algorithms: The R Package funcy. Journal of Statistical Software. 85 (9). 1–25. 2018
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##Generate dataset
set.seed(2804)
ds <- sampleFuncy(obsNr=100, k=4, timeNrMin=5, timeNrMax=10, reg=FALSE)
data <- Data(ds)
##Get unique union of all time points
time <- sort(unique(data[,3]))
##Generate center curves
c1 <- sin(time)+rnorm(30)
c2 <- cos(time)+rnorm(30)
c3 <- time^2+rnorm(3)
centers <- cbind(c1,c2,c3)
##Calculate distance to the centers
dist2centers(data, centers)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.