get.center | R Documentation |
The function groups clusters with the mean value closer to z zero together until the main cluster contain the minimum required ratio of data, as specified by the user.
get.center(emfit, minCenter)
emfit |
a
|
minCenter |
a single |
a list
containing information about the current
clusters obtained from a mixture model estimation:
mu
a numeric
vector
representing the mean
for each component. If there is more than one component, the
kth element is the mean of the kth component of the mixture model.
pro
a vector
whose kth component is the mixing
proportion for the kth component of the mixture model. If
missing, equal proportions are assumed.
z
a numeric
matrix
whose [i,k]th entry
is the probability that observation i in the test data belongs
to the kth class.
groups
a matrix
with the number of rows corresponding
to the current number of clusters while the number of columns is
corresponding to the initial number of clusters. The presence of
1
in position [k,i] indicates that the initial ith cluster
is now part of the new kth cluster.
ngroups
a numeric
, used as an integer, giving the final
number of clusters.
sigmasq
a numeric
vector
giving the common
variance for each component in the mixture model "E".
center
a numeric
, used as an integer, indicating the
cluster that has the mean closest to zero.
Alexander Krasnitz, Guoli Sun
## Create a list with mixture model estimation data containing 5 clusters demoEM <- list() demoEM[["mu"]] <- c(-0.23626, -0.08108, -0.02205, 0.03059, 0.24482) demoEM[["pro"]] <- rep(0.2, 5) demoEM[["z"]] <- matrix(data=c(1.19e-118, 2.81e-25, 5.87e-08, 9.99e-1, 1.86e-52, 2.03e-117, 9.19e-25, 1.02e-07, 9.99e-01, 1.92e-53, 1.00e+0, 1.34e-23, 1.72e-50, 1.08e-82, 6.45e-295, 1.00e+00, 1.39e-20, 2.51e-46, 1.67e-77, 1.47e-285, 8.86e-63, 1.21e-04, 9.99e-01, 1.89e-05, 7.93e-106, 7.59e-60, 7.76e-04, 9.99e-01, 3.60e-06, 1.75e-109, 0.00e+0, 1.61e-147, 1.08e-98, 2.31e-63, 1.00e+0, 0.00e+0, 1.18e-147, 8.37e-99, 1.88e-63, 1.00e+0, 3.51e-75, 9.79e-01, 4.55e-08, 2.06-02, 2.14e-90, 7.07e-79, 8.58e-01, 3.96e-09, 1.41e-01, 6.42e-86), ncol=5, byrow=TRUE) demoEM[["groups"]] <- diag(x=1, nrow=5, ncol=5, names=TRUE) demoEM[["ngroups"]] <- 5 demoEM[["sigmasq"]] <- rep(1.533e-3, 5) ## Group clusters until the minimum proportion of 40% of the data is in ## the main cluster. The main cluster being defined as the one closer to ## a value of zero. result <- CNprep:::get.center(emfit=demoEM, minCenter=0.4) ## The result contain only 4 clusters as the clusters 3 and 4 have been ## grouped together to form a cluster that includes 40% of the data (group 3) result$ngroups result$pro
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.