Description Usage Arguments Details Value Author(s) Examples
Computes the sum of distances between consecutive samples in a multivariate time-series. Required to compute the measure of dissimilarity psi
(Birks and Gordon 1985). Distances can be computed through the methods "manhattan", "euclidean", "chi", and "hellinger", and are implemented in the function distance
.
1 2 3 4 |
least.cost |
character string, name of the column with time/depth/rank data. The data in this column is not modified. |
autosum |
dataframe with one or several multivariate time-series identified by a grouping column. |
parallel.execution |
boolean, if |
The measure of dissimilarity psi
is computed as: least.cost - (autosum of sequences)) / autosum of sequences
. It has a lower limit at 0, while there is no upper limit.
A list with named slots, each one with a psi value.
Blas Benito <blasbenito@gmail.com>
Birks, H.J.B. and Gordon, A.D. (1985) Numerical Methods in Quaternary Pollen Analysis. Academic Press.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #loading data
data(sequenceA)
data(sequenceB)
#preparing datasets
AB.sequences <- prepareSequences(
sequence.A = sequenceA,
sequence.A.name = "A",
sequence.B = sequenceB,
sequence.B.name = "B",
merge.mode = "complete",
if.empty.cases = "zero",
transformation = "hellinger"
)
#computing distance matrix
AB.distance.matrix <- distanceMatrix(
sequences = AB.sequences,
grouping.column = "id",
method = "manhattan",
parallel.execution = FALSE
)
#computing least cost matrix
AB.least.cost.matrix <- leastCostMatrix(
distance.matrix = AB.distance.matrix,
diagonal = FALSE,
parallel.execution = FALSE
)
AB.least.cost.path <- leastCostPath(
least.cost.matrix = AB.least.cost.matrix,
distance.matrix = AB.distance.matrix,
parallel.execution = FALSE
)
#extracting least cost
AB.least.cost <- leastCost(
least.cost.path = AB.least.cost.path,
parallel.execution = FALSE
)
#autosum
AB.autosum <- autoSum(
sequences = AB.sequences,
least.cost.path = AB.least.cost.path,
grouping.column = "id",
parallel.execution = FALSE
)
AB.autosum
AB.psi <- psi(
least.cost = AB.least.cost,
autosum = AB.autosum,
parallel.execution = FALSE
)
AB.psi
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.