stan-dev / stan-dev/projpred

`get_refmodel()` for GAMMs: `object not found` error

Open
#148 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.