dispersion: Calculate dispersion metrics

Description Usage Arguments Value Author(s) Examples

View source: R/dispersion.R

Description

For each variable (row), calculate a dispersion (var/mean) and a z-score of normalized dispersion. A z-score of normalized dispersion is motivated due to correlation between means and variances. Variables are binned (by default,n_bins=10) by their means. Within a bin, a z-score is calculated. It's recommended that you look at both results zdisp and disp to decide how to filter the data.

Usage

1
2
3
4
5
6
7
8
9
dispersion(
  dat,
  n_bins = 10,
  center.dat = TRUE,
  scale.dat = FALSE,
  verbose = FALSE,
  seed = NULL,
  ...
)

Arguments

dat

a time-series data matrix with m biomarkers as rows, over n time points (columns).

center.dat

a logical specifying to center the input and denoised data. By default, TRUE.

scale.dat

a logical specifying to scale the input and denoised data. By default, FALSE.

verbose

a logical specifying to print the computational progress. By default, FALSE.

seed

a seed for the random number generator.

...

optional arguments.

timepoints

a vector of time points for columns of dat.

dof

the degree of freedom in spline.smooth. By default, cv performs cross-validation per-variable.

Value

dispersion returns a data.frame of statistics for m variables (rows).

Author(s)

Neo Christopher Chung nchchung@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
data(cys_optm)
meta <- cys_optm[,1:4]
optm <- log(cys_optm[meta$Select,5:10])
optm <- t(scale(t(optm), scale=TRUE, center=TRUE))
days <- as.numeric(colnames(optm))

disp_optm <- dispersion(optm, timepoints = days, dof="cv")
disp_optm <- cbind(meta, disp_optm)
# make a histogram of dispersion statistics
hist(disp_optm$disp, 100)
# make a histogram of z-score of normalized dispersion
hist(disp_optm$zdisp, 100)
# library(readr)
# write_excel_csv(disp_optm, file="~/coptm_dispersion.csv")

## End(Not run)

UCLA-BD2K/CV.Signature.TCP documentation built on May 15, 2020, 11:27 p.m.