`as.matrix.projection()` for GAMs: Naming scheme of parameters
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 114
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
For GAMs, as.matrix.projection() does not follow brms's naming scheme (discussed in #75):
On branch develop (commit 96d8e11d6f0ad0a1f7836c51700cb676b364bee5), 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.
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 with as.matrix.projection() and the project() path shown in the GAM reprex, then compare its column names with colnames(as.matrix(fit_gauss)). Review the naming discussion in #75 and the related rstanarm issues; done means the projected GAM matrix follows the brms naming scheme consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100