hoeffDValues: Create values of Hoeffding's D statistics from M and A values

View source: R/tab_values.R

hoeffDValuesR Documentation

Create values of Hoeffding's D statistics from M and A values

Description

The function creates and returns Hoeffding's D statistics values from MA values.

In case sample_n is set to a numerical value (e.g. 10000), a random subset containing sample_n is taken to calculate Hoeffding's D values to speed up the calculation. In case there are less features than sample_n, all features are taken.

Usage

hoeffDValues(tbl, name = "raw", sample_n = NULL)

Arguments

tbl

tibble, as obtained from the function MAvalues

name

character(1), name of the returned list

sample_n

numeric(1), number of features (subset) to be taken for calculation of Hoeffding's D values

Details

The function uses the function hoeffd from the Hmisc package to calculate the values.

Value

named list with Hoeffding's D values per sample

Examples

## create se
a <- matrix(seq_len(100), nrow = 10, ncol = 10, 
            dimnames = list(seq_len(10), paste("sample", seq_len(10))))
a[c(1, 5, 8), seq_len(5)] <- NA
set.seed(1)
a <- a + rnorm(100)
cD <- data.frame(name = colnames(a), type = c(rep("1", 5), rep("2", 5)))
rD <- data.frame(spectra = rownames(a))
se <- SummarizedExperiment::SummarizedExperiment(assay = a, 
    rowData = rD, colData = cD)

tbl <- MAvalues(se)
hoeffDValues(tbl, "raw")

## normalized values
se_n <- se
assay(se_n) <- normalizeAssay(a, "sum")
tbl_n <- MAvalues(se_n, group = "all")
hoeffDValues(tbl_n, "normalized")

## transformed values
se_t <- se
assay(se_t) <- transformAssay(a, "log")
tbl_t <- MAvalues(se_t, group = "all")
hoeffDValues(tbl_t, "transformed")


tnaake/MatrixQCvis documentation built on June 20, 2024, 7:22 a.m.