Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom quantiles in inlabru summary and plot functions #127

Open
Martin-Jung opened this issue Dec 1, 2021 · 2 comments
Open

Allow custom quantiles in inlabru summary and plot functions #127

Martin-Jung opened this issue Dec 1, 2021 · 2 comments
Assignees

Comments

@Martin-Jung
Copy link

Martin-Jung commented Dec 1, 2021

By default inlabru calculates a 0.025, 0.5 and 0.975 quantile and uses these measurements in summary functions and plots. However for a specific application I prefer to use other quantiles in the estimation. If I pass on the quantiles to be calculated as an explicit option in inlabru, these are taken into account in the resulting inla call. E.g., via:
inlabru::bru_options_set(quantiles = c(0.05, 0.5, 0.95)) # Set quantiles to be computed

However many of the inlabru functions still have the default quantiles hardcoded in. For instance here or here.
Any model fitted via the custom bru options specified above subsequently results in errors. Calling for instance inlabru:::plot.prediction on a model object with other specified quantiles returns this

Error in exp(spderesult$summary.log.range.nominal[["0.975quant"]]) : 
  non-numeric argument to mathematical function

A solution would be to add grep on the posterior names to get those columns with quant in its name.

@finnlindgren
Copy link
Collaborator

Some words seem to be missing (markdown issue?), but I get the main points, and the predict() output suffers from this issue as well; there's currently no option to safely alter the quantiles (although one can do it via manual processing of generate() output).

  1. The predict method should allow user-defined quantiles
  2. The automated plotting methods should detect the quantiles computed by inla and predict
  3. The predict summary output should be standardised (and an optional broom style tidy() output option/postprocessing method added, even though the naming scheme from https://www.tidymodels.org/learn/develop/broom/#glossary has some terminology issues for Bayesian outputs)

@finnlindgren
Copy link
Collaborator

Part 1. has now been fixed; predict() now takes a probs argument for specifying quantile probabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants