lizzieinvancouver / wildhellgarden

0 stars 0 forks source link

Trait analysis #5

Open DeirdreLoughnan opened 1 year ago

DeirdreLoughnan commented 1 year ago

@lizzieinvancouver I re-ran the trait model using rstanarm, but the syntax we disucssed:

ldmcMdl <- stan_glmer(LDMC ~ (1|sppFact/popFact), data = ldmcFull)

The rstan model runs fine and very quickly and interestingly it does produce species differences! Below is the plot of the posterior estimates for LDMC.

Screen Shot 2022-11-29 at 2 43 39 PM

All trait plots of the posterior estimates can be found in here, docs/traitsCGRstanarm.pdf

But I guess I did not think we wanted the interactions between pop and spp, would the comparable model to the one produced by Cat's code not be:

ldmcMdl <- stan_glmer(LDMC ~ (1|sppFact) + (1|popFact), data = ldmcFull)

lizzieinvancouver commented 1 year ago

But I guess I did not think we wanted the interactions between pop and spp, would the comparable model to the one produced by Cat's code not be...

@DeirdreLoughnan Ah, good catch! We do have a fully crossed design so we should not nest population within species. Your syntax looks promising to me but I don't actually know lmer syntax that well so cannot confirm. You'd have to look it up somewhere.

DeirdreLoughnan commented 1 year ago

@lizzieinvancouver I have been working on this analysis and tried writing a simple model from scratch and testing it using test data. The results, all of which can be found in the associated pdf are different from the above and do show species level differences.

For example here are the posterior estimates for SLA, with data combined across years.

Screen Shot 2023-01-05 at 1 53 05 PM

I would be happy to chat more about the results (LDMC is a little odd) and next steps with the analysis.

lizzieinvancouver commented 1 year ago

@DeirdreLoughnan Wow! I am very impressed you got the crossed Stan code to work. That's great. And the results look semi-sensical to me. Could you update the associated PDF with figure captions (which trait -- what you think the take home message is from the figure's results) and then hopefully we can try to find time to chat.

DeirdreLoughnan commented 1 year ago

@lizzieinvancouver I added some text to each trait section.

My schedule is very flexible, so I would be happy to chat at a time that works well for you!

lizzieinvancouver commented 1 year ago

@DeirdreLoughnan Thanks! I will try to think on this more before Thursday (busy week, so we'll see). In the meanwhile, am I correct that LDMC is the only trait with pop > sp variation? If so, why do you think that is?

lizzieinvancouver commented 1 year ago

@DeirdreLoughnan Just following up with some more notes having revisited the PDF file you made.

  1. When you write 'only species alive by 2022' does that mean the previous plot for the same trait is ALL the data and the next plot is (as written) -- just the species (with enough individuals?) alive in 2022? If so, I suggest soon to check if there are any big differences between the models and then (if there are not) we can move forward focusing on the all data models (and save the others for the supp or such)? I glanced briefly through some and they looked similar, but we should check. We could also make a script to compare them.
  2. It seemed like there may be some southern vs northern differences, perhaps? I thought I read a few times 'Grant and SH do this, southern sites do that' -- it would be good to see how consistent or not this is across traits. I suggest you add an opening section 'results across traits' where you try to synthesize this and other trends. You could use 50% intervals as a way to say what's similar or not for a first pass.

On my above query about LDMC I realized the models just look wrong to me. Those population values clustered at 300 do not make sense -- if all the populations cluster there then the value should have ended up on mu_grand. I suggest you check your model. I would start by checking priors for mu_grand. Let me know how it goes.