H.K.D.H. Bhadeshia,
Phase Transformations Group,
Department of Materials Science and Metallurgy,
University of Cambridge,
Cambridge, U.K.
MAP_UTIL_ANALY is a linear regression subroutine which determines the intercept and gradient of the best fit line between two variables, together with the correlation coefficient.
Language: | FORTRAN |
Product form: | Source code |
The best fit line for a set containing N(x,y) pairs of data is found by minimising the root mean square error, for the equation:
y = mx + c
where m=SLOPE and c=CONST.
m = {{N sum xy - sum x sum y}/{N sum x2 - sum x sum x}}
c = {{sum y sum x2 - sum x sum xy}/{(N sum x2 - sum x sum x)}}
The correlation coefficient R is given by:
R = {{N sum xy - sum x sum y}/{(N sum x2 - sum x sum x){0.5} (N sum y2 - sum y sum y){0.5}}}
None supplied.
The number of x,y pairs cannot exceed 100, the dimension of the arrays X and Y.
No informatin supplied.
Uses same method as NAG Library routine G02CAF
G02CAF(N, X, Y, RESULT, IFAIL)
where N is the number of (x,y) pairs, and RESULT is an array of dimension 20 containing details of the mean and standard deviation, and standard error, as well as CONST, SLOPE, and CORR.
To calculate the best fit line.
DOUBLE PRECISION CONST,SLOPE,CORR,X(100),Y(100) INTEGER J8,J9,JP J8=5 J9=0 JP=1 DO 10 I=1,J8 READ(*,*) X(I),Y(I) 10 CONTINUE CALL MAP_UTIL_ANALY(J8,J9,CONST,SLOPE,CORR,X,Y) WRITE(6,20) CONST,SLOPE,CORR 20 FORMAT('INTERCEPT=',D12.4,' SLOPE=',D10.3,' CORRELATION=',F8.4) STOP END
1.0 2.0 3.0 5.5 5.0 11.0 8.0 14.0 9.0 18.0
INTERCEPT=0.2455D+00 SLOPE=0.1895D+01 CORRELATION=0.9869
None.
linear regression
MAP originated from a joint project of the National Physical Laboratory and the University of Cambridge.
MAP Website administration / map@msm.cam.ac.uk