Skip to content

as.matrix.projection() for GAMs: Naming scheme of parameters #152

Open
@fweber144

Description

@fweber144

For GAMs, as.matrix.projection() does not follow brms's naming scheme (discussed in #75):

On branch develop (commit 96d8e11), this reprex:

options(mc.cores = parallel::detectCores(logical = FALSE))
library(brms)
data(kidiq, package = "rstanarm")
fit_gauss <- brm(formula = kid_score ~ s(mom_iq),
                 data = kidiq,
                 seed = 469230)

library(projpred)
prj <- project(fit_gauss, solution_terms = c("s(mom_iq)"),
               ndraws = 25)
colnames(as.matrix(prj))

gives

 [1] "b_Intercept"   "b_s(mom_iq).1" "b_s(mom_iq).2" "b_s(mom_iq).3"
 [5] "b_s(mom_iq).4" "b_s(mom_iq).5" "b_s(mom_iq).6" "b_s(mom_iq).7"
 [9] "b_s(mom_iq).8" "b_s(mom_iq).9" "sigma"

whereas

colnames(as.matrix(fit_gauss))

gives

 [1] "b_Intercept"    "bs_smom_iq_1"   "sds_smom_iq_1"  "sigma"         
 [5] "s_smom_iq_1[1]" "s_smom_iq_1[2]" "s_smom_iq_1[3]" "s_smom_iq_1[4]"
 [9] "s_smom_iq_1[5]" "s_smom_iq_1[6]" "s_smom_iq_1[7]" "s_smom_iq_1[8]"
[13] "lp__"

Just a side note: As may be seen in issues #150 and #151, rstanarm uses a different naming scheme. It might make sense to have separate naming schemes depending on whether the reference model inherits from a "stanreg", a "brmsfit", or some different object. (In the latter case, one could use either rstanarm's or brms's naming scheme.) But that's probably a larger change and may be deferred to the future. I think for now, using brms naming scheme consistently should be enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    additiveIssues concerning additive models (GAMs and GAMMs).enhancementEnhancements of existing features, but also new feature requests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions