Skip to content

model_parameters not displaying smooth parameter for brms additive model when bs is supplied to the smooth #1191

@yuee289

Description

@yuee289

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions