align_arc.Rd
align_arc()
matches archetypes in arc2 to arc1 by solving a bipartite matching problem on euclidian distances between archetypes.
gen_permut()
used for exhaustive search generates a matrix of all possible permutations of n elements. Each row is a different permutation.
align_arc(arc1, arc2, type = c("lpsolve", "exhaustive")[1]) gen_permut(n)
arc1 | reference matrix of archetype positions dim(dimensions, archetypes) |
---|---|
arc2 | matrix of archetype positions dim(dimensions, archetypes) to be aligned with arc1 |
type | method for finding matching vertices. Linear programming (lpsolve) or exhaustive search (do not use for more than 10 vertices) |
n | number of element to permute |
align_arc()
list containing: total distance between archetypes in arc1 and arc2 (dist), integer vector specifying indices of archetypes in arc2 that match archetypes in arc1 (ind)
gen_permut()
a matrix of all possible gen_permut (in rows)
gen_permut()
function is taken from https://stackoverflow.com/questions/11095992/generating-all-distinct-permutations-of-a-list-in-r
# Generate data set.seed(4355) archetypes = generate_arc(arc_coord = list(c(5, 0), c(-10, 15), c(-30, -20)), mean = 0, sd = 1) data = generate_data(archetypes$XC, N_examples = 1e4, jiiter = 0.04, size = 0.9) dim(data)#> [1] 2 10000# fit polytopes to 2 subsamples of the data arc_data = fit_pch_bootstrap(data, n = 2, sample_prop = 0.65, seed = 2543, order_type = "align", noc = as.integer(6), delta = 0, type = "s") # align archetypes align_arc(arc_data$pch_fits$XC[[1]], arc_data$pch_fits$XC[[2]])#> $dist #> [1] 43.15206 #> #> $ind #> [1] 1 2 3 4 5 6 #>