dot-ldfKnn: .ldfKnn

.ldfKnnR 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(), .filterKnn(), .filterLocMin(), .smoothCms()


almutlue/CellMixS documentation built on Sept. 8, 2024, 12:45 p.m.