Skip to contents

Step 2 of the three-step ctwasPipeline: assembles region_data from the inputs and runs ctwas::est_param (prefit EM + accurate EM) to estimate the group prior probabilities and prior variances. Returns the input state plus region_data, boundary_genes, z_gene, and param.

Usage

estCtwasParam(
  inputs,
  thin = 0.1,
  niterPrefit = 3L,
  niter = 30L,
  groupPriorVarStructure = c("shared_type", "shared_context", "shared_nonSNP",
    "shared_all", "independent"),
  ncore = 1L,
  fallbackToPrefit = FALSE,
  ...
)

Arguments

inputs

A list returned by assembleCtwasInputs.

thin, niterPrefit, niter

Pass-throughs to ctwas::assemble_region_data / ctwas::est_param.

groupPriorVarStructure

Pass-through.

ncore

Number of cores.

fallbackToPrefit

Logical (length 1). When TRUE (default FALSE), if ctwas::est_param's accurate EM fails for ANY reason on a degenerate input, re-run only the prefit step via ctwas's internal fit_EM and return those (typically finite) priors as the param. The accurate-EM failure mode is version-dependent (ctwas <= 0.4.x: "contains NAs"; ctwas >= 0.6.0: "No regions selected!" or a NaN-loglik "missing value where TRUE/FALSE needed"), so the catch is deliberately broad; a genuinely broken input still surfaces because the prefit re-run will itself error. Mirrors the legacy ctwas_2 workaround on toy data where the accurate EM cannot be estimated.

...

Additional arguments forwarded to ctwas::est_param (e.g. min_p_single_effect, min_group_size).

Value

The inputs list augmented with region_data, boundary_genes, z_gene, and param.