transport_plan_multimarg {approxOT} | R Documentation |
Multimarginal optimal transport plans
Description
Multimarginal optimal transport plans
Usage
transport_plan_multimarg(
...,
p = 2,
ground_p = 2,
observation.orientation = c("rowwise", "colwise"),
method = c("hilbert", "univariate", "sliced"),
nsim = 1000
)
Arguments
... |
Either data matrices as separate arguments or a list of data matrices. Arguments after the data must be specified by name. |
p |
The power of the Wasserstein distance to use |
ground_p |
The power of the Euclidean distance to use |
observation.orientation |
Are observations by rows or columns |
method |
One of "hilbert", "univariate", or "sliced" |
nsim |
Number of simulations to use for the sliced method |
Value
transport plan
Examples
set.seed(23423)
n <- 100
d <- 10
p <- ground_p <- 2 #euclidean cost, p = 2
x <- matrix(stats::rnorm((n + 11)*d), n + 11 , d)
y <- matrix(stats::rnorm(n*d), n, d)
z <- matrix(stats::rnorm((n +455)*d), n +455, d)
# make data a list
data <- list(x,y,z)
tplan <- transport_plan_multimarg(data, p = p, ground_p = ground_p,
observation.orientation = "rowwise", method = "hilbert")
#' #transpose data works too
datat <- lapply(data, t)
tplan2 <- transport_plan_multimarg(datat, p = p, ground_p = ground_p,
observation.orientation = "colwise",method = "hilbert")
[Package approxOT version 1.1.1 Index]