diffeR (version 0.0-6)

diffMetrics: Overall difference metrics and difference metrics at the category level or between pairs of categories

Description

Overall difference metrics (overallAllocD, overallDiff, overallDiffCatj, overallExchangeD, overallQtyD, overallShiftD) and difference metrics at the category level (exchangeDj, quantityDj, shiftDj, omissionj, commisionj, agreementj) or between pairs of categories (exchangeDij) calculated using a square 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)

Usage

exchangeDij(ctmatrix)
exchangeDj(ctmatrix)
overallAllocD(ctmatrix)
overallDiff(ctmatrix)
overallDiffCatj(ctmatrix)
overallExchangeD(ctmatrix)
overallQtyD(ctmatrix)
overallShiftD(ctmatrix)
quantityDj(ctmatrix)
shiftDj(ctmatrix)
omissionj(ctmatrix)
comissionj(ctmatrix)
agreementj(ctmatrix)

Value

exchangeDij returns 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.

exchangeDj returns a numeric vector containing the exchange difference between the comparison variable and the reference variable at the category level.

overallAllocD returns the overall allocation difference between the comparison variable and the reference variable.

overallDiff returns the overall difference between the comparison variable and the reference variable.

overallDiffCatj returns a numeric vector containing overall difference between the comparison variable and the reference variable at the category level.

overallExchangeD returns the overall exchange difference between the comparison variable and the reference variable.

overallQtyD returns the overall quantity difference between the comparison variable and the reference variable.

overallShiftD returns the overall shift difference between the comparison variable and the reference variable.

quantityDj returns a numeric vector containing the quantity difference between the comparison variable and the reference variable at the category level.

shiftDj returns a numeric vector containing the shift difference between the comparison variable and the reference variable at the category level.

omissionj returns a numeric vector containing the omission disagreement between the comparison variable and the reference variable at the category level.

comissionj returns a numeric vector containing the comission disagreement between the comparison variable and the reference variable at the category level.

agreementj returns a numeric vector containing the agreement between the comparison variable and the reference variable at the category level.

For all the functions above, the output values are given in the same units as ctmatrix.

Arguments

ctmatrix

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

Details

exchangeDij calculates the exchange matrix between pairs of categories from a square 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.

exchangeDj calculates exchange difference at the category level from a square 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.

overallAllocD calculates overall allocation difference from a square 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). Allocation difference is defined as the amount of difference between a reference variable and a comparison variable that is due to the less than maximum match in the spatial allocation of the categories, given the proportions of the categories in the reference and comparison variables. Allocation difference is equivalent to the addition of the exchange and shift components of difference (i.e., allocation difference can be disaggregated into exchange and shift components).

overallDiff calculates overall difference from a square 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). Overall difference is equivalent to the addition of the quantity and allocation components of difference (i.e., overall difference can be disaggregated into quantity and allocation components).

overallDiffCatj calculates overall difference at the category level from a square 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). Overall difference is equivalent to the addition of the quantity and allocation components of difference (i.e., overall difference can be disaggregated into quantity and allocation components).

overallExchangeD calculates overall exchange difference from a square 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.

overallQtyD calculates overall quantity difference from a square 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). Quantity difference is defined as the amount of difference between the reference variable and a comparison variable that is due to the less than maximum match in the proportions of the categories.

overallShiftD calculates overall shift difference from a square 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). Shift refers to the difference remaining after subtracting quantity difference and exchange from the overall difference.

quantityDj calculates quantity difference at the category level from a square 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). Quantity difference is defined as the amount of difference between the reference variable and a comparison variable that is due to the less than maximum match in the proportions of the categories.

shiftDj calculates shift difference at the category level 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). Shift refers to the difference remaining after subtracting quantity difference and exchange from the overall difference.

omissionj calculates omission error at the category level 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). Omission error refers to observations in the reference variable that were classified in a category other than their true or known category, in other words, observations of a known category that were excluded from that category due to misclassification.

comissionj calculates comission error at the category level 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). Commission error refers to observations that were incorrectly classified and do not belong in the category in which they were assigned according to the classification.

agreementj calculates agreement at the category level 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).

References

Pontius Jr., R.G., Millones, M. 2011. Death to Kappa: birth of quantity disagreement and allocation disagreement for accuracy assessment. International Journal of Remote Sensing 32 (15), 4407-4429.

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

diffTablej

Examples

Run this code
comp <- raster(system.file("external/comparison.rst", package="diffeR"))
ref <- raster(system.file("external/reference.rst", package="diffeR"))
ctmatCompRef <- crosstabm(comp, ref)

exchangeDij(ctmatCompRef)
exchangeDj(ctmatCompRef)
overallAllocD(ctmatCompRef)
overallDiff(ctmatCompRef)
overallDiffCatj(ctmatCompRef)
overallExchangeD(ctmatCompRef)
overallQtyD(ctmatCompRef)
overallShiftD(ctmatCompRef)
quantityDj(ctmatCompRef)
shiftDj(ctmatCompRef)
omissionj(ctmatCompRef)
comissionj(ctmatCompRef)
agreementj(ctmatCompRef)

Run the code above in your browser using DataCamp Workspace