# Estimate of all levels of categorical variable from brm summary

**URL:** <https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863>\
**Category:** brms\
**Created:** [February 27, 2019, 10:03pm UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863 "2019-02-27T22:03:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mluerig](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mluerig/32/4173_2.png) [@mluerig](https://discourse.mc-stan.org/u/mluerig)\
**Post date:** [February 27, 2019, 10:03pm UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863/1 "2019-02-27T22:03:24Z")

</div>

I was wondering how to interpret the estimate for categorical variables that I get with `brms` - there is only one of my two factor levels attached to a response. How can I get estimates for the other level?

Sorry for being uninformed, I’m probably missing something really obvious here (linear combination of the other variables?). Is this what is meant by "reference category! as described here?

> [@Interpreting results from categorical() with brm](https://discourse.mc-stan.org/t/interpreting-results-from-categorical-with-brm/4120/3):
>
> The interest is the group-level effect for “corrZ” per “rsfm” level. Below is the model summary: Family: categorical Links: mu1 = logit; mu2 = logit; mu3 = logit Formula: Y ~ corrZ + (1 + corrZ | rsfm) Data: dat (Number of observations: 959066) Samples: 4 chains, each with iter = 1000; warmup = 500; thin = 1; total post-warmup samples = 2000 Group-Level Effects: ~rsfm (Number of levels: 247) Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat sd(mu1\_Intercept) 0.00 0.00 0.00 0.01 2000 …

This is my model, a reduced version of a path analysis. `Food` has two levels and I am trying to figure which one does what to survival, taking other metrics into account.

Model specs:

```
brm(bf(Survival ~ Food + Length + Pigmentation) +
              bf(Length ~ Food),
            family=gaussian,
            data = f,
            chains=4, cores=8,seed=17, iter=1000, warmup = 500, thin = 10, inits=0, silent=F,
            prior=prior(normal(0, 1), b),
            save_all_pars=T,control = list(adapt_delta = 0.99,max_treedepth=20)

```

Model output:

```
 Family: MV(gaussian, gaussian) 
  Links: mu = identity; sigma = identity
         mu = identity; sigma = identity 
Formula: Survival ~ Food + Length + Pigmentation 
         Length ~ Food 
   Data: f (Number of observations: 58) 
Samples: 4 chains, each with iter = 1000; warmup = 500; thin = 10;
         total post-warmup samples = 200

Population-Level Effects: 
                        Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
Survival_Intercept -0.01 0.10 -0.23 0.18 184 1.00
Length_Intercept -0.01 0.10 -0.21 0.17 196 1.01
Survival_FoodLowprotein 0.01 0.14 -0.25 0.30 227 0.99
Survival_Length 0.24 0.69 -1.10 1.62 236 0.99
Survival_Pigmentation 0.14 0.14 -0.16 0.42 262 0.99
Length_FoodLowprotein 0.01 0.14 -0.28 0.29 205 1.01

Family Specific Parameters: 
               Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
sigma_Survival 0.56 0.16 0.38 0.90 156 1.00
sigma_Length 0.52 0.05 0.43 0.63 189 1.01

Residual Correlations: 
                        Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
rescor(Survival,Length) 0.14 0.52 -0.82 0.88 245 0.99

Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample 
is a crude measure of effective sample size, and Rhat is the potential 
scale reduction factor on split chains (at convergence, Rhat = 1).

```

- Operating System: Ubuntu 18.04
- brms Version: 2.6.0

---

<div class="post-metadata">

**Author:** ![LucC](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/lucc/32/4475_2.png) [@LucC](https://discourse.mc-stan.org/u/LucC)\
**Post date:** [February 28, 2019, 8:29am UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863/2 "2019-02-28T08:29:02Z")

</div>

The reference category of your two-level categorical predictor “Food” is captured in the intercept. The coefficient for Food is simply the estimated difference between the two levels, corrected for the impact of other predictors (if any).

Or I’m misunderstanding your q

---

<div class="post-metadata">

**Author:** ![mluerig](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mluerig/32/4173_2.png) [@mluerig](https://discourse.mc-stan.org/u/mluerig)\
**Post date:** [February 28, 2019, 9:12am UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863/3 "2019-02-28T09:12:18Z")

</div>

Yes, I think that’s what I mean.

So “Survival\_Intercept” and “Length\_Intercept” are reference categories for Food, and “Survival\_FoodLowprotein” and “Length\_FoodLowprotein” are estimates for differences between both factor levels within each response?

---

<div class="post-metadata">

**Author:** ![strengejacke](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/strengejacke/32/559_2.png) [@strengejacke](https://discourse.mc-stan.org/u/strengejacke)\
**Post date:** [February 28, 2019, 10:45am UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863/4 "2019-02-28T10:45:09Z")

</div>

> [@mluerig](#):
>
> “Survival\_Intercept” and “Length\_Intercept”

Not exactly, the intercept is the predicted mean of the response when _all_ other predictors have the value “0” (or are at reference level, for factors). The estimates of your factor `Food` are the effect of the given category (`FoodLowprotein`) compared to the reference level of `Food`.

---

<div class="post-metadata">

**Author:** ![Petulla](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Petulla](https://discourse.mc-stan.org/u/Petulla)\
**Post date:** [February 28, 2019, 9:59pm UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863/5 "2019-02-28T21:59:21Z")

</div>

Do you mind posting exactly how the original model is specified for reproduction? Curious how this is put together. Thanks.

---

<div class="post-metadata">

**Author:** ![mluerig](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mluerig/32/4173_2.png) [@mluerig](https://discourse.mc-stan.org/u/mluerig)\
**Post date:** [March 1, 2019, 11:12am UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863/6 "2019-03-01T11:12:20Z")

</div>

Now it’s clear - thanks!

---

<div class="post-metadata">

**Author:** ![mluerig](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mluerig/32/4173_2.png) [@mluerig](https://discourse.mc-stan.org/u/mluerig)\
**Post date:** [March 1, 2019, 11:16am UTC](https://discourse.mc-stan.org/t/estimate-of-all-levels-of-categorical-variable-from-brm-summary/7863/7 "2019-03-01T11:16:05Z")

</div>

@Petulla I’ve added the model specs to the post
