Skip to contents

The single interface to mvsusieR::create_mixture_prior(), which every mvSuSiE prior in the package goes through. That function takes exactly one of mixture_prior and R and tests the two with missing(), so the unused one cannot simply be passed as NULL; this wrapper owns that branch. Supply mixtureMatrices for a data-driven mixture — e.g. the reweighted mr.mash covariances — or leave it NULL for the canonical uniform mixture over R conditions.

Usage

buildMvsusieMixturePrior(
  conditionNames = NULL,
  R = length(conditionNames),
  mixtureMatrices = NULL,
  mixtureWeights = NULL,
  weightsTol = 1e-10,
  methodArgs = MvsusieMixturePriorOptions()
)

Arguments

conditionNames

Character vector naming the conditions the prior is over, forwarded as include_indices. On the data-driven arm this restricts the supplied covariances to these conditions by name, so a mixture spanning more conditions than the fit at hand is subset here. On the canonical arm it only labels the generated covariances. NULL leaves the mixture unrestricted and unlabelled.

R

Number of conditions for the canonical mixture. Defaults to length(conditionNames); pass it explicitly when the conditions are unnamed. Unused when mixtureMatrices is supplied, since the mixture then carries its own dimension.

mixtureMatrices

Named list of prior covariance matrices to use as the mixture. NULL (default) builds the canonical mixture from R instead.

mixtureWeights

Numeric vector of mixture weights, named to match mixtureMatrices. NULL leaves the engine's uniform weights.

weightsTol

Mixture components weighted at or below this are dropped.

methodArgs

Options forwarded to mvsusieR::create_mixture_prior, built with MvsusieMixturePriorOptions. A bare list is refused: it cannot be checked against the engine.

Value

The prior object mvsusieR::create_mixture_prior() returns, ready to pass as prior_variance to fitMvsusie or fitMvsusieRss.

Examples

# \donttest{
# Canonical uniform mixture over two named conditions.
buildMvsusieMixturePrior(conditionNames = c("brain", "blood"))
#> $null_weight
#> [1] 0
#> 
#> $pi
#> singleton_1 singleton_2    shared_1    shared_2    shared_3    shared_4 
#>   0.1428571   0.1428571   0.1428571   0.1428571   0.1428571   0.1428571 
#>    shared_5 
#>   0.1428571 
#> 
#> $xUlist
#> $xUlist$singleton_1
#>       brain blood
#> brain     1     0
#> blood     0     0
#> 
#> $xUlist$singleton_2
#>       brain blood
#> brain     0     0
#> blood     0     1
#> 
#> $xUlist$shared_1
#>       brain blood
#> brain     1     0
#> blood     0     1
#> 
#> $xUlist$shared_2
#>       brain blood
#> brain  1.00  0.25
#> blood  0.25  1.00
#> 
#> $xUlist$shared_3
#>       brain blood
#> brain   1.0   0.5
#> blood   0.5   1.0
#> 
#> $xUlist$shared_4
#>       brain blood
#> brain  1.00  0.75
#> blood  0.75  1.00
#> 
#> $xUlist$shared_5
#>       brain blood
#> brain     1     1
#> blood     1     1
#> 
#> 
#> attr(,"class")
#> [1] "mash_prior"
# }