Skip to contents

\(H_0 = \{P_\theta : \theta \in \bigcup_i \Theta_{0i}\}\). Each convex part of the region (see parts()) is itself a null. The decomposition into cells() is computed once, at construction. Test membership with contains(null@region, theta).

format() gives the family and part count on one line.

Usage

null_model(family, region, max_cells = getOption("ripr.max_cells", 1000L))

Arguments

family

A parametric_family.

region

The null's geometry: any region, or a list of convex_regions, which becomes their union_region.

max_cells

The number of simplices the decomposition may produce before giving up. Defaults to the ripr.max_cells option, or 1000L when that is unset.

Value

A null_model.

Properties

family

The parametric_family.

region

The null's region, as declared.

cells

The flat list of convex cells the region decomposes into, in part order: cells(parts(region)[[1]]), then those of part 2, and so on.

cell_part

Which part each cell came from, as an index into parts(region); used to report the part of each atom in a fit.

Examples

fam <- multinomial_family(n_trials = 4L, k = 3L)
# The plurality null
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)))
  )
)
#> <null_model>
#>   multinomial_family: simplex_region -> count_space
#>   2 parts, 2 cells
#>     simplex_region: 3 vertices in R^3
#>     simplex_region: 3 vertices in R^3
null <- null_model(fam, list(halfspace_region(c(1, -1, 0))))
contains(null@region, c(0.2, 0.5, 0.3))
#> [1] TRUE
contains(null@region, c(0.6, 0.2, 0.2))
#> [1] FALSE