Skip to contents

Draw a random subset and a null (non-significant) subset of rows from a mash data list, used to fit the mash prior and estimate the null correlation.

Usage

mashRandNullSample(dat, nRandom, nNull, excludeCondition, seed = NULL)

Arguments

dat

A mash data list with random and null components.

nRandom

Integer. Number of random rows to sample.

nNull

Integer. Number of null rows to sample.

excludeCondition

Optional character vector of conditions to exclude.

seed

Optional integer random seed; NULL leaves the RNG unchanged.

Value

A list with sampled random and null matrices.

Examples

cond <- c("brain", "blood", "muscle")
p <- 8
bhat <- matrix(rnorm(p * 3), p, 3,
  dimnames = list(sprintf("chr1:%d:A:G", 100L * (1:p)), cond))
sbhat <- matrix(abs(rnorm(p * 3)) + 0.1, p, 3,
  dimnames = list(sprintf("chr1:%d:A:G", 100L * (1:p)), cond))
dat <- list(bhat = bhat, sbhat = sbhat, Z = bhat / sbhat,
  snp = sprintf("chr1:%d:A:G", 100L * (1:p)))
mashRandNullSample(dat, nRandom = 2L, nNull = 2L,
  excludeCondition = character())
#> $random
#> $random$bhat
#>                  brain     blood     muscle
#> chr1:400:A:G 0.5421914 0.3326236 -0.2473039
#> chr1:300:A:G 0.5283077 0.1643729 -0.2480082
#> 
#> $random$sbhat
#>                  brain     blood    muscle
#> chr1:400:A:G 0.3464703 0.8033333 0.7590374
#> chr1:300:A:G 0.8145094 1.6728639 0.8130332
#> 
#> 
#> $null
#> $null$bhat
#>                   brain      blood     muscle
#> chr1:500:A:G -0.1366734 -0.3852080 -0.2555104
#> chr1:300:A:G  0.5283077  0.1643729 -0.2480082
#> 
#> $null$sbhat
#>                  brain     blood    muscle
#> chr1:500:A:G 0.4197862 0.8159321 0.1364026
#> chr1:300:A:G 0.8145094 1.6728639 0.8130332
#> 
#>