Setting priors for multi-logistic (categorical) model

Hi,

I’m new to using the brms package and still learning and experimenting a lot.

I am trying to set a (horseshoe) prior on the population-level coefficients for a multi-logistic regression model with 4 outcome categories. I figured I need to use the resp argument to do this, but this gave me an error message.

> #horseshoe prior for shrinkage and varselection
> prior<-c(set_prior("horseshoe()",  resp="muFollowupmedicaltherapyorbiopsy"),
+          set_prior("horseshoe()", resp="muHysteroscopicalresection"),
+          set_prior("horseshoe()", resp="muUrgentbiopsy"))
> 
> fit_horseshoe <-
+   brm(
+     SuggestedManagement ~ ieta_hist.age + knot + bmi + invisible.endometrium + bright.edge +     col.score     + single.dominant + non.uniform  + cyst + endometrial.thickness
+     + (1 | rater),
+     data = model1data,
+     prior=prior,
+     family = categorical()
+   )

Rows containing NAs were excluded from the model.Error: The following priors do not correspond to any model parameter: 
b_muFollowupmedicaltherapyorbiopsy ~ horseshoe()
b_muHysteroscopicalresection ~ horseshoe()
b_muUrgentbiopsy ~ horseshoe()
Function 'get_prior' might be helpful to you.

Using the get_prior function was indeed helpful, and showed me the resp column was blank when using the default priors, but dpar was filled in with the outcome category names. Using the dpar argunent in the set_prior function gives me results with face validity if I rerun the model.

prior<-c(set_prior(“horseshoe()”, dpar=“muFollowupmedicaltherapyorbiopsy”),
set_prior(“horseshoe()”, dpar=“muHysteroscopicalresection”),
set_prior(“horseshoe()”, dpar=“muUrgentbiopsy”))

However, it is not clear to me why I couldn’t use the resp statement. The brms reference manual seems to indicate that priors should be set using resp for categorical models. To be honest, I don’t understand what using dpar= does, and seem to find little information. I’d appreciate any help to understand better.

  • Operating System: Windows 10 Enterprise version 1511 64-bit
  • brms Version: 2.3.1

Best wishes,
Laure

You just have one response variable, which is SuggestedManagement. In univariate models (i.e. models with only one response) resp will be blank to simplify specification of priors. The mu1 etc. parameters are distributional parameters not responses, since they correspond to different aspects of the same response variable.

Great, thanks, that explains it then. I was going for resp because the reference manual states the following for set_prior:

resp Name of the response variable / category. Only used in multivariate and categorical models.
dpar Name of a distributional parameter. Only used in distributional models

Thank you very much for your prompt and clear reply. I really love the package!

Laure

You are right. The doc is misleading. I fixed that. The reason is that categorical models used to use the resp argument one or two years back and apparently I didn’t fix the doc in all places.

I’m having problems setting priors and I actually do have more than one outcome:

priors = c(prior(student_t(4,0,10), class = “Intercept”),
prior(student_t(4,0,5), class = “b”),
prior(student_t(4,0,5), class = “sd”))

m1 ← brm(cbind(y1,y2)~ x1 + x2 + x3,
(1|group1) + (1|group2),
data=data,prior = priors)

This yields the following error:

Setting ‘rescor’ to TRUE by default for this model
Error: The following priors do not correspond to any model parameter:
sd ~ student_t(4, 0, 5)
Function ‘get_prior’ might be helpful to you.
In addition: Warning message:
Rows containing NAs were excluded from the model.

I think it’s an issue with the multivariate response because running this model for a single outcome works fine:

m1 ← brm(y1~ x1 + x2 + x3,
(1|group1) + (1|group2),
data=data,prior = priors)

Is there something else I need to do to set a prior on the sd parameters?

The problem is because brms (on purpose) does not support setting a global SD prior for all responses. You can see this if you run get_prior for your model. Instead, if you want to set priors on SD parameters, you have to do that separately for each response using the “resp” argument.

1 Like

Ok, makes sense. I was able to adjust the prior on the SD parameters using the “resp” argument. Thanks.