I have a quick follow-up to this practice that I hope is easy to answer. If I have a variable that is coded as an integer, for example

library(tidyverse)

library(brms)

library(bayesplot)

df <- setNames(data.frame(matrix(ncol = 2, nrow = 150)), c(â€śChoiceâ€ť, â€śChoice0â€ť))

df <- df %>% mutate(Choice = rep(c(1,2,3, 1, 1, 3), 25), Choice0 = rep(c(0,1, 2, 0, 0, 2), 25))

Then I model in brms with categorical family, just the intercept

prior1 <- c(prior(normal(0,5), class = â€śInterceptâ€ť, dpar = â€śmu2â€ť), #Normal Priors sample wider range than default student t parameters

prior(normal(0,5), class = â€śInterceptâ€ť, dpar = â€śmu3â€ť)

)

Example1 <- brm(Choice ~ 1,

data = df,

family=categorical(link = â€ślogitâ€ť),

prior= prior1, #defined priors from above

sample_prior=â€śonlyâ€ť,## This skips the likelihood in generating posterior probability sampling

seed = 123

)

pp_check(Example1, type=â€śbarsâ€ť, nsamples = 100)

prior2 <- c(prior(normal(0,5), class = â€śInterceptâ€ť, dpar = â€śmu1â€ť),

prior(normal(0,5), class = â€śInterceptâ€ť, dpar = â€śmu2â€ť)

)

Example2 <- brm(Choice0 ~ 1,

data = df,

family=categorical(link = â€ślogitâ€ť),

prior= prior2, #defined priors from above

sample_prior=â€śonlyâ€ť,## This skips the likelihood in generating posterior probability sampling

seed = 123

)

pp_check(Example2, type=â€śbarsâ€ť, nsamples = 100)

the two figures for pp_check are below.

My question is why the two examples of posterior checks result in two different point estimates for the intercepts? Is it because the intercepts are different? I also noticed that the default for the figure X axis is 1, 2, 3 regardless of the coding for the DV in the model.

Example1 = mu1, mu2

Example2 = mu2, mu3

The model results yield equivalent point estimates as expected

summary(Example1)

summary(Example2)

Family: categorical

Links: mu1 = logit; mu2 = logit Formula: Choice0 ~ 1

Data: df (Number of observations: 150)

Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;

total post-warmup samples = 4000

Population-Level Effects:

Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS

mu1_Intercept 0.09 5.05 -9.93 9.89 1.00 3114 2648

mu2_Intercept 0.04 5.01 -10.13 9.69 1.00 3092 2683

Family: categorical

Links: mu2 = logit; mu3 = logit

Formula: Choice ~ 1

Data: df (Number of observations: 150)

Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;

total post-warmup samples = 4000

Population-Level Effects:

Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS

mu2_Intercept 0.09 5.05 -9.93 9.89 1.00 3114 2648

mu3_Intercept 0.04 5.01 -10.13 9.69 1.00 3092 2683