Try this


stdev = SQRT((fSumSqr - SQR(fSum) / iCount) / (iCount - 1));

if correlation index is equal to correlation coefficient then
corrcoef = ( fSumXY - fSumX*fSumY/iCount ) / SQRT( (fSumXSqr - SQR(fSumX)/iCount) * (fSumYSqr - SQR(fSumY)/iCount) );


be carefully about denominator, can't be zero!!! but if numerator is also equal zero then corrcoef = 1 because all zeros have "perfect" correlation.

fSumSqr - sum of all squared values
fSum - sum of all values
iCount - number of values (elements)
fSumXY - sum of all X * Y
fSumX - sum of all X values
fSumY - sum of all Y values
fSumXSqr - sum of all X squared values
fSumYSqr - sum of all Y squared values

Hope, it helps you.

Regard Stefan Majtan


************************************************************************** TERRIS Mapinfo Reseller GIS Applications Development

Pod záhradkami 24
909 01 Skalica
SLOVAKIA
tel.: 0905-677 923
http://www.terris.sk





On Wed, 5 Nov 2003 21:54:13 -0000, Jim Wilson <[EMAIL PROTECTED]> wrote:

Hi all,
I have a table of regularly spaced points each of which has numerous
different attributes. I am interested in the local spatial correlations
between these attributes so I'm writing a mbx to calculate the R squared
value for each point. To do this I'm looping through the table, selecting
each point in turn then selecting all the points within e.g. 40 meters of
this point and then calculating a set of figures from this local selection.
The basis of these figures is the standard deviation and the R squared value
(correlation index).


So the question is:
Does anyone have an example of calculating the standard deviation and
correlation index of a column (or even a function ) or a suggestion of an
easy way to go about this?

I'm statistically a virgin so be gentle! (don't know if that's quite what I
meant to say....)


TIA

Jim

Jim Wilson
Hilton of Fern,
Brechin. Angus, Scotland

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 29-Sep-03


--------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 9042



--



--------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 9044



Reply via email to