Skip to contents

Begin a RIPr fit

Usage

ripr_init(
  alternative,
  null,
  engine = exact_engine(),
  atoms = NULL,
  weights = NULL,
  record_gap = FALSE,
  control = ripr_control()
)

Arguments

alternative

The alternative \(Q\), an distribution.

null

A null_model.

engine

An engine spec, e.g. exact_engine().

atoms

Optional list of (n_i, d) matrices, one atom per row and one matrix per part of the null region (nrow = 0 for an empty part). NULL places one atom per part by projecting the alternative's reference point.

weights

Optional list matching atoms, one weight per atom; the weights over all parts together must sum to 1. Defaults to uniform.

record_gap

Sweep the Frank–Wolfe oracle over the starting mixture, filling the init row's gap_after columns and caching the result for the first fw_step(). Off by default: it costs about one fw_step().

control

From ripr_control().

Value

A ripr_state with no iterations run.

Examples

fam <- multinomial_family(n_trials = 4L, k = 3L)
plurality <- null_model(
  fam,
  list(
    simplex_region(vertices = rbind(c(0.5, 0.5, 0), c(0, 1, 0), c(0, 0, 1))),
    simplex_region(vertices = rbind(c(0.5, 0, 0.5), c(0, 1, 0), c(0, 0, 1)))
  )
)
Q <- fam(c(0.4, 0.35, 0.25))
ripr_init(Q, plurality)
#> <ripr_state>
#>   null     multinomial_family in 2 parts
#>   iterate  2 atoms, KL 0.0245115
#>   gap      none recorded
#>   steps    fw 0, lb 0, em 0, weight 0, sfw 0, ct 0 (0.003s)
#>   trace    1 row, 0 snapshots