Unable to assign output from paris.stanfit
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
Output from pairs.stanfit can only be directed to a device, it cannot be assigned to a variable. This ability is present in other implementation pairs() such as mcmc_pairs
Description:
When running pairs.stanfit() the returned object is eval(mc) where mc is of class call. As a result it can't be saved locally, but is displayed to the active device.
This behavior is different than, say, mcmc_pairs, whose output can be directed to a local variable.
Reproducible Steps:
library(rstan)
library(bayesplot)
example(read_stan_csv)
## rd_st_csvfiles <- dir(system.file('misc', package = 'rstan'),
## rd_st_+ pattern = 'rstan_doc_ex_[0-9].csv', full.names = TRUE)
## rd_st_fit <- read_stan_csv(csvfiles)
stanfit_pairs_out <- pairs(fit, pars = c("mu", "sigma", "alpha", "lp__"), log = TRUE, las = 1)
## Warning in par(usr) : argument 1 does not name a graphical parameter
## Warning in par(usr) : argument 1 does not name a graphical parameter
## Warning in par(usr) : argument 1 does not name a graphical parameter
## Warning in par(usr) : argument 1 does not name a graphical parameter
class(stanfit_pairs_out)
## [1] "NULL" ## Current output
mcmc_out <- mcmc_pairs(fit, pars = c("mu", "sigma", "alpha", "lp__"))
class(mcmc_out) ## Expected output
## [1] "bayesplot_grid" "gtable" "gTree" "grob"
## [5] "gDesc"
RStan Version:
packageVersion("rstan")
## [1] ‘2.26.13’
R Version:
R.version.string
## [1] "R version 4.2.2 Patched (2022-11-10 r83330)"
Operating System:
MATE/Ubuntu 22.04
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 at the pairs.stanfit entry point and reproduce the issue with the provided R example, comparing its return value with mcmc_pairs. Confirm that assigning pairs(fit, ...) returns the plotting object rather than NULL while preserving the displayed plot behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100