## The following code illustrates four different ways to define
## the same matrix of intervals through IntervalMatrix() function.
## In particular, the following 2x2 interval-valued matrix is defined:
## | [0, 2] [0, 4] | = | [1 -+ 1] [2 -+ 2] |
## | [1, 3] [3, 9] | = | [2 -+ 1] [6 -+ 3] |
## Using inf/sup characterization variable by variable
data1 <- matrix(c(0, 1, 2, 3, 0, 3, 4, 9), 2, 4)
matrix1 <- IntervalMatrix(data1); matrix1
## Using mid/spr characterization variable by variable
data2 <- matrix(c(1, 2, 1, 1, 2, 6, 2, 3), 2, 4)
matrix2 <- IntervalMatrix(data2, type = 2); matrix2
## Storing all the infimums first and then all the supremums
data3 <- matrix(c(0, 1, 0, 3, 2, 3, 4, 9), 2, 4)
matrix3 <- IntervalMatrix(data3, type = 3); matrix3
## Storing all the mid-points first and then all the spreads
data4 <- matrix(c(1, 2, 2, 6, 1, 1, 2, 3), 2, 4)
matrix4 <- IntervalMatrix(data4, type = 4); matrix4
Run the code above in your browser using DataLab