AJ said:
I am looking to compute correlation. I have a table with x values and y
values and would like to run something similar to the CORREL function in
EXCEL.
Does anyone have a query like that which works?
I tried the following with the numbers from the example in Excel 97 help
for CORREL:
tblXYData
ID AutoNumber
X Double
Y Double
ID X Y
1 3 9
2 2 7
3 4 12
4 5 15
5 6 17
qryR:
SELECT (1 / Sum(1)) * Sum((X - (SELECT Avg(A.X) FROM tblXYData AS A)) *
(Y - (SELECT Avg(A.Y) FROM tblXYData AS A))) / ((SELECT StDevP(A.X) FROM
tblXYData AS A) * (SELECT StDevP(A.Y) FROM tblXYData AS A)) AS rval FROM
tblXYData;
!qryR:
rval
0.997054485501581
The Excel 97 help file gives an answer of 0.997054
Note: That was the only example I tried.
James A. Fortune
(e-mail address removed)