otgrid {gridOT} | R Documentation |
Two-dimensional Grid with Mass
Description
Create an object that represents a probability measure that is supported on a two-dimensional grid.
Usage
otgrid(
mass,
x = NULL,
y = NULL,
sorted = FALSE,
normalize = FALSE,
remove.zeros = FALSE
)
Arguments
mass |
matrix of non-negative weights. |
x |
vector of support points of the first marginal. |
y |
vector of support points of the second marginal. |
sorted |
logical value specifying whether or not the support points are sorted. |
normalize |
logical value specifying whether or not the total mass should be rescaled to 1. |
remove.zeros |
logical value specifying whether or not marginals with no mass should be removed from the grid. |
Details
If x
and y
are not specified, then a equispaced unit grid is chosen.
Value
object of class "otgrid"
. It contains the following elements:
x | vector of support points of the first marginal |
y | vector of support points of the second marginal |
n | number of support points of the first marginal |
m | number of support points of the second marginal |
mass | matrix of non-negative weights |
total | total mass |
Also note that the functions print
and plot
are available for objects of class "otgrid"
.
See Also
plot plot.otgrid
Examples
x <- otgrid(cbind(1:2, 0, 3:4), remove.zeros = TRUE)
print(x) # note that it's only 2 x 2
plot(x)
[Package gridOT version 1.0.1 Index]