Learn R Programming

gridOT (version 1.0.2)

otgrid: 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
)

Value

object of class "otgrid". It contains the following elements:

xvector of support points of the first marginal
yvector of support points of the second marginal
nnumber of support points of the first marginal
mnumber of support points of the second marginal
massmatrix of non-negative weights
totaltotal mass

Also note that the functions print and plot are available for objects of class "otgrid".

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.

See Also

plot plot.otgrid

Examples

Run this code
x <- otgrid(cbind(1:2, 0, 3:4), remove.zeros = TRUE)

print(x) # note that it's only 2 x 2 
plot(x)

Run the code above in your browser using DataLab