lizzieinvancouver / ospree

Budbreak review paper database
3 stars 0 forks source link

Check and visualize range models #463

Open dbuona opened 3 months ago

dbuona commented 3 months ago

Okay @DeirdreLoughnan and @lizzieinvancouver. I have cleaned up the rangers modeling into a reasonable workflow called jointmodelingranges.R.

The models all run. woot woot. The two things I could use major help on is 1) making sure they are doing what we think they are doing. 2) How to visualize/assess the importance of the range climate in influencing each cue. Would something like Figure 3 and Figure 4 from the rangers manuscript capture this? Happy to find a time to zoom if it is better to work on this together.

Just for a little more information: The kind of predictions we want to evaluate include:

  1. Species from areas with high spring variation (STV and SD gdd to last frost) have stronger photoperiod and chilling cues.
  2. Species with lots of chilling and forcing in their range have higher chilling and forcing cues respectively
  3. the overall importance of these climate range variables in influencing the cue responses (and if they are different in North Amer. vs Europe)
lizzieinvancouver commented 3 months ago

@dbuona Great! We're going to revisit after @DeirdreLoughnan comes back from vacation. So... 10-12 days we'll re-appear.

DeirdreLoughnan commented 2 months ago

@lizzieinvancouver @dbuona I started working on the rangers figures, but I have some basic questions about the modeling and might need a refresher on what we wanted to model.

  1. Perhaps I am misremembering, but I had thought the ranges model was essentially the same as the trait model , but it appears that the ranges model just has the second part of the trait model. Do we not want to estimate the species level variation (mu_grand_sp) and use that to estimate the betaCuesp, like we do in the trait model?
for(i in 1:n_spec){
    mu_grand_sp[i] = mu_grand + muSp[i];
  }
  for (i in 1:N){
    y_hat[i] = mu_grand + muSp[trait_species[i]] + muStudy[study[i]];
  }
  // Phenology
  for (isp in 1:n_spec){
    betaForceSp[isp] = alphaForceSp[isp] + betaTraitxForce * (mu_grand_sp[isp]);
  }
  ...
  1. Why are we modeling the North America and Europe separately?
lizzieinvancouver commented 2 months ago

@DeirdreLoughnan Thanks for your help! I think I can tackle these so I will, but @dbuona can correct me if I am wrong.

Do we not want to estimate the species level variation (mu_grand_sp) and use that to estimate the betaCuesp, like we do in the trait model?

The equivalent data to the trait part of the model here is the range climate, but we realized we don't really want to estimate the range climate in a model because it is not necessary -- we pulled the range climate, that's the climate and there's no clear reason to try to estimate it in a model. So the model is the same as the trait model in that they both use data on species to help predict phenological responses, but different in that we do not estimate the trait part -- we just assume we know it and plug it in.

Why are we modeling the North America and Europe separately?

It seemed annoying to build a new model that would fit them together (because then `species' is something that needs to be nested in a continent, and that seems hard -- I cannot see how to do it without new columns for species from NA and species from Europe and then it gets weird). I think we did think about this for a while, but if you have obvious ideas, go for it. Otherwise, keeping them separate seems easiest.

dbuona commented 2 months ago

That's what I would have said too.

DeirdreLoughnan commented 2 months ago

@dbuona @lizzieinvancouver I have been slowly working my way through reviewing the models. On first pass, it seemed to me that some of the priors were a little tight. I would still like to do some more work on the prior predictive checks, but the wider prior version of the code runs faster for all the models and I think the figures look better.

I have started code to make the figures we would like (figures for North America are here). The code for the plots with and without range effects is here. Geoff suggested updating the legend in the trait ms with a more succinct version, which I quickly implemented here as well. I see the merit of it and can update the trait ms figures, but let me know if you have other suggestions or prefer the original:

Screenshot 2024-08-30 at 3 59 37 PM

I am hoping to finish the ppc over the weekend and then once we are happy with the models we can loop the figure code to run for all the different models.

lizzieinvancouver commented 2 months ago

@DeirdreLoughnan Amazing! Thanks for your help on this. @dbuona If you have time to run the updated models before we meet that would be great.

dbuona commented 2 months ago

@DeirdreLoughnan truly spectacular. Thank you so much. I am running the models now so Lizzie and I can play with them while she is in Boston

lizzieinvancouver commented 1 month ago

@DeirdreLoughnan Thanks for your help on this! @dbuona and I met today and I made code for the multispecies plots. I would REALLY appreciate you checking my work as I did this quickly. It would also be great to add a third row that is the first part of the decompose figures we have. Do you know what variables that should be?

Our overall take homes today were (I may be forgetting some):

DeirdreLoughnan commented 1 month ago

@dbuona @lizzieinvancouver awesome! This sounds like it was an exciting meeting!

I like this plan, let me know how I can help with the writing! For now I will:

I can work on this early next week when I get back from my work retreat!

lizzieinvancouver commented 1 month ago

@DeirdreLoughnan Sounds great! (If cleaning traitors fully takes forever, a README that spells out in use files for all analyses and figures could be a good quicker fix. See issue #464 ).

lizzieinvancouver commented 13 hours ago

@DeirdreLoughnan Finally finalized the figures that I started on in September. It looks like the model is working as we think to me. @DeirdreLoughnan Can you add Europe? @dbuona Do we need any other figures?