moments: Compute exact statistical moments

Description Usage Arguments Details Value References Examples

Description

Function get_mu() computes the exact expected values of the null distributions

Function get_covar() computes the exact covariance matrix of the null distributions (square matrix, same size as kernel matrix); the variances are the values in the matrix diagonal

Function get_mu_reference() computes the reference expected values (one scalar value for each node/entity)

Function get_var_reference() computes the reference variances (one scalar value for each node/entity), log10-transformed

Usage

1
2
3
4
5
6
7
get_mu(K, id_labelled = colnames(K), mu_y)

get_covar(K, id_labelled = colnames(K), var_y)

get_mu_reference(K, id_labelled = colnames(K))

get_var_reference(K, id_labelled = colnames(K))

Arguments

K

square matrix, precomputed diffusion graph kernel, see ?kernels

id_labelled

character, names of the labelled nodes (must be a subset of the colnames of K)

mu_y, var_y

(scalar) mean and variance of the input, see details

Details

These functions enable exploring the properties of the null distributions of diffusion scores. They provide the exact statistical moments mentioned in:

Sergio Picart-Armada, Wesley K Thompson, Alfonso Buil, Alexandre Perera-Lluna. The effect of statistical normalisation on network propagation scores. Bioinformatics, 2020, btaa896. https://doi.org/10.1093/bioinformatics/btaa896

Specifically, get_mu_reference() and get_var_reference() provide the so-called 'Reference expected values' and 'Reference variances', which are input-independent (one only needs the kernel and the ids of the labelled nodes). Getting the actual expected values and variances requires providing the input expected value and variance, and can be achieved with get_mu() and get_covar().

Value

get_mu_reference(), get_var_reference() and get_mu() return a vector, whereas get_covar() returns a square matrix.

References

Article: https://doi.org/10.1093/bioinformatics/btaa896 Functions: https://github.com/b2slab/diffuBench/blob/master/helper_funs.R

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(graph_toy)
## Kernel
K_pstep <- pStepKernel(graph_toy)
## Labelled nodes
ids <- head(rownames(K_pstep), ncol(K_pstep)/3)
## Reference values
get_mu_reference(K_pstep, ids)
get_var_reference(K_pstep, ids)
## Actual moments with an input y
y <- graph_toy$input_vec[ids]
mu_y <- mean(y)
var_y <- var(y)
mu <- get_mu(K_pstep, ids, mu_y = mu_y)
covar <- get_covar(K_pstep, ids, var_y = var_y)
## mean values
mu
## variances
diag(covar)
## covariances
covar[1:6, 1:6]

diffuStats documentation built on Feb. 22, 2021, 10 a.m.