caitobrien / HydroSurvDOYTEMP

Seasonal Predictions of SAR & T:I for Chinook salmon and Steelhead
0 stars 0 forks source link

Select proper predict function for BRMS #15

Closed caitobrien closed 9 months ago

caitobrien commented 9 months ago

BRMS, and the wrapper function tidybayes, offer three different methods of posterior predictions (posterior_predict()/predicted_draws(), posterior_epred()/epred_draws(), and posterior_linpred()/ linpred_draws()). The guide by Andrew Heiss provides an explanation of each prediction and where it is drawing from the model and is summarized nicely in this image:

Screenshot 2023-12-12 at 3 30 22 PM

However, I'm still unclear on when and why to choose one over the other and was hoping for more discussion. From your previous SurvDOY code, using the predict() with a glm,posterior_linpred(transform = TRUE) most closely matches using a bayesian binomial model, with similar results usingposterior_epred. Whereas, using posterior_predict(), predict(), or predicted_draws() will all give a predicted response of no. of alive per trial and then I would need to calculate further for probability.

I ran out of time at the end of the day, but I'll plan to add a paired-down script to highlight the differences. The guide is the main thing I'd like to discuss further so wanted to send that out now.

caitobrien commented 9 months ago

I added an Rmarkdown with different prediction types and an additional question about adding new data for predicting to the binomial model using (alive | trial) format and if I should set trials at a mean number or include a range of values. Here is the file link: compare_posteriorpredictions.Rmd ; located in HydroSurvDOYTEMP>examples>src

JLGnotes commented 9 months ago

I think some of the answers you're looking for can be found here: https://www.andrewheiss.com/blog/2022/09/26/guide-visualizing-types-posteriors/

Let's chat some more...

caitobrien commented 9 months ago

Going forward selecting posterior_linpred and setting a mean trial = 1 for predictions.