-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hill # NaN in genetic and trait results #121
Comments
Indeed, for the genetic diversity hill #s if there are any '0' in the vector of raw pi values within a given timestep then this fails because of
'q' values other than 1 are perfectly happy with zeros in the pi vector. In MESS I just ignore pi==0 values and I think this is justifiable. This is also how Update: I pushed a fix for the genetic diversity Hill's, simply removing 0s from the vector. |
For trait hills, you get 'NaN' in the case where there is only 1 species present in the local community. If there's only 1 species present then in |
After wrestling (philosophically) with whether it makes sense to try to hatch a trait diversity for when there is a single species, or whether to simply build in a catch to send single-species communities to evaluate to 0, I'm leaning towards just building in the catch sending single-species to evaluate to zero. Considerations:
|
Amending: I think it should evaluate to 1, yes? Weighting by trait diversity is moot in this instance, so it should converge back to abundance (which evaluates to 1 anyway). |
See b0ddd3f. I feel like there's room for spirited discussion re: the interpretation of trait hill numbers in a single-species community, though! :P |
agreed. In the case of no trait variation it should be 1. |
Getting sneakier, b1ba083. This one catches both edge cases: if there is only one species, or if there are multiple species all with the same trait. (Seems extreme but possible in special circumstances, like a super narrow optimum). In this instance, it effectively reverts to abundance hill numbers. |
I could be convinced in this instance (no trait, but species, variation) it should be something else, though. 1 for that, too? |
(hillR::hill_func just fails in this instance, btw) |
IDK, I think conceptuall if there is literally zero trait variation then I would say it should be 1. If you think about it from the perspective of # of 'effective species traits' then it would be 1. |
This is a super hard one to figure out! After perhaps too much effort, I agree that for "effective number of species" (i.e. weighted Hill) the answer should be 1, both from the perspective of 1 species, or multiple species but with no trait variation. I went deep down a rabbit hole on this (nothing against rabbits!) The short answer is that unweighted hill goes to 0 both for 1 species and multiple species with no trait variance. (Script below showing that). But weighted hill is Here's the script
So this says that as trait variation between species goes to 0, so too does Hill diversity go to 0. But again, this is for unweighted hill. Now for a single species:
Here again, for a single species Hill diversity goes to 0. But again these calculations are for unweighted Hill. For weighted Hill, I convinced myself the answer is indeed equal to 1 because D_hill and Q go to 0 at the same rate. |
OH! Something important though that's coming out of this is: right now we're returning unweighted Hill numbers right? So is that what we want to do, or do we want to switch to returning weighted Hills? |
Damn! I been working on this more and I was wrong about weighted trait Hill for the case no variation: weighted trait Hill for the case with no variation might equal weighted abundance-based Hill with the same SAD...still working on it, stay tuned, or if you all have it figured out, even better! |
Generalized Hills, that's my vote. The interpretation is very natural.
…On Thu, Jun 1, 2023 at 2:31 PM Andy Rominger ***@***.***> wrote:
One thing for sure though we have to pick a column (attribute diversity or
generalized hill):
[image: image]
<https://user-images.githubusercontent.com/2481785/242692425-0791c9a8-9045-43a5-a48e-ee408441f2cf.png>
—
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNSXP3UGFHNXNT2V5RXHBLXJDNYDANCNFSM6AAAAAAYK2NKVA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I agree with Isaac about generalized hills. |
also agree with both of you about using generalized hills! so this means we need to revise the trait and phylo hill numbers to return the generalized value (currently they return the "attribute diversity" from Chao's table). the abundance hill function (and thus the gen div hill) returns the generalized value because the generalized and attribute div for abundance are equivalent |
and my final thought on hill numbers when trait variation is absolutely 0 is that the generalized number should indeed be 1. if you all are good to go with that, let's go for it |
Unless I'm mistaken, the trait hill number function is already returning generalized hills! e4b7a47 implements a check if the trait diversity is 0 (which would occur if species richness is 0, or if trait diversity is 0) and returns 1 for all q. I'll work on phylo next! |
right you are about generalized hills! don't know how i convinced myself otherwise! |
Run this:
The this
getSumStats(model)
and some genetic diversity and trait Hill's for some timesteps will be 'NaN'. It is non-deterministic, and we assume it's because perhaps there is no variation in these values at a given timestep?The text was updated successfully, but these errors were encountered: