Open itowers1 opened 2 years ago
Very nicely documented @itowers1 ! The MWE is awesome and I can repeat behaviour here. In future plans also post a pic of output. Here is a figure generated from the code above:
This behaviour is curious. My initial sense is that cumulative mortality should never decrease. As per eq 24-25 in https://traitecoevo.github.io/plant/articles/demography.html, cumulative mortality is solved as an initial value problem, with initial value of $y(0) = - \ln\left(S_{\rm G} (x, H0, E{a0})\right)$ and $\frac{dy}{dt} = d(x, H_i(t) , E_t)$. So the only way mortality could decrease is
First let's check option 1 $d<0$
The equation for mortality suggests this isn't possible, unless a.
(BTW - the code above needed a slight tweak to run .....
out <- purrr::map_df(upper_trait_value, find_mortality_monotonic) %>%
mutate(species1_trait = 0.07, species2_trait = upper_trait_value)
out %>%
pivot_longer(cols = c(sp1, sp2), names_to = "species") %>%
mutate(sp2_sp1_lma_diff = species2_trait - species1_trait) %>%
ggplot() +
geom_line(aes(x = sp2_sp1_lma_diff, y = value, group = species, col = species), size = 1.5) +
xlim(-0.05, 0.15) +
theme_classic() +
geom_vline(xintercept = 0, col = "orange", size = 1, linetype = 2) +
ylab("Proportion of cohorts with monotonic mortality~time curves")
)
I've confirmed that mortality rate never goes negative. I added the following code into compute_rates
function in cohort.h
here:
if (plant.rate("mortality") < 0) {
std::cout << plant.rate("mortality") <<" ";
}
Nothing prints to screen!
(but it does if I ask it to print with mortality > 0, just to check print is working)
Mortality is non-monotonic in certain instances when looking at communities of two species. In the standard one species case, we find that all mortality~time curves are monotonic (i.e. monotonic object below is all TRUE). This was conducted in the tidy_patch branch.
However, if we inspect a two species case (and just species one in this case), we find at least ten cohorts, such as cohort 100, with non-monotonic curves.
Is this possibly related to the relative trait values of the species. If we hold species 1 constant at lma = 0.07, and compare to higher and lower trait values, it looks like the proporiton of cohorts with monotonic mortality~time curves declines as the difference in trait values increases
In the figure below, the orange line represents when sp1 and sp2 have no difference in LMA (i.e. both lmas are 0.7)