kclustering {BasketballAnalyzeR} | R Documentation |
K-means cluster analysis
Description
K-means cluster analysis
Usage
kclustering(
data,
k = NULL,
labels = NULL,
nclumax = 10,
nruns = 10,
iter.max = 50,
algorithm = "Hartigan-Wong"
)
Arguments
data |
numeric data frame. |
k |
integer, number of clusters. |
labels |
character, row labels. |
nclumax |
integer, maximum number of clusters (when |
nruns |
integer, run the k-means algorithm |
iter.max |
integer, maximum number of iterations allowed in k-means clustering (see kmeans). |
algorithm |
character, the algorithm used in k-means clustering (see kmeans). |
Details
The kclustering
function performs a preliminary standardization of columns in data
.
Value
A kclustering
object.
If k
is NULL
, the kclustering
object is a list of 3 elements:
-
k
NULL
-
clusterRange
integer vector, values ofk
(from 1 tonclumax
) at which the variance between of the clusterization is evaluated
-
VarianceBetween
numeric vector, values of the variance between evaluated fork
inclusterRange
If k
is not NULL
, the kclustering
object is a list of 4 elements:
-
k
integer, number of clusters
-
Subjects
data frame, subjects' cluster identifiers
-
ClusterList
list, clusters' composition
-
Profiles
data frame, clusters' profiles, i.e. the average of the variables within clusters and the cluster eterogeineity index (CHI
)
Author(s)
Marco Sandri, Paola Zuccolotto, Marica Manisera (basketballanalyzer.help@unibs.it)
References
P. Zuccolotto and M. Manisera (2020) Basketball Data Science: With Applications in R. CRC Press.
See Also
Examples
FF <- fourfactors(Tbox,Obox)
X <- with(FF, data.frame(OD.Rtg=ORtg/DRtg,
F1.r=F1.Def/F1.Off, F2.r=F2.Off/F2.Def,
F3.O=F3.Def, F3.D=F3.Off))
X$P3M <- Tbox$P3M
X$STL.r <- Tbox$STL/Obox$STL
kclu1 <- kclustering(X)
plot(kclu1)
kclu2 <- kclustering(X, k=9)
plot(kclu2)