Transforming a prior before model fit

Hello all,
I am running a metanalysis on some log transformed probabilities. As part of re-analysis, I would like to sample from a uniform of [0,1] and log odds transform it, so it conceptually fits with the way data are created.
So far I have got the following

sensitivity.uniform.formula <- bf(
  log.odds | se(log.se) ~ log(p) + (1 | study_id / exp_id),
  p ~ 1,
  nl = TRUE
)

sensitivity.student.model <- brm(
  formula = log.odds | se(log.se) ~ 1 + (1 | study_id / exp_id),
  data = base.df,
  prior = prior = c(
    prior(uniform(0, 1), nlpar = "p"),
    prior(cauchy(0, 0.5), nlpar = "p", class = "sd")
  )
)

I keep getting errors on missing sd parameters, and I guess it has to do with how I define the formula. Is there a way to define the model such that it samples from a uniform and then log odds transforms it ?

Hi and welcome to discourse.

I don’t quite understand your question yet, because different parts of it seem to be saying different things.

  • When you mention “sampling from a uniform of [0,1] and then log odds transforming it”, I think what you mean is placing a prior on a parameter such that if the parameter is interpreted as a log-odds, then the prior is uniform on the probability scale. It seems that this parameter in your model might just be the intercept. If that’s what you want–a model with an intercept whose prior would transform to a uniform distribution on the probability scale–just place a standard logistic prior on the intercept. See Unbounded Continuous Distributions
  • However, in the first sentence of your question you say “log transformed probabilities”, and in your model formula you have a log(p). This makes me worry I’ve misunderstood. The logarithm of a probability p and the log odds are two different things.
  • In your brm call to create sensitivity.student.model, I notice a few odd things.
    • you have a line that says prior = prior = ...
    • your prior includes a nlpar p but there’s no p in the formula passed to this call.

In summary, if you want to fit a gaussian model to the log odds, and you want the prior on the intercept to correspond to a uniform distribution on the probability scale, then use a formula like log.odds ~ 1 and place a standard logistic prior on the intercept.