group_dilution: Compute group-based dilution factors for a model space

View source: R/group_dilution.R

group_dilutionR Documentation

Compute group-based dilution factors for a model space

Description

Computes a group-based dilution factor for each model (row) in a model-inclusion matrix. Regressors are assigned to "relatedness groups" via Nar_vec. For each model and each group, the dilution exponent increases by 1 for every additional regressor from that group beyond the first. The model's dilution factor is the product of group-specific penalties.

Usage

group_dilution(Reg_ID, Nar_vec, p)

Arguments

Reg_ID

An ⁠MS x K⁠ numeric/integer matrix of model indicators. Each row corresponds to a model; each column corresponds to a regressor. Entries should be 0/1 (0 = excluded, 1 = included).

Nar_vec

An integer vector of length K giving group assignments for each regressor. Use 0 for regressors not belonging to any group. Positive integers (1,2,...) denote group IDs.

p

Either:

  • a single numeric scalar in [0,1] applied to all groups, or

  • a numeric vector in [0,1] with one entry per group.

If p is a vector, it is matched to groups as follows:

  • If p has names, they must match group IDs (e.g., c("1"=0.7,"2"=0.5)),

  • otherwise it is assumed to be in the order of sort(unique(Nar_vec[Nar_vec>0])).

Details

Formally, for model i and group h >= 1, let

c_{ih} = \sum_{j=1}^K \gamma_{ij} I\{g(j)=h\}

and

D_i = \sum_{h \ge 1} \max(0, c_{ih} - 1).

If p is a scalar, the dilution factor is

p^{D_i}

. If p is group-specific with values p_h, then

\mathrm{NarDilution}_i = \prod_{h \ge 1} p_h^{\max(0, c_{ih}-1)}.

Value

A numeric vector of length MS containing the dilution factor for each model.

Examples

# Example model space: MS models, K regressors
Reg_ID <- rbind(
  c(0,0,0,0,0),  # null
  c(1,1,0,0,0),  # two from group 1 -> penalty p_1^(1)
  c(1,1,1,0,0),  # three from group 1 -> penalty p_1^(2)
  c(1,1,0,1,1)   # two from group 1 and two from group 2 -> p_1^1 * p_2^1
)
Nar_vec <- c(1,1,1,2,2)

# Scalar p (same for all groups)
group_dilution(Reg_ID, Nar_vec, p = 0.7)

# Group-specific p (vector in group order: group 1 then group 2)
group_dilution(Reg_ID, Nar_vec, p = c(0.7, 0.5))

# Group-specific p with explicit mapping via names
group_dilution(Reg_ID, Nar_vec, p = c("1"=0.7, "2"=0.5))


rmsBMA documentation built on March 14, 2026, 5:06 p.m.