Benchmark Attribute Effects by Refitting an Aggregate Model per Cohort
Source:R/brand_model_attribute_effect_cohort.R
brand_model_attribute_effect_cohort.Rdbrand_model_attribute_effect_cohort() fits a fast aggregate logistic model
(one shared attribute-effect vector plus a brand intercept, no
respondent-level utilities) and reports attribute-level probability effects
with credible intervals. It is the lightweight counterpart to
brand_model_attribute_effect(): use the heterogeneous model when there are
enough datapoints to learn respondent-level utilities, and this one when there
are not, or as a per-cohort benchmark for the sliced heterogeneous model.
Usage
brand_model_attribute_effect_cohort(
brand,
dep_var,
filter_expr = NULL,
cohort = NULL,
name = dep_var,
attr_set_name = "default",
attr_score_name = "score",
na_replace = NA,
scale = TRUE,
remove_response_bias = FALSE,
remove_brand_bias = FALSE,
delta = 1,
beta_prior_sd = 1,
ci_level = 0.95,
warmup = 500,
iter = 800,
chains = 4,
parallel_chains = 4,
seed = 777,
refresh = 0,
include_stanfit = FALSE,
...
)Arguments
- brand
A
g6tr_brandobject created withbrand_create().- dep_var
Binary outcome to model, e.g.
"funnel$preference".- filter_expr
Optional filter expression applied before modeling, e.g.
"funnel$usage == 1".- cohort
NULL(full population), a singlecohort, or acohort_set. With a cohort set, one model is fit per cohort and each is stored as its own row inbrand$models$cohort_effect.- name
Run name stored in
brand$models$cohort_effect. Defaults todep_var.- attr_set_name, attr_score_name
Attribute set and raw numeric score column. Defaults
"default"/"score".- na_replace
Value used to impute attribute cells missing on otherwise-rated rows (rows with no ratings are dropped first).
NA(default) drops any remaining partially-missing rows. Applied before scaling.- scale, remove_response_bias, remove_brand_bias
Feature engineering applied on the filtered modeling rows. Defaults
TRUE/FALSE/FALSE.- delta
Attribute shift used to translate log-odds effects into a probability-scale effect. Defaults to
1.- beta_prior_sd
Prior sd for the attribute effects. Defaults to
1.- ci_level
Credible-interval level. Defaults to
0.95.- warmup, iter, chains, parallel_chains, seed, refresh
Sampling controls.
- include_stanfit
If
TRUE, store each cohort's CmdStan fit.- ...
Additional arguments forwarded to
cmdstanr::sample().
Value
An updated g6tr_brand object with one row per cohort added to
brand$models$cohort_effect. Each row carries packed parameters and
measures columns (sample sizes and events-per-predictor) and an effects
list-column of attribute-level effects with per-cohort auc, log_loss, and
brier fit measures.