Program: CORMAP Purpose: Check whether there is a correlation between two maps Category: ANALYSIS, CALCULATION File: cormap.c Author: M. Vogelaar Keywords: INSET= Give set, subsets: Maximum number of subsets is 2048. BOX= Give box: [entire subset] RANGE= Give range of levels to include in calculation: [all] Input consists of two values. The first value may be greater than the second. See the description for the correct use of this keyword. INSET2= Give set, subsets: Number of subsets and subset dimension must be equal to INSET= The size of INSET2= must be greater than or equal to the size of BOX= otherwise a new set will be asked. BOX2= Give box in ..... [defaults by program] The size of the second box must be equal to the size of the first box. If the edges of BOX= are contained within INSET2=, then the defaults are these edges, else the default are the maximum sizes of BOX= RANGE2= Give range of levels to include in calculation: [all] Range of levels for second (sub)set. GRDEVICE= Plot device: [List of devices] Destination of plot, Screen or Hardcopy. PGMOSAIC= View surface sub divisions in x,y: [1,1] View surface can contain a number of plots in in X and Y direction (mosaic). Default is 1 plot in both X- and Y direction. PGPAPER= Give width(cm), aspect ratio: [calc, calc] Aspect ratio is height/width. PGBOX= Corners of box Xl,Yl,Xh,Yh: [default by application] It is possible to overrule the calculated PGPLOT box size with PGBOX=. The coordinates (x,y) of the lower point are given first. PGCOLOR= Give color 1..15: [1] See description for the available colors. PGWIDTH= Give line width 1..21: [1] PGHEIGHT= Give character height: [1.0] PGFONT= Give font 1..4: [2] Description: CORMAP makes a diagram with pixel values of two (sub)sets plotted against each other. The pixels have data ranges as given in RANGE= and RANGE2= Furthermore, it calculates the regression lines y=ax+b and x=cy+d, the deviations from these lines and the linear correlation coefficient r. If r = 1 or r = -1, there is perfect positive resp. negative correlation. If r = 0, there is total absence of correlation. The square root of the variance is calculated, where the variance is given by: 2 1 2 S = ----- SUM[ (Yi - a - b*Xi) ] n - 2 If n is the number of valid data pairs in the regression, the significance of r is the probability Pc(r,n) that the data points could represent a sample from an uncorrelated parent population: Pc(r,n) < 5% is significant. Pc(r,n) < 1% is highly significant. Pc(r,n) < 0.1% is very highly significant. In most cases with large n, this probability is so small, that 0(%) is printed. The applied statistic t = r * sqrt( n-2 / 1-r**2 ) is distributed in the case of the null-hypothesis (of no correlation) like Student's t-distribution with v = n-2 degrees of freedom. The two sided significance level is given by Pc(r,n). References: -Kreyszig, E., Introductory Mathematical Statistics Chapter 17, 18. -Press, H. et al, Numerical Recipes, Chapter 14. -Bevington, P., Data Reduction and Error Analysis for the Physical Sciences, Chapter 7. -Ractliffe, J., Elements of Mathematical Statistics Chapter 16. The number of input subsets and the dimension of the subsets must be equal. The box sizes must be equal. Blanks in either one of the subsets will not be plotted and are not taken into calculation. Examples of the use of the RANGE= keyword: RANGE=2, 5 (IF 2blank) RANGE=5, 2 (IF 2blank ELSE use this value) At the RANGE= keyword, the values -INF and INF can be input also. These values represent the minimum and maximum values of the current system. RANGE=5, INF (IF value>5 THEN use this value ELSE value==>blank) Color indices for PGCOLOR= 0 Background 1 Default (Black if background is white) 2 Red 3 Green 4 Blue 5 Cyan 6 Magenta 7 Yellow 8 Orange 7 Yellow 8 Orange 9 Green + Yellow 10 Green + Cyan 11 Blue + Cyan 12 Blue + Magenta 13 Red + Magenta 14 Dark Gray 15 Light Gray 16-255 Undefined Available fonts for PGFONT= 1 single stroke "normal" font 2 roman font 3 italic font 4 script font Notes: Example: cormap CORMAP INSET=hi1277 1 CORMAP BOX= CORMAP INSET2=hi1277 2 CORMAP BOX2= CORMAP GRDEVICE=g Statistics ========== Data points diagram : n = 100 Regression Y on X : Y = +0.9804 (+/-0.0357) X + -2.1644 (+/-0.3035) Regression X on Y : X = +0.9026 (+/-0.0328) Y + +1.9823 (+/-0.2978) Linear corr. coeff. : r = 0.940727 Significance of r : Pc(r,n) = 0.0(%) Pc(r,n) < 5% is significant. Pc(r,n) < 1% is highly significant. Pc(r,n) < 0.1% is very highly significant. CORMAP +++ FINISHED +++ Updates: May 7, 1992: VOG, Document created. Jul 27, 1999: VOG, Increased length of message for longer box text.