The function Ckmeans.1d.dp() can perform optimal weighted univariate \(k\)-means clustering. The weights can be an indication of sample size, certainty, or signal intensity dependent on the application. The relative values of weights are consequential on clustering. The absolute values of weights can also have an impact on the number of clusters when it must be estimated.

The linear scale of weights strongly affects the estimated number of clusters

When the number of clusters must be estimated, the linear scale of weights heavily influences the estimated number of clusters \(k\). The reason is that linear scaling leads to a nonlinear effect in the calculation of the Bayesian information criterion. A large scale will promote more clusters to be used.

Here is a guideline on how to scale the weights:

Linear weight scaling is uninfluential when the number of clusters is given

When an exact number of clusters \(k\) is given by the user, linear weight scaling does not influence cluster analysis in theory. The clustering results are expected to be identical for any linear scaling of weights. However, a large numerical weight can cause overflow and thus should be linearly scaled down to a more tractable range.