timcdlucas / INLAutils

R package providing utilities for INLA
Other
26 stars 10 forks source link

No fitted values to plot #61

Closed cperk closed 1 year ago

cperk commented 2 years ago

Hello,

I get the following error when trying to use plot_inla_residuals:

Error in INLAutils::plot_inla_residuals(spat_temp_allyrs_sept272022, datafile.final2_observed) : 
  No fitted values to plot

However, I do have fitted values in my model:

I can view them using:

head(spat_temp_allyrs_sept272022$summary.fitted.values)

Could you please advise?

timcdlucas commented 1 year ago

Hi,

Sorry for the slow reply. This is due to a change in INLA. https://stackoverflow.com/questions/68896556/r-inla-not-computing-fitted-marginal-values

INLA now doesn't return the fitted marginals (only the summaries) by default.

For now you just need to add control.compute = list(return.marginals.predictor=TRUE) to your inla() call. And I need to update the examples to reflect this.

We need the marginals to compute the posterior predictive p values so can't just use the summaries without some careful thought.

cperk commented 1 year ago

thank you!! does inla utils have an easy way to plot the posterior of binomial parameter p against the prior?

timcdlucas commented 1 year ago

Hi, no that's not something we've implemented sorry.