# Contribution Groups Setup

### What Are Contribution Groups?

Contribution groups organize your model variables into logical business categories for decomposition analysis. Instead of viewing the impact of dozens of individual variables, you group related variables together to understand contributions at a strategic level.

**Purpose:** Organize model variables into meaningful business categories (Media, Price, Promotions, etc.) to enable group-level decomposition analysis and insights.

### Why Group Variables?

**Strategic Clarity:** See high-level contributions rather than getting lost in granular details

**Executive Communication:** Present results in business terms stakeholders understand

**Simplify Analysis:** Reduce dozens of variables into 5-10 meaningful groups

**Enable Drill-Down:** Start with group view, then drill into individual variables when needed

**Consistent Reporting:** Use standardized groups across all models and time periods

### How Contribution Groups Work

The decomposition calculation works as follows:

**Variable Contribution = Coefficient × Variable Value**

For each time period, every variable's contribution is calculated by multiplying its coefficient by its value at that time.

**Group Contribution = Sum of All Variables in Group**

Variables assigned to the same group have their contributions summed together for each time period.

**Total Predicted Value = Sum of All Group Contributions**

All group contributions add up to equal the model's predicted value.

### Accessing Contribution Groups

**Navigation:**

1. Click "Contribution Groups" in the left sidebar
2. Select your fitted model from the dropdown
3. View all variables in your model with their properties

**Prerequisites:**

* Model must be fitted (OLS or Bayesian)
* Model must have at least one variable besides the constant

### Understanding the Variable Table

The Contribution Groups page displays a comprehensive table with the following columns:

| Column          | Description                                     | Example              |
| --------------- | ----------------------------------------------- | -------------------- |
| **Variable**    | Variable name from your model                   | TV\_Spend\_Ad70      |
| **Coefficient** | Impact size (green=positive, red=negative)      | 2.45 (green)         |
| **T-Stat**      | Statistical significance (bold if \|t\| ≥ 1.96) | **3.21**             |
| **Transform**   | Data transformation applied                     | STA, SUB, MDV, ADBUG |
| **Group**       | Business category you assign (editable)         | Media                |
| **Adjustment**  | Optional mathematical adjustment                | None, Min, Max       |

**Color Coding:**

* **Green coefficients:** Positive impact on KPI
* **Red coefficients:** Negative impact on KPI
* **Bold t-statistics:** Statistically significant (|t| ≥ 1.96)

### Variable Information Displayed

**Coefficient:**

* Shows the impact size and direction
* Positive values increase KPI
* Negative values decrease KPI
* Magnitude indicates strength of effect

**T-Statistic:**

* Measures statistical significance
* |t| ≥ 1.96 is significant at 95% confidence
* |t| ≥ 2.58 is significant at 99% confidence
* Bold formatting highlights significant variables

**Transform:**

* Shows any transformations applied to the variable
* STA: Standardized
* SUB: Subset
* MDV: Multiply/Divide
* ADBUG: Adstock with Adbudg saturation curve
* ADSUBICP: Adstock with SUB and ICP saturation
* Multiple transformations may be chained

### Organizing Variables into Groups

#### Step 1: Assign Group Names

**Click the Group dropdown** for each variable and select or type a group name:

**Key Principles:**

* Use consistent naming across all variables
* Choose business-relevant category names
* Keep names short and descriptive
* Use the same name for all related variables

**Example Assignments:**

```
TV_Spend → Media
Digital_Spend → Media
Search_Spend → Media
Price_Variable → Price
Holiday_Indicator → Seasonality
Promotion_Flag → Promotions
```

#### Step 2: Use Multi-Selection for Efficiency

**Multi-select features** allow bulk operations:

1. **Check boxes** next to variables to select multiple
2. **Select All** using the header checkbox
3. **Bulk assign group** to all selected variables
4. **Bulk set adjustment** for all selected variables

**Use Case:** Select all digital channels at once and assign them to "Digital Media" group

#### Step 3: Review Group Organization

After assigning groups, review the organization:

**Check for completeness:**

* Every variable should be assigned to a group
* No variables left unassigned

**Verify consistency:**

* Similar variables use the same group name
* No typos or variations (e.g., "Media" vs "media" vs "Marketing")

**Validate business logic:**

* Groups make sense for your business
* Grouping aligns with how you think about drivers

### Common Group Categories

Use these standard categories as a starting point:

**Base:**

* Constant term (intercept)
* Baseline variables
* Trend variables
* **Purpose:** Represents the KPI level when all marketing is zero

**Media:**

* All advertising and marketing channels
* TV, Radio, Display, Video, OOH
* Both online and offline media
* **Purpose:** Total marketing contribution

**Digital:**

* Online marketing channels
* Search, Social, Display, Video, Email
* Sometimes separated from traditional Media
* **Purpose:** Digital-specific attribution

**Price:**

* Pricing variables
* Discount rates
* Price indices
* **Purpose:** Price elasticity and impact

**Promotions:**

* Promotional indicators
* Sale events
* Coupon campaigns
* **Purpose:** Promotional lift measurement

**Seasonality:**

* Holiday indicators
* Monthly/quarterly dummies
* Seasonal indices
* **Purpose:** Seasonal effects on KPI

**External:**

* Competitor activity
* Economic indicators
* Weather data
* **Purpose:** Factors beyond your control

**Distribution:**

* Store count
* Distribution expansion
* Availability metrics
* **Purpose:** Distribution effects

### Group Categories & Best Practices

#### Best Practices for Grouping

**1. Align with Business Structure**

* Mirror your organization's marketing structure
* Match how budgets are allocated
* Reflect decision-making hierarchies

**2. Balance Granularity**

* Not too few groups (lose insights)
* Not too many groups (defeats the purpose)
* Typically 5-10 groups is optimal

**3. Consider Analysis Goals**

**For Budget Allocation:**

* Group by controllable spend categories
* Separate fixed vs. variable costs
* Match budget line items

**For Channel Performance:**

* Group by media type
* Separate brand vs. performance channels
* Group by customer funnel stage

**For Executive Reporting:**

* Use high-level business categories
* Group by strategic initiatives
* Match stakeholder mental models

**4. Enable Drill-Down**

* Use group decomposition for detailed analysis
* Keep individual variable names descriptive
* Maintain hierarchical relationship

#### Strategic Grouping Patterns

**Pattern 1: Media Type Grouping**

```
Traditional Media: TV, Radio, Print, OOH
Digital Media: Search, Social, Display, Video
```

**Pattern 2: Funnel Stage Grouping**

```
Awareness: TV, Display, Video
Consideration: Content, Email, Social
Conversion: Search, Retargeting, Email
```

**Pattern 3: Owned vs. Paid**

```
Paid Media: All advertising spend channels
Owned Media: Email, Organic Social, SEO
```

**Pattern 4: Brand vs. Performance**

```
Brand Building: TV, Display, Sponsorships
Performance: Search, Affiliates, Retargeting
```

### Color Assignment Strategy

#### Assigning Colors to Groups

Once variables are grouped, assign a distinct color to each group:

**Access Color Picker:**

* Color picker appears below the variable table
* Shows all unique groups
* Click the color swatch to choose a color

**Choosing Effective Colors:**

| Group Type  | Recommended Color | Reason                                  |
| ----------- | ----------------- | --------------------------------------- |
| Base        | Gray (#808080)    | Neutral, represents baseline            |
| Media       | Blue (#0078D4)    | Professional, traditional for marketing |
| Digital     | Teal (#00B7C3)    | Modern, distinguishes from traditional  |
| Price       | Red (#E81123)     | Alert color, represents impact          |
| Promotions  | Orange (#FF8C00)  | Attention-grabbing, special events      |
| Seasonality | Green (#107C10)   | Natural cycles, recurring patterns      |
| External    | Purple (#5C2D91)  | Distinct, outside control               |

**Color Selection Principles:**

**1. Distinct Colors**

* Choose colors that are easily distinguishable
* Avoid similar shades (e.g., two blues)
* Test visibility in charts

**2. Consistent Meaning**

* Use same colors across all models
* Match company branding when appropriate
* Align with industry conventions

**3. Accessibility**

* Consider colorblind-friendly palettes
* Ensure sufficient contrast
* Avoid red-green combinations alone

**4. Professional Appearance**

* Use muted, professional tones
* Avoid overly bright/neon colors
* Match corporate style guides

#### Color Persistence

Colors are saved with the model:

* **Consistency:** Same colors used in all decomposition charts
* **Saved:** Colors persist across sessions
* **Editable:** Can be changed anytime
* **Exported:** Colors included in Excel exports

### Adjustment Parameters

#### Understanding Adjustments

Adjustments modify how variable contributions are calculated in decomposition:

**None (Default):**

* Use the variable contribution as calculated
* Contribution = Coefficient × Value
* Most common setting

**Min Adjustment:**

* Subtract the minimum contribution across all time periods
* Shows only incremental effects above the minimum
* **Formula:** Adjusted = Original - Min(Original)

**Max Adjustment:**

* Subtract the maximum contribution across all time periods
* Rarely used
* **Formula:** Adjusted = Original - Max(Original)

#### When to Use Adjustments

**None Adjustment (Recommended for Most Variables):**

* Default setting for all variables
* Shows actual contribution values
* Maintains interpretability

**Min Adjustment Use Cases:**

**1. Baseline Removal**

* When you want to show only incremental effects
* For variables with consistent baseline contribution
* To highlight variability rather than absolute levels

**2. Comparing Variable Contributions**

* Makes it easier to compare variables with different baselines
* Focuses on changes rather than levels

**Example:**

```
TV Original Contribution: [100, 120, 110, 140, 130]
TV Min Adjusted: [0, 20, 10, 40, 30]
Interpretation: Shows incremental TV impact above minimum
```

**Max Adjustment:**

* Rarely used in practice
* Special analytical scenarios
* Typically not needed for standard MMM

#### Adjustment Impact on Base Group

**Important:** When adjustments are applied, the subtracted values are added to the Base group to maintain the total predicted value.

**Example:**

* If Min adjustment subtracts 100 from TV each period
* Base group contribution increases by 100 each period
* Total contribution remains unchanged

### Saving Your Configuration

**Save Button:**

* Click "Save Groups" when finished
* Saves group assignments for all variables
* Saves color selections
* Saves adjustment settings

**Confirmation:**

* Success message appears when saved
* Configuration persists across sessions
* Used automatically in decomposition analysis

**When to Save:**

* After assigning all groups
* After choosing colors
* After setting adjustments
* Before running decomposition

### Workflow Summary

Follow this workflow to set up contribution groups:

1. **Select Model:** Choose fitted model from dropdown
2. **Review Variables:** Examine all variables and their properties
3. **Assign Groups:** Use dropdowns or multi-select to categorize variables
4. **Choose Colors:** Select distinct, professional colors for each group
5. **Set Adjustments:** Apply adjustments if needed (usually keep as None)
6. **Save Configuration:** Click "Save Groups" to persist settings
7. **Run Decomposition:** Navigate to Decomposition page to analyze

### Tips for Success

**Start Simple:**

* Begin with broad categories (Media, Price, Seasonality)
* Refine grouping as analysis needs evolve
* Don't overthink initial grouping

**Test and Iterate:**

* Run decomposition to see if groups make sense
* Adjust grouping based on chart readability
* Refine until insights are clear

**Document Decisions:**

* Keep notes on grouping logic
* Explain choices to stakeholders
* Maintain consistency across models

**Consider Audience:**

* Group for your primary stakeholders
* Use terminology they understand
* Enable the conversations you need to have

### Next Steps

After setting up contribution groups:

* Navigate to **Decomposition** page
* Run group-level decomposition analysis
* Drill down into specific groups
* Calculate ROI by group
* Export results for reporting
