iterateHydOrder {sharpshootR} | R Documentation |
Iteratively Attempt Hydrologic Ordering of Geomorphic Proportion Matrix
Description
Iteratively Attempt Hydrologic Ordering of Geomorphic Proportion Matrix
Usage
iterateHydOrder(
x,
g,
target = 0.9,
maxIter = 20,
j.amount = 0.05,
verbose = FALSE,
trace = FALSE
)
Arguments
x |
|
g |
name of geomorphic summary table, one of: |
target |
numeric, target match rate |
maxIter |
integer, maximum number of perturbations of geomorphic probability matrix |
j.amount |
numeric, amount of noise applied to rows with too few unique values, passed to |
verbose |
logical, additional output printed via message |
trace |
logical, additional list of results for each iteration |
Details
This function is used by the suite of geomorphic proportion visualization functions (viz*
) to attempt rotation of a dendrogram according to "hydrologic ordering" rules. A perfect rotation is not always possible, and reported as a match rate in the returned score
value
Value
A list
with the following elements:
-
clust
: rotatedhclust
object -
hyd.order
: vector of series names, in hydrologic ordering -
clust.hyd.order
: vector of series names, after clustering + rotation, approximate hydrologic ordering -
match.rate
: fraction of series matching target hydrologic ordering, after clustering + rotation -
obj
: objective function value (sum of squared rank differences), used byiterateHydOrder()
-
niter
: number of iterations -
trace
: list of results by iteration, only whentrace = TRUE
Author(s)
D.E. Beaudette
Examples
# example data, similar to results from soilDB::fetchOSD(..., extended = TRUE)
data("OSDexamples")
# single iteration of hydrologic ordering
h1 <- hydOrder(OSDexamples$hillpos, g = 'hillpos', clust = TRUE)
# perform several iterations, keep the best one
h2 <- iterateHydOrder(OSDexamples$hillpos, 'hillpos', verbose = TRUE)
# compare: only slightly better match rate achieved
h1$match.rate
h2$match.rate
# return trace log for eval of objective function
# increase max iterations
h2 <- iterateHydOrder(OSDexamples$hillpos, 'hillpos', maxIter = 100, verbose = TRUE, trace = TRUE)
# inspect objective function evolution
tr <- h2$trace
obj <- sapply(tr, '[[', 'obj')
plot(obj, type = 'b')
hist(obj)
# in this case the clustering of hillpos proportions has only two possible configurations