# print.Ckmeans.1d.dp: Print Optimal Univariate Clustering Results In Ckmeans.1d.dp: Optimal, Fast, and Reproducible Univariate Clustering

## Description

Print optimal univariate clustering results obtained from `Ckmeans.1d.dp` or `Ckmedian.1d.dp`.

## Usage

 ```1 2 3 4``` ```## S3 method for class 'Ckmeans.1d.dp' print(x, ...) ## S3 method for class 'Ckmedian.1d.dp' print(x, ...) ```

## Arguments

 `x` object returned by calling `Ckmeans.1d.dp` or `Cksegs.1d.dp`. `...` arguments passed to `print` function.

## Details

Function `print.Ckmeans.1d.dp` and `print.Ckmedian.1d.dp` prints the maximum ratio of between-cluster sum of squares to total sum of squares unless all input elements are zero. The ratio is an indicator of maximum achievable clustering quality given the number of clusters: 100% for a perfect clustering and 0% for no cluster patterns.

## Value

An object of class "`Ckmeans.1d.dp`" or "`Ckmedian.1d.dp`" as defined in `Ckmeans.1d.dp`.

## Author(s)

Joe Song and Haizhou Wang

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```# Example: clustering data generated from a Gaussian # mixture model of two components x <- c(rnorm(15, mean=-1, sd=0.3), rnorm(15, mean=1, sd=0.3)) res <- Ckmeans.1d.dp(x) print(res) res <- Ckmedian.1d.dp(x) print(res) y <- (rnorm(length(x)))^2 res <- Ckmeans.1d.dp(x, y=y) print(res) res <- Ckmedian.1d.dp(x) print(res) ```

### Example output

```Cluster centers:
[1] -0.9714069  0.8864044

Cluster index associated with each element:
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Within-cluster sum of squares:
[1] 1.0089259 0.5733426
Ckmeans.1d.dp returns 2 optimal clusters of sizes 15, 15
minimum total within-cluster sum of squares: 1.582268
maximum between-cluster sum of squares: 25.88597
total sum of squares of input vector: 27.46824
maximum (between-SS / total-SS): 94.2 %

Available components:
[1] "cluster"      "centers"      "withinss"     "size"         "totss"
[6] "tot.withinss" "betweenss"    "BIC"          "xname"        "yname"

Cluster centers:
[1] -0.9564509  0.8543187

Cluster index associated with each element:
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Within-cluster sum of L1 distances:
[1] 3.104439 2.372098
Ckmedian.1d.dp returns 2 optimal clusters of sizes 15, 15

Available components:
[1] "cluster"      "centers"      "withinss"     "size"         "totss"
[6] "tot.withinss" "betweenss"    "BIC"          "xname"        "yname"

Cluster centers:
[1] -1.0075150  0.8098013  1.1810913

Cluster index associated with each element:
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 2 3 3 2 2 2 2 2 2 2 2 3 2

Within-cluster sum of squares:
[1] 0.36275799 0.10881997 0.01179795
Ckmeans.1d.dp returns 3 optimal clusters of sizes 16.1139213135245, 14.0745503940078, 6.2651594971884
minimum total within-cluster sum of squares: 0.4833759
maximum between-cluster sum of squares: 34.14646
total sum of squares of input vector: 34.62983
maximum (between-SS / total-SS): 98.6 %

Available components:
[1] "cluster"      "centers"      "withinss"     "size"         "totss"
[6] "tot.withinss" "betweenss"    "BIC"          "xname"        "yname"

Cluster centers:
[1] -0.9564509  0.8543187

Cluster index associated with each element:
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Within-cluster sum of L1 distances:
[1] 3.104439 2.372098
Ckmedian.1d.dp returns 2 optimal clusters of sizes 15, 15

Available components:
[1] "cluster"      "centers"      "withinss"     "size"         "totss"
[6] "tot.withinss" "betweenss"    "BIC"          "xname"        "yname"
```

Ckmeans.1d.dp documentation built on July 22, 2020, 5:09 p.m.