`get_refmodel()` for GAMMs: `object not found` error
Open
Nobody has claimed this yet.
additive
bug
- Dominant language
- R
- Stars
- 114
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
On branch develop (commit 96d8e11d6f0ad0a1f7836c51700cb676b364bee5), this reprex:
options(mc.cores = parallel::detectCores(logical = FALSE))
nobsv <- 40L
set.seed(1235)
df_gamm <- mgcv::gamSim(eg = 6, n = nobsv, dist = "normal", scale = 0)
df_gamm$wobs_col <- sample(1:4, nobsv, replace = TRUE)
df_gamm$y <- rbinom(nobsv, df_gamm$wobs_col, binomial()$linkinv(df_gamm$y))
fit_gamm_binom <- rstanarm::stan_gamm4(
cbind(y, wobs_col - y) ~ s(f0) + s(f1) + s(f2),
random = ~ (f0 | fac),
family = binomial(),
data = df_gamm,
iter = 500,
seed = 943205
)
library(projpred)
refmod <- get_refmodel(fit_gamm_binom)
throws the following error:
Error in eval(formula[[2]], data, environment(formula)) :
object 'wobs_col' not found
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 supplied R reprex with mgcv::gamSim(), rstanarm::stan_gamm4(), and get_refmodel(fit_gamm_binom) to reproduce the wobs_col error. Trace get_refmodel’s GAMM handling and verify that the same example completes without the object-not-found failure.
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
- Needs clarification
- Newbie friendliness
- 30/100