# calculates the exchange matrix between pairs of categories

### Description

calculates the exchange matrix between pairs of categories from a contingency table derived from the crosstabulation between a comparison variable (or variable at time *t*), and a reference variable (or variable at time *t*+1).
Exchange consists of a transition from category *i* to category *j* in some observations and a transition from category *j* to category *i* in an identical number of other observations.

### Usage

1 | ```
exchangeDij(ctmatrix)
``` |

### Arguments

`ctmatrix` |
matrix representing a square contingency table between a comparison variable (rows) and a reference variable (columns) |

### Value

a matrix containing exchange occurring between pairs of categories from the comparison variable and the reference variable. Exchange is shown in the lower triangle of the output matrix. Output values are given in the same units as `ctmatrix`

### References

Pontius Jr., R.G., Santacruz, A. 2014. *Quantity, exchange and shift components of difference in a square contingency table*. International Journal of Remote Sensing 35 (21), 7543-7554.

### See Also

`exchangeDj`

### Examples

1 2 3 4 | ```
comp <- raster(system.file("external/comparison.rst", package="diffeR"))
ref <- raster(system.file("external/reference.rst", package="diffeR"))
ctmatCompRef <- crosstabm(comp, ref)
exchangeDij(ctmatCompRef)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.