Summary functions that return a scalar when passed with two portions of two rasters. Typically passed to CMP.
Usage
dist_euclidean(x, y, ...)
dist_manhattan(x, y, ...)
dist_chebyshev(x, y, ...)
dist_bhat(x, y, bins = 10, ...)
dist_identical(x, y, ...)
dist_different(x, y, ...)
dist_diff(x, y, ...)
cor_pearson(x, y, ...)
cor_pearson_uniform_equals_NA(x, y, ...)
kappa_index(x, y, ...)
diff_rmse(x, y, ...)
diff_mean(x, y, ...)
diff_median(x, y, ...)
diff_var(x, y, ...)
diff_cv(x, y, ...)
p_student(x, y, min_nb = 5, ...)
p_wilcoxon(x, y, min_nb = 5, ...)
kappa_index_cppr(x, y, ...)
dist_euclidean_cppr(x, y, ...)
dist_manhattan_cppr(x, y, ...)
dist_chebyshev_cppr(x, y, ...)
diff_rmse_cppr(x, y, ...)Details
First of all, you can use built-in function,
as long as they return a single value such as cor.
cor_pearsonis pearson correlation coefficient. Note than for uniform window(s) this will return 1, not NA. See below.cor_pearson_uniform_equals_NAis same as above but return NA whensd=0for one or two windows having uniform values, which is likely to happen for small sample sizes.kappa_index/kappa_index_cppris Cohen's Kappadist_identicalproportion of identical value, pixel wisedist_differentproportion of different value, pixel wisedist_diff(signed) difference, pixel wisedist_euclidean/dist_euclidean_cppreuclidean distance (sqrt of sums of squared diff pixel-wise, divided by the number of valid pixels)dist_manhattan/dist_manhattan_cpprmanhattan distance (sum of absolute distances pixel-wise, , divided by the number of valid pixels)dist_chebyshev/dist_chebyshev_cpprChebyshev's distance (max of absolute distances pixel-wise)dist_bhatBhattacharyya's distance based on distribution distances calculated using nbinsdiff_rmse/diff_rmse_cpprroot-mean square error pixel-wisediff_meandifference of mean valuesdiff_meandifference of mean valuesdiff_vardifference of variance valuesdiff_cvdifference of coefficient of variation valuesp_studentp value from a Student t testp_wilcoxonp value from a Wilcoxon rank sum test
Naturally, you can also use built-in function, as long as they return a single value such as: cor,
Examples
set.seed(2329) # for reproducibility
x <- sample(1:3, size=49, replace=TRUE, prob=c(0.1, 0.1, 1)) # unbalanced vector
y <- sample(1:3, size=49, replace=TRUE, prob=c(0.1, 0.1, 1)) # another one
# examples runs mostly to test and exemplify
# but in CMP they will run on each pair of focal windows
# built in functions
cor(x, y)
#> [1] -0.2023918
cov(x, y)
#> [1] -0.08418367
# kappa agreement
kappa_index(x, y)
#> [1] -0.0864745
kappa_index_cppr(x, y)
#> [1] -0.0864745
# distance indices
dist_euclidean(x, y)
#> [1] 0.1443075
dist_euclidean_cppr(x, y)
#> [1] 0.1443075
dist_manhattan(x, y)
#> [1] 0.6122449
dist_manhattan_cppr(x, y)
#> [1] 0.6122449
dist_chebyshev(x, y)
#> [1] 2
dist_chebyshev_cppr(x, y)
#> [1] 2
dist_bhat(x, y)
#> [1] 0.01055561
# difference indices
diff_rmse(x, y)
#> [1] 1.010153
diff_rmse_cppr(x, y)
#> [1] 1.010153
diff_mean(x, y)
#> [1] 0.122449
diff_median(x, y)
#> [1] 0
diff_var(x, y)
#> [1] -0.210034
diff_cv(x, y)
#> [1] -0.07160757
# p value from Student t test
p_student(x, y)
#> [1] 0.3572371
p_wilcoxon(x, y)
#> [1] 0.5229461
