Calculate Age-related Expression and Heterogeneity Changes for Gene

calc.het.feat(exprs, age, modex = "linear",
  het_change_met = "spearman")

Arguments

exprs

a numeric vector with the expression values, ordered the same as age vector

age

a numeric vector, where the names correspond to samples (the same as colnames of the given matrix).

modex

expression change calculation method. 'linear' or 'loess', defaults to 'linear'

het_change_met

heterogeneity change calculation method. 'LR', for 'linear regression', or and correlation method accepted by cor.test() function.

Value

a list with i) summary results with the effect size and p value for expression level and heterogeneity changes, ii) residuals from expr~age model, which corresponds to unexplained variance, iii) expression values passed into the function.

Examples

myexp <- rnorm(n = 20, mean = sample(1:3, 1), sd = sample(c(1, 3), 1)) agevec <- sample(20:80,20) het_result <- calc.het.feat(myexp, agevec) head(het_result$summary) # summary statistics
#> level_change level_change.p heterogeneity_change #> -0.01170475 0.39934927 -0.31578947 #> heterogeneity_change.p #> 0.17475514
het_result$residuals # heterogeneity values: residuals
#> 1 2 3 4 5 6 #> 0.73012526 0.30974591 -0.84031662 0.48001273 0.90223371 -0.62179067 #> 7 8 9 10 11 12 #> -0.42494927 0.40972535 -0.71218218 -0.05164055 1.33004567 -1.38672970 #> 13 14 15 16 17 18 #> -0.98912304 -0.22761943 -0.07869377 -1.38801342 1.81355618 -1.29152474 #> 19 20 #> 0.90135427 1.13578429
het_result$expression # input expression values
#> [1] 4.104436 3.426553 2.370128 3.713867 3.855174 2.225807 2.364125 3.163685 #> [9] 2.580196 2.819367 4.353214 1.659849 1.905294 2.573159 2.921066 1.775612 #> [17] 4.696268 1.907215 3.994752 4.498391
all(myexp == het_result$expression)
#> [1] TRUE