Build the raw per-method data-driven covariance components
(cov_canonical / cov_pca / cov_flash /
cov_flash(factors = "nonneg")) for a "strong" SumStats set –
the reusable building block mashPriorCovariances then refines
with an ED / udr engine. Exposed on its own so a workflow can build or
inspect a single component (the mixture-prior notebook's per-method steps)
without running the full prior.
Arguments
- sumStatsList
Named list (or
S4Vectors::SimpleList) with at least"strong"(the discovery set the covariances are learned on).- alpha
mash
alpha.- vhat
Residual correlation matrix (
V);NULL-> identity.- components
Any of
"canonical","pca","flash","flash_nonneg". Built in that fixed order.- nPcs
PCs seeded into
cov_pca. Defaultncol(Bhat) - 1.- inputScale
SumStats -> matrix conversion scale.
- setSeed
Integer seed (
cov_flashis stochastic), orNULLto leave the ambient RNG untouched.
Examples
data(qtlSumStatsMulticontextExample)
ss <- qtlSumStatsMulticontextExample
sumStatsList <- list(strong = ss, random = ss)
mashCovarianceComponents(sumStatsList, alpha = 0)
#> Adding factor 1 to flash object...
#> Adding factor 2 to flash object...
#> Adding factor 3 to flash object...
#> Factor doesn't significantly increase objective and won't be added.
#> Wrapping up...
#> Done.
#> Backfitting 2 factors (tolerance: 8.94e-06)...
#> Difference between iterations is within 1.0e+00...
#> Difference between iterations is within 1.0e-01...
#> Difference between iterations is within 1.0e-02...
#> Difference between iterations is within 1.0e-03...
#> Difference between iterations is within 1.0e-04...
#> Wrapping up...
#> Done.
#> Adding factor 1 to flash object...
#> Adding factor 2 to flash object...
#> Adding factor 3 to flash object...
#> Factor doesn't significantly increase objective and won't be added.
#> Wrapping up...
#> Done.
#> Backfitting 2 factors (tolerance: 8.94e-06)...
#> Difference between iterations is within 1.0e+00...
#> Difference between iterations is within 1.0e-01...
#> Difference between iterations is within 1.0e-02...
#> Difference between iterations is within 1.0e-03...
#> Wrapping up...
#> Done.
#> $identity
#> [,1] [,2] [,3]
#> [1,] 1 0 0
#> [2,] 0 1 0
#> [3,] 0 0 1
#>
#> $brain
#> [,1] [,2] [,3]
#> [1,] 1 0 0
#> [2,] 0 0 0
#> [3,] 0 0 0
#>
#> $blood
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 0 1 0
#> [3,] 0 0 0
#>
#> $muscle
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 0 0 0
#> [3,] 0 0 1
#>
#> $equal_effects
#> [,1] [,2] [,3]
#> [1,] 1 1 1
#> [2,] 1 1 1
#> [3,] 1 1 1
#>
#> $simple_het_1
#> [,1] [,2] [,3]
#> [1,] 1.00 0.25 0.25
#> [2,] 0.25 1.00 0.25
#> [3,] 0.25 0.25 1.00
#>
#> $simple_het_2
#> [,1] [,2] [,3]
#> [1,] 1.0 0.5 0.5
#> [2,] 0.5 1.0 0.5
#> [3,] 0.5 0.5 1.0
#>
#> $simple_het_3
#> [,1] [,2] [,3]
#> [1,] 1.00 0.75 0.75
#> [2,] 0.75 1.00 0.75
#> [3,] 0.75 0.75 1.00
#>
#> $PCA_1
#> brain blood muscle
#> brain 0.2031844 0.3340120 0.2243579
#> blood 0.3340120 0.5490777 0.3688188
#> muscle 0.2243579 0.3688188 0.2477379
#>
#> $PCA_2
#> brain blood muscle
#> brain 0.003729395 0.03240844 -0.05162538
#> blood 0.032408439 0.28162928 -0.44862448
#> muscle -0.051625382 -0.44862448 0.71464133
#>
#> $tPCA
#> brain blood muscle
#> brain 0.03035490 0.05053652 0.03216785
#> blood 0.05053652 0.08860772 0.04406890
#> muscle 0.03216785 0.04406890 0.05421172
#>
#> $tFLASH_default
#> brain blood muscle
#> brain 0.02925699 0.04153723 0.02668673
#> blood 0.04153723 0.05976538 0.04117086
#> muscle 0.02668673 0.04117086 0.03792385
#>
#> $FLASH_default_1
#> brain blood muscle
#> brain 0.2369678 0.3444523 0.2493325
#> blood 0.3444523 0.5006899 0.3624253
#> muscle 0.2493325 0.3624253 0.2623423
#>
#> $FLASH_default_2
#> brain blood muscle
#> brain 0.2390964 0.1950579 -0.3793174
#> blood 0.1950579 0.1591308 -0.3094521
#> muscle -0.3793174 -0.3094521 0.6017728
#>
#> $tFLASH_nonneg
#> brain blood muscle
#> brain 0.02858018 0.04225972 0.02669381
#> blood 0.04225972 0.06248734 0.03955125
#> muscle 0.02669381 0.03955125 0.03703607
#>
#> $FLASH_nonneg_1
#> brain blood muscle
#> brain 0.2370147 0.3505876 0.2406804
#> blood 0.3505876 0.5185825 0.3560099
#> muscle 0.2406804 0.3560099 0.2444028
#>
#> $FLASH_nonneg_2
#> brain blood muscle
#> brain 8.739128e-07 7.525978e-06 0.0009348023
#> blood 7.525978e-06 6.481236e-05 0.0080503477
#> muscle 9.348023e-04 8.050348e-03 0.9999343137
#>