lizzieinvancouver / ospree

Budbreak review paper database
3 stars 0 forks source link

Run the phenology model with mean trait values #425

Closed FaithJones closed 2 years ago

FaithJones commented 2 years ago

We should run the phenology model with mean SLA trait values instead of values estimated from a traits model. This will be useful as a check against the results from the final model, and a backup if the full joint models don't work out.

we need to:

FaithJones commented 2 years ago

@lizzieinvancouver , @dbuona or @cchambe12, could someone point me towards a script that takes the OSPREE data and runs the correct bb model? I have been poking around the repo, but I'm confused. Alternatively, could you tell me:

lizzieinvancouver commented 2 years ago

@FaithJones This code is the main code used in the BB manuscript. Line 52 picks the flags for you ... you can run it through there then inspect the data you end up with:

> str(datalist.bb)
List of 7
 $ y    : num [1:2962] 60 60 60 60 60 60 60 60 60 60 ...
 $ chill: num [1:2962] 1.39 -0.546 0.766 -1.226 1.39 ...
 $ force: num [1:2962] 0.0684 0.0684 0.0684 0.0684 0.0684 ...
 $ photo: num [1:2962] -0.141 -0.141 -0.141 -0.141 -0.141 ...
 $ sp   : num [1:2962] 21 21 21 21 21 21 21 21 21 21 ...
 $ N    : int 2962
 $ n_sp : int 55

But this may not be the species as you want them as it groups some species (that's why there are only 65) .... if you want the species without them being grouped at all you could look at Phylo_ospree_reanalyses.R (in the phylogeny folder) through line 115, then inspect head(bb.stan) ... and subset down to your data. We usually use resp for y, and then force.z photo.z chill.z ... I think @DeirdreLoughnan likely has some similar code for the traits data already though. You might also check out the code that is often sourced which formats the data to feed into the phenology model.

FaithJones commented 2 years ago

I ran a model with phenology data and mean SLA data today. R code is in traits/Rfiles/Phenology_meanTraitValues.R. The model fits with priors somewhere between the wide ones of the bb analysis and the narrow ones of the current full traitors model. I don't think the model is very happy though - the chains are not mixing well for the muCueSp parameters (i.e. muPhotoSp). Also muPhotoSp is highly correlated with betaTraitxPhoto. I also saved some model outputs as a PDF in figures/MeanSLAphenologyPlots.pdf, but I have run out of time (and brain) today to think about what all this means. Maybe we can discuss in our meeting this week?

image

image

lizzieinvancouver commented 2 years ago

@FaithJones Super interesting! Thanks for working on this. Some quick thoughts:

FaithJones commented 2 years ago

@lizzieinvancouver - chilling and forcing also have the same pattern image image

lizzieinvancouver commented 2 years ago

@FaithJones Thanks! In general, I would think that the model may be fine and it simply suggests our data cannot tease out a trait versus no-trait relationship with cues (that is, the combo of our data and this model is non-identifiable). Your traitors team would want to dig a little deeper but to me these posteriors could suggest that these outcomes along this line are feasible: really negative muCueSp values offset by a positive trait relationship, or really positive muCueSp values offset by a negative trait relationship.

All that said generally I did look at joint_phenoonly.stan and I don't think we should be running the phenology model with forcing alone. The OSPREE data really requires estimating chill, force and photoperiod together. Let me know if I am mis-interpreting what you're doing though. Otherwise, I wouldn't run with any estimates using only part of the phenology model.

FaithJones commented 2 years ago

@lizzieinvancouver a quick answer: I used the joint_3cue_phenoonly.stan model with 3 cues combined for this modeling

FaithJones commented 2 years ago

We discussed this model in length today. The co-variance between the meCueSp parameters and the BetaTraitxCue parameters is concerning but understandable considering the model structure. @lizzieinvancouver, we were not sure what you meant about the offsets - could you elaborate? We are not sure if this collinearity means we can't interpret the model, or if we can not worry about it if there are no other problems with the model. We had a look at the results anyway, and saw that (according to the model) species with high SLA are more sensitive to chilling and forcing, which aligns with our expectation.

My next steps (ideally before our next meeting) are:

FaithJones commented 2 years ago

I ran prior predictive checks in Phenology_meanTraitValues.R on the current priors in traits/Rfiles/Phenology_meanTraitValues.R, for use with the stan model joint_3cue_phenologyonly.stan. I'm fairly happy with the distribution of the predicted values against the three cues - the all fall between -200 and 600 days. I realize negative days don't make much sense, but the bulk of the data falls within the 0-365 mark. We could tighten some of the priors a bit more though if needed.

FaithJones commented 2 years ago

@legault and @DeirdreLoughnan I checked my mean traits phenology code, and I didn't have the merging problem. The results should be good to be compared with the full model results now.

FaithJones commented 2 years ago

We met last week to discuss this model. I haven't managed to get it to find all the simulated values. The problem lies in overestimating some muCueSp and underestimating betaTraitxCue. Sometimes the model gets it right, other times the simulated values are very different from the estimated values. After our last meeting I tried setting the priors as centred on the simulation values, and I tried changing the trait to actual trait value instead of offset value. No luck so far. We also had a quick look at how some of the parameters in this mean only model compare to the full SLA model, and found the species slopes were generally quite similar.