easystats / easystats/parameters
`model_parameters` not displaying smooth parameter for brms additive model when `bs` is supplied to the smooth
Open
Nobody has claimed this yet.
3 investigators :grey_question::question:
Bug :bug:
- Dominant language
- R
- Stars
- 499
- Forks
- 45
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 3
Description
Everything works fine for model fitted withmgcv but not with brms
library("brms")
library("parameters")
library("ordPens")
library("mgcv")
data("ChickWeight")
fit <- gam(
weight ~ s(as.ordered(Time), bs = "ordinal") + s(Chick, bs = "re"),
data = ChickWeight
)
model_parameters(fit)
# # Fixed Effects
# Parameter | Coefficient | SE | 95% CI | t(525.77) | p
# ------------------------------------------------------------------------
# (Intercept) | 121.27 | 3.85 | [113.70, 128.84] | 31.47 | < .001
# # Smooth Terms
# Parameter | F | df | p
# ---------------------------------------------
# Smooth term (Time) | 256.86 | 6.88 | < .001
# Smooth term (Chick) | 10.90 | 44.35 | < .001
brmsfit <- brm(
bf(weight ~ s(as.ordered(Time), bs = "ordinal") + s(Chick, bs = "re")),
data = ChickWeight
)
model_parameters(brmsfit, effects = "full", component = "all")
# # Fixed Effects
# Parameter | Median | 95% CI | pd | Rhat | ESS
# ------------------------------------------------------------
# (Intercept) | 121.24 | [113.10, 129.45] | 100% | 1.006 | 361
# # sigma Parameters
# Parameter | Median | 95% CI | pd | Rhat | ESS
# ---------------------------------------------------------
# sigma | 27.75 | [26.17, 29.54] | 100% | 0.999 | 6027
# Uncertainty intervals (equal-tailed) computed using a MCMC
# distribution approximation.
The parameter would reappear if bs is removed
brmsfit2 <- brm(
bf(weight ~ s(Time) + s(Chick, bs = "re")),
data = ChickWeight
)
model_parameters(brmsfit2, effects = "full", component = "all")
# # Fixed Effects
# Parameter | Median | 95% CI | pd | Rhat | ESS
# -------------------------------------------------------------
# (Intercept) | 121.31 | [113.46, 128.53] | 100% | 1.010 | 338
# sTime_1 | 237.81 | [159.69, 307.29] | 100% | 1.002 | 1418
# # sigma Parameters
# Parameter | Median | 95% CI | pd | Rhat | ESS
# ---------------------------------------------------------
# sigma | 27.64 | [26.03, 29.37] | 100% | 1.000 | 3027
# Uncertainty intervals (equal-tailed) computed using a MCMC
# distribution approximation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the ChickWeight reproductions for mgcv and brms, comparing model_parameters() output with and without bs on the smooth. Trace how brms smooth terms are identified and displayed; done means the ordinal smooth parameter appears for the brms model while existing output remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100