Skip to contents

brand_model_attribute_performance() loops over all or selected attributes, fits one ordinal brand-performance model per attribute, and appends one row to brand$models$performance.

Usage

brand_model_attribute_performance(
  brand,
  filter_expr = NULL,
  cohort = NULL,
  attr_set_name = "default",
  attr_score_name = "score",
  na_replace = NA,
  attribute_names = NULL,
  name = NULL,
  family = NULL,
  warmup = 500,
  iter = 2000,
  chains = 4,
  init = "0",
  cores = 4,
  seed = 123,
  include_models = FALSE,
  ...
)

Arguments

brand

A g6tr_brand object created with brand_create().

filter_expr

Optional filter expression applied before modeling.

cohort

NULL (full filtered population), a single cohort, or a cohort_set. With a cohort set, each attribute is refit on each cohort's respondents and one row per attribute-by-cohort is stored, carrying the cohort meta columns. Performance ranking is unweighted, so cohort weights are ignored (only cohort membership is used).

attr_set_name

Attribute set to use. Defaults to "default".

attr_score_name

Numeric score column inside brand$attributes[[attr_set_name]]. Defaults to "score". The score is used ordinally (ranked), so feature scaling / bias-removal are intentionally not offered here: scaling is a monotonic no-op, and brand-bias removal would erase the very brand differences this model ranks.

na_replace

Value used to impute a missing score for an attribute. NA (default) drops rows with a missing score for that attribute.

attribute_names

Optional character vector of attribute labels from brand$attributes[[attr_set_name]]$attribute. Defaults to all available attributes in stored order.

name

Optional run name stored in brand$models$performance.

family

Optional brms family. Defaults to cumulative logit.

warmup

Number of warmup iterations per chain.

iter

Number of post-warmup sampling iterations per chain.

chains

Number of chains.

init

Initialization passed to brms::brm().

cores

Number of cores passed to brms::brm().

seed

Random seed.

include_models

If TRUE, store the fitted brmsfit objects.

...

Additional arguments passed to brand_model_attribute_performance_single().

Value

An updated g6tr_brand object with one more row per fitted attribute model in brand$models$performance.