.cmsCell {CellMixS} | R Documentation

## .cmsCell

### Description

Function to calculate a cellspecific mixing score (cms) of groups/batches.

### Usage

    .cmsCell(cell, group, knn, k_min = NA, cell_min = 4)

### Arguments

`cell` | Character. Name of the cell to calculate cms for. Needs to be one of `rownames(knn)`.
`group` | Character. Name of group/batch variable. Needs to be one of `names(knn)`.
`knn` | List with three elements. First "index" with indices of KNN cells. Second "distance" with distances to KNN cells. Third a slot named by `group` variable with group level of KNN cells.
`k_min` | Numeric. Minimum number of Knn to include. Default is NA (see Details).
`cell_min` | Numeric. Minimum number of cells from each group to be included into the AD test. Should be > 4 to make 'ad.test' working.

### Details

The cms function tests the hypothesis, that group-specific distance distributions of knn cells have the same underlying unspecified distribution. It performs Anderson-Darling tests as implemented in the `kSamples package`. In default the function uses all distances and group label defined in knn. If `k_min` is specified, the first local minimum of the overall distance distribution with at least kmin cells is used. This can be used to adapt to the local structure of the datatset e.g. prevent cells from a distinct different cluster to be included.

### Value

A p.value as resulting from the ad.test.

### See Also

`ad.test`, `cms`, `.smoothCms`

Other helper functions: `.defineSubspace`, `.filterLocMin`, `.ldfKnn`, `.smoothCms`

[Package CellMixS version 1.0.2 Index]