.prior_kmeans {openCyto} | R Documentation

## Elicits data-driven priors from a flowSet object for specified channels using the K-Means clustering algorithm

### Description

We elicit data-driven prior parameters from a `flowSet` object for specified channels. For each sample in the `flowSet` object, we apply `kmeans` to obtain `K` clusters. From each cluster, we determine its centroid and the sample covariance matrix. We then aggregate these two sample moments across all samples for each cluster.

### Usage

    .prior_kmeans(flow_set, channels, K, nu0 = 4, w0 = 10, nstart = 10,
      pct = 0.1, min = NULL, max = NULL, ...)

### Arguments

`flow_set` | a `flowSet` object
`channels` | a character vector containing the channels in the `flowSet` from which we elicit the prior parameters for the Student's t mixture
`K` | the number of mixture components to identify
`nu0` | prior degrees of freedom of the Student's t mixture components.
`w0` | the number of prior pseudocounts of the Student's t mixture components.
`nstart` | number of random starts used by `kmeans` algorithm
`pct` | percentage of randomly selected cells in each `flowFrame` that is used to elicit the prior parameters. The value should must be greater than 0 and less than or equal to 1.
`min` | a numeric vector that sets the lower bounds for data filtering. If `NULL` (default), no truncation is applied.
`max` | a numeric vector that sets the upper bounds for data filtering. If `NULL` (default), no truncation is applied.
`...` | Additional arguments passed to `kmeans`

### Details

Because the cluster labels returned from `kmeans` are arbitrary, we align the clusters based on the centroids that are closest to a randomly selected reference sample. We apply the Hungarian algorithm implemented using the `solve_LSAP` function from the `clue` package to assist with the alignment.

If each frame within `flow_set` has a large number of cells, the computational costs of `kmeans` can be a burden. We provide the option to randomly select `pct`, a percentage of the cells from each flow frame to which `kmeans` is applied.

### Value

list of `flowClust` prior parameters

[Package openCyto version 1.20.2 Index]