Reloading `stanreg` objects cannot be used with `bridgesampling::bridge_sampler`
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 401
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
Summary:
Reloading stanreg objects cannot be used with bridgesampling::bridge_sampler.
Description:
When saving a stanreg model, with a defined diagnostic_file, and reloading it into a new R session, bridgesampling::bridge_sampler does not run even though the diagnostic file is available.
Reproducible Steps:
library(rstanarm)
count_data <- data.frame(
counts = c(18,17,15,20,10,20,25,13,12),
outcome = gl(3,1,9),
treatment = gl(3,3)
)
fit <- stan_glm(
counts ~ treatment + outcome,
data = count_data,
family = poisson(link="log"),
diagnostic_file = "df.csv"
)
bridgesampling::bridge_sampler(fit)
#> Iteration: 1
#> Iteration: 2
#> Iteration: 3
#> Iteration: 4
#> Iteration: 5
#> Bridge sampling estimate of the log marginal likelihood: -38.62193
#> Estimate obtained in 5 iteration(s) via method "normal".
saveRDS(fit,"fit.rds")
Close R and restart.
library(rstanarm)
fit <- readRDS("fit.rds")
bridgesampling::bridge_sampler(fit)
#> Error in .local(object, ...) :
#> the model object is not created or not valid
RStanARM Version:
packageVersion("rstanarm")
#> [1] '2.18.2'
R Version:
getRversion()
#> [1] '3.5.3'
Operating System:
Windows 10
Contributor guide
No contributing guide indexed for this repository
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 reproducing the failure with the supplied rstanarm example: save and reload the stanreg object, then call bridgesampling::bridge_sampler with the diagnostic file present. The payload names no source files or tests, so trace the reload path and bridge_sampler integration before deciding where to work. Done means the reloaded object runs bridge_sampler successfully.
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
- Mostly clear
- Newbie friendliness
- 35/100