Skip to contents

Use model selection to select a shape for each target

Usage

select_shape(
  cpo,
  subset = NULL,
  sp = NULL,
  bss = c("micv", "mdcx", "cv", "cx", "lin", "tp", "null"),
  family = c("nb", "gaussian"),
  score = "gcv",
  cp_type = c("cp_1se", "cp_min")
)

Arguments

cpo

a cpam object

subset

character vector; names of targets or genes (if cpo$gene_level = T) for which changepoints will be estimated

sp

numerical >= 0; supply a fixed smoothing parameter. If NULL (default), the smoothing parameter is estimated. Note, this fixed value is in any case applied only to shape constrained bases (i.e., not bs = 'tp').

bss

character vector; names of candidate spline bases (i.e., candidate shape types).

family

character; negative binomial ("nb", default) or Gaussian ("gaussian")

score

character; model selection score, either Generalised Cross Validation ("gcv") or Akaike Information Criterion ("aic")

cp_type

character; if changepoints have been estimated using estimate_changepoint(), which selection rule should be used. See estimate_changepoint() for details.

Value

a cpam object with the selected shapes added to the slot "shapes"

Details

The function selects the best shape from a list of candidate shapes for each target. It is typically the last step in the analysis, called after p-values have been estimated using compute_p_values() and changepoints have been estimated using estimate_changepoint().

Two shape selections are generated. The first selecting among linear, convex and concave shape classes and their monotonic variants (or the shape set given by bss), and the second selecting among the first options plus an 'unconstrained' smooth. The inclusion of the unconstrained' type provides the flexibility to detect targets beyond simpler trends. For computational reasons, as per the changepoint estimation, shapes are selected only for those genes, or their isoforms, identified as significant at the chosen FDR threshold. This is overridden by providing a subset of target names to the subset` argument.

Examples