Lognormal model of reaction times

Bayesian workshop - STEP 2023

Scott James Perry

University of Alberta

By the end of this lesson, you will be able to…

  • Fit a lognormal model of reaction times using brms
  • Choose reasonable priors in the log space through iterative prior predictive simulation

Why a lognormal model?


  • We often log-transform our data (especially reaction times)

  • Why is this normally done?

  • Using lognormal distribution similar

  • Has some advantages

We place priors in the context of the likeilood

  • Priors are always interpreted in the context of the likelihood function
  • Before that meant the original scale (milliseconds)
  • Now we’re dealing with the log space (non-linear transformation)



model_fit <- brm(...,
                 family = lognormal(link = "identity", 
                                    link_sigma = "identity"),
                 ...)

Setting priors in the log space


  • In lognormal model, a constant change (linear effect) is not linear in milliseconds
  • This can make sense, but it’s important to remember when setting priors



exp(6)
[1] 403.4288
exp(7)
[1] 1096.633
exp(8)
[1] 2980.958

Remember, don’t try and be clever. Simulate what your priors mean together in your model

  • Understanding prior assumptions trends towards impossible as model complexity grows
  • Choose priors that seem reasonable, and simulate a prior predictive check

Let’s go set some priors in the log space



Open up script S4_E1_lognormal_priors.R