Skip to content
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

possible discrepancy between code and docs | comtrait & combase #5

Open
shawnlaffan opened this issue Mar 15, 2013 · 1 comment
Open
Assignees

Comments

@shawnlaffan
Copy link

Hi Cam,

This could well be me misreading the code, but there appears to be a discrepancy between the docs and the code for comtrait in relation to combase.

NRI for phylo data is (mean_exp - mean_obs) / sd_exp, given in the docs as -1 * (mean_obs - mean_exp) / sd_exp. Large average phylogenetic distances will have large negative NRI values as a result.

The documentation states that the trait equivalent is identical, except it uses trait distances. However, looking at the code it reads (mean_obs - mean_exp) / sd_exp, so large trait distances will have large positive trait NRI values. This is the reverse of the phylo NRI calc.

Lines 161 and 162 of comtrait.c read:
SESSTMetricRnd[samp][trait] = (STMetricObs[samp][trait] - MeanSTMetricRnd[samp][trait]) \ / StDevSTMetricRnd[samp][trait];

Line 1301 of comtrait.c reads:
printf("\t%f", (comDistRndMean[plot1][plot2] - comDist[plot1][plot2])/comDistRndSD[plot1][plot2] );

I'm using revision 90102a5 (latest at the time of writing).

Regards,
Shawn.

@shawnlaffan
Copy link
Author

Hmm. Hit the green button too soon. The docs do have the formula as used on the following page (p20), so most of my initial comment is just noise.

This can be converted to a documentation enhancement request.

It would be useful to change the phrasing The comtrait function works exactly like the comstruct function, but instead of phylogenetic distances within each community, a measure of trait dispersion is calculated to change the term "exactly". Perhaps "in the same way", with a note somewhere nearby to make it clearer that the interpretation of the SESMetric is reversed from the phylo NRI/NTI.

Regards,
Shawn.

@ghost ghost assigned skembel Jun 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants