.ldfKnn {CellMixS} | R Documentation

## .ldfKnn

### Description

Calculates the Local Density Factor as implemented in the `DDoutlier` package with a predefined KNN neighbourhood.

### Usage

    .ldfKnn(dataset, knn_object, k = k, h = 1, c = 1)

### Arguments

`dataset` | Matrix with cell embeddings with cells as rows and reduced dimensions as cloumns. Subspace to determine LDF in.
`knn_object` | List with k-nearest neighbours (KNN) as provided by `get.knn` from the `FNN` package. First element named "indices" contains indices of KNN in `dataset`. Second element named "distance" contains distances of KNN in `dataset`. Third element named "cell_name" contains rownames of KNN in `dataset`.
`k` | Numeric. Number of KNN used. Should correspond to `knn_object`.
`h` | Numeric. Bandwidth for kernel functions. The greater the bandwidth, the smoother kernels and lesser weight are put on outliers. Default is 1
`c` | Scaling constant for comparison of LDE to neighboring observations. Default is 1.

### Details

LDF fuction modified from the `DDoutlier` package. Calculates a Local Density Estimate (LDE) and Local Density Factor (LDF) with a gaussian kernel. Modified to use a predefined KNN neighbourhood. For `ldfSce` this is essential to determine LDF after data integration on the same set of cells.

### Value

List with two elements "LDE" and "LDF".

### See Also

`ldfSce`

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

[Package CellMixS version 1.0.2 Index]