Skip to contents

Worker used by projoint to compute subgroup differences (group == 1 minus group == 0) in marginal means (MMs) or average marginal component effects (AMCEs). Supported only for .structure = "profile_level".

Usage

projoint_diff(
  .data,
  .qoi,
  .by_var,
  .structure,
  .estimand,
  .se_method,
  .irr,
  .remove_ties,
  .ignore_position,
  .n_sims,
  .n_boot,
  .weights_1,
  .clusters_1,
  .se_type_1,
  .weights_2,
  .clusters_2,
  .se_type_2,
  .auto_cluster = TRUE,
  .seed = NULL
)

Arguments

.data

A projoint_data object.

.qoi

Optional projoint_qoi; if NULL, estimates all MMs/AMCEs.

.by_var

Column name in .data$data defining subgroups; must be logical, numeric/integer coded as 0/1, or factor with levels "0"/"1".

.structure

Must be "profile_level".

.estimand

Either "mm" or "amce".

.se_method

One of "analytical", "simulation", or "bootstrap".

.irr

NULL to estimate IRR from repeated tasks, or numeric to fix IRR.

.remove_ties

Logical; drop ties before estimation? Default TRUE.

.ignore_position

Ignored (subgroup analysis is profile-level only).

.n_sims

Integer; required when .se_method = "simulation".

.n_boot

Integer; required when .se_method = "bootstrap".

.weights_1, .clusters_1, .se_type_1

Passed to lm_robust for IRR estimation.

.weights_2, .clusters_2, .se_type_2

Passed to lm_robust for MM/AMCE estimation.

.auto_cluster

Logical; if TRUE (default), auto-cluster on id when suitable and no clusters are provided (applies only if the corresponding .se_type_* is NULL).

.seed

Optional integer; sets a temporary RNG seed and restores prior state on exit.

Value

A projoint_results object containing subgroup differences with fields:

  • estimates: tibble with one row per attribute/level and columns like estimate (group1 minus group0), se, conf.low, conf.high, plus internal columns (estimate_1, estimate_0, se_1, se_0) used in the diff.

  • estimand: "mm" or "amce".

  • structure: "profile_level".

  • se_method: SE method used.

  • irr: "Estimated" or "Assumed (<value> )".

  • tau: numeric reliability used (average of subgroup taus when estimated).

  • remove_ties, ignore_position: flags echoed from inputs.

  • se_type_used, cluster_by: details propagated from fitting calls.

  • labels, data: design labels and the analysis data (passed through).