# Conditional\_effects: level over other fixed effects

**URL:** <https://discourse.mc-stan.org/t/conditional-effects-level-over-other-fixed-effects/13488>\
**Category:** brms\
**Created:** [March 3, 2020, 2:08pm UTC](https://discourse.mc-stan.org/t/conditional-effects-level-over-other-fixed-effects/13488 "2020-03-03T14:08:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex\_hausmann](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@alex\_hausmann](https://discourse.mc-stan.org/u/alex_hausmann)\
**Post date:** [March 3, 2020, 2:08pm UTC](https://discourse.mc-stan.org/t/conditional-effects-level-over-other-fixed-effects/13488/1 "2020-03-03T14:08:26Z")

</div>

Operating System: Windows 10 x64 (build 18363)  
R Version: 3.6.1  
brms Version: brms\_2.11.1

Hi all,

sorry, I have a beginners question. I am running a multinomial (categorical) model, where a categorical decision is explained by three fixed effects (without interactions). I want to extract the conditional\_effects of each fixed effect, while ignoring the effect of the other fixed effects.  
It seems a very simple thing to do, but I can’t figure out how. I guess the answer lies in how I define the conditions argument in conditional\_effects.

Here a little example simulation showing my problem. The left side (for factor “A”) of all the conditional\_effects plots looks the same.

Greetings, Alex

```
library(brms)
set.seed(42)
#Sample fixed effects
resp2type<-data.frame(type1=sample(c("A","B"),200,replace=T),
                      type2=sample(c("A","B"),200,replace=T),
                      type3=sample(c("A","B"),200,replace=T))

#Calculate number of As and Bs per row
sumA<-rowSums(resp2type=="A")
sumB<-rowSums(resp2type=="B")

#Add response column, where probability of response depends somewhat on number of As and Bs
resp2type$resp<-sapply(1:200,function(x) sample(c("r1","r2","r3"),
                                                prob=0.5+c(sumA[x],sumA[x]+sumB[x],sumB[x]),
                                                1,replace=T))

#Multinomial model
mod1<-brm(resp ~ type1 + type2 + type3, data = resp2type, 
          family="categorical",chains=3, iter=5000, warmup=2500)

#Conditional effects. The effects of "A" are the same for all three fixed effects!
conditional_effects(mod1,"type1",categorical=T)
conditional_effects(mod1,"type2",categorical=T)
conditional_effects(mod1,"type3",categorical=T)

```

PS: If I run the following, I see that the left side in each plot is the result if type1, type2 and type3 are “A” (first factor of each column)

`conditional_effects(mod1,conditions=make_conditions(resp2type,vars=c("type2","type3")),"type1",categorical=T)`

---

<div class="post-metadata">

**Author:** ![alex\_hausmann](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@alex\_hausmann](https://discourse.mc-stan.org/u/alex_hausmann)\
**Post date:** [March 9, 2020, 9:29pm UTC](https://discourse.mc-stan.org/t/conditional-effects-level-over-other-fixed-effects/13488/2 "2020-03-09T21:29:42Z")

</div>

I think I found the solution myself.  
This forum entry here helped me:

> [@How do I get "marginal\_effects" for categorical variables to condition on an average rather than a category?](https://discourse.mc-stan.org/t/how-do-i-get-marginal-effects-for-categorical-variables-to-condition-on-an-average-rather-than-a-category/5323):
>
> Please also provide the following information in addition to your question: Operating System: Mac OS Sierra brms Version: 2.4.0 (I think) Hi! I ran an experiment where I obtained perceptual data on listeners’s sensitivity for recognizing a token in two different levels of noise (low and high). I have two types of tokens from three speakers ( for example “pat”/“bat”. In total I therefore have 12 datapoints per listener (2 levels noise x two tokens x 3 speakers. Let’s say the following model …

I changed the global contrasts to  
options(contrasts = c(“contr.sum”, “contr.poly”))  
before running brm. Then, later in the conditional\_effects, to look at e.g. the effect of type1 alone, I used:  
conditional\_effects(mod1, effects = “type1”, re\_formula = NULL,categorical=T,conditions = data.frame(type2 = NA, type3= NA))

Now, the reference is not always the same and makes sense!
