You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: