regression specific priors

8 views
Skip to first unread message

Adam Moore

unread,
Mar 31, 2026, 8:59:58 AM (2 days ago) Mar 31
to blavaan
Hi all,

I've got quite a complex model, but when I try to specify specific priors on the regression / mediation components, bsem() seems to always ignore them:

# direct effects
RS.f ~ c1.p2*prior("dnorm(0,1)")*D.m
RS.f ~ c2.p2*prior("dnorm(0,1)")*P.m
RS.f ~ c3.p2*prior("dnorm(0,1)")*L.m

# mediators
PSP.f ~ a1.p2*prior("dnorm(0,1)")*D.m
PSP.f ~ a2.p2*prior("dnorm(0,1)")*P.m
PSP.f ~ a3.p2*prior("dnorm(0,1)")*L.m
RS.m  ~  b.p2*prior("dnorm(0,1)")*PSP.f

# indirect effects (a*b)
ab1.p2 := a1.p2*b.p2
ab2.p2 := a2.p2*b.p2
ab3.p2 := a3.p2*b.p2

# total effect
total.mf := c1.p2 + c2.p2 + c3.p2 + ab1.p2 + ab2.p2 + ab3.p2

These result in default priors. Even if I use stan as the target, still get N(0, 10) instead of anything I specify manually. Am I missing something obvious?

Thanks,
Adam

Ed Merkle

unread,
Mar 31, 2026, 9:35:30 AM (2 days ago) Mar 31
to blavaan
Adam,

I believe the issue is that you can't specify a parameter label and a prior all at once. Instead, try a line like

RS.f ~ c1.p2*D.m + prior("dnorm(0,1)")*D.m

Ed

Adam Moore

unread,
Mar 31, 2026, 9:46:34 AM (2 days ago) Mar 31
to blavaan
Perfect, thanks!
Reply all
Reply to author
Forward
0 new messages