How Band Collection Statistics works

Available with Spatial Analyst license.

The Band Collection Statistics tool provides statistics for the multivariate analysis of a set of raster bands. When the Compute covariance and correlation matrices option is enabled, the covariance and correlation matrices are output as well as the basic statistical parameters, such as the values of minimum, maximum, mean, and standard deviation for every layer. When the Compute histogram option is enabled, histogram statistics will be calculated and added to the output statistics file. If an output histogram table is specified, an output table containing histogram information will be created. If an output histogram name is specified, histogram charts will be created and added to the table of contents.

The covariance matrix contains values of variances and covariances. The variance is a statistical measure showing how much variance there is from the mean. To calculate these variances, the squares of the differences between each cell value and the mean value of all cells are averaged. The variances for every layer can be read along the diagonal of the covariance matrix moving from the upper left to the lower right. The variances are expressed in cell-value units squared.

The remaining entries within the covariance matrix are the covariances between all pairs of input rasters. The following formula is used to determine the covariance between layers i and j:

Formula for covariance between layers i and j
  • where:

    Z - value of a cell

    i, j - are layers of a stack

    ยต - is the mean of a layer

    N - is the number of cells

    k - denotes a particular cell

The covariance of two layers is the intersection of the appropriate row and column. The covariance between layers 2 and 3 is the same as the covariance between layers 3 and 2. The values of the covariance matrix are dependent on the value units, while the values of the correlation matrix are not.

The correlation matrix shows the values of the correlation coefficients that depict the relationship between two datasets. In the case of a set of raster layers, the correlation matrix presents the cell values from one raster layer as they relate to the cell values of another layer. The correlation between two layers is a measure of dependency between the layers. It is the ratio of the covariance between the two layers divided by the product of their standard deviations. Because it is a ratio, it is a unitless number. The equation to calculate the correlation is as follows:

Equation to calculate the correlation

Correlation ranges from +1 to -1. A positive correlation indicates a direct relationship between two layers, such as when the cell values of one layer increase, the cell values of another layer are also likely to increase. A negative correlation means that one variable changes inversely to the other. A correlation of zero means that two layers are independent of one another.

The correlation matrix is symmetrical. Its diagonal from the upper left to lower right is 1.0000 since the correlation coefficient of identical layers is +1.

Output statistics file examples

The output statistics file supports two output formats, the comma-separated values (CSV) format, or the Markdown format. The following are examples of the output statistics files of these formats, for a four-band input raster.

CSV output

When the output statistics file is specified as a text file (with file extension as .txt, .csv, or .asc), it will be saved using a comma-separated values (CSV) format, allowing it to be imported to other software (such as Excel) for further analysis or visualization.

The following is the content of a text file created with both the Compute covariance and correlation matrices option and the Compute histogram option disabled. The source data paths of the input layers are listed at the top of the file.

Output Band Collection Statistics

Input Layers

Layer,Path
Layer_1,C:\example\mb_data.tif\Band_1
Layer_2,C:\example\mb_data.tif\Band_2
Layer_3,C:\example\mb_data.tif\Band_3
Layer_4,C:\example\mb_data.tif\Band_4

Statistics of Individual Layers

Layer,Min,Max,Mean,Std. Dev.
1,48.00000,255.00000,73.70110,11.90945
2,22.00000,255.00000,33.73108,7.49241
3,17.00000,255.00000,31.77404,11.40892
4,13.00000,255.00000,82.51136,17.67144

Markdown output

The output statistics file will be saved using a Markdown format if the file extension is specified as .md.

The following is the content of a Markdown file created with the Compute covariance and correlation matrices option enabled and the Compute histogram option disabled, when viewed as a plain text file.

# Output Band Collection Statistics

### Input Layers

|   Layer |                          Path |
| ------: | ----------------------------: |
| Layer_1 | C:\example\mb_data.tif\Band_1 |
| Layer_2 | C:\example\mb_data.tif\Band_2 |
| Layer_3 | C:\example\mb_data.tif\Band_3 |
| Layer_4 | C:\example\mb_data.tif\Band_4 |

### Statistics of Individual Layers

| Layer |      Min |       Max |     Mean | Std. Dev. |
| ----: | -------: | --------: | -------: | --------: |
|     1 | 48.00000 | 255.00000 | 73.70110 |  11.90945 |
|     2 | 22.00000 | 255.00000 | 33.73108 |   7.49241 |
|     3 | 17.00000 | 255.00000 | 31.77404 |  11.40892 |
|     4 | 13.00000 | 255.00000 | 82.51136 |  17.67144 |

### Covariance Matrix

| Layer |         1 |         2 |         3 |         4 |
| ----: | --------: | --------: | --------: | --------: |
|     1 | 141.83498 |  86.72548 | 131.13040 | -54.33298 |
|     2 |  86.72548 |  56.13628 |  84.01048 | -24.88371 |
|     3 | 131.13040 |  84.01048 | 130.16340 | -53.35075 |
|     4 | -54.33298 | -24.88371 | -53.35075 | 312.27971 |

### Correlation Matrix

| Layer |        1 |        2 |        3 |        4 |
| ----: | -------: | -------: | -------: | -------: |
|     1 |  1.00000 |  0.97193 |  0.96509 | -0.25817 |
|     2 |  0.97193 |  1.00000 |  0.98280 | -0.18794 |
|     3 |  0.96509 |  0.98280 |  1.00000 | -0.26462 |
|     4 | -0.25817 | -0.18794 | -0.26462 |  1.00000 |

Markdown output after rendering

The following is an example of what the output file in a Markdown format looks like after rendering. This output file is created with the Compute histogram option enabled and the Compute covariance and correlation matrices option disabled.

Markdown output after rendering
An example is shown of the output statistics file in a Markdown format after rendering. Only a portion of the fields and rows are shown.

Additional resources

See the following for more information:

Snedecor, G. W., and W. G. Cochran. 1968. Statistical Methods, 6th ed. Ames, Iowa: The Iowa State University Press.

Related topics