The gellipsoid package extends the class of geometric ellipsoids to
“generalized ellipsoids”, which allow degenerate ellipsoids that are
flat and/or unbounded. Thus, ellipsoids can be naturally defined to
include lines, hyperplanes, points, cylinders, etc. The methods can be
used to represent generalized ellipsoids in a
The goal is to be able to think about, visualize, and compute a linear
transformation of an ellipsoid with central matrix
The implementation uses a
For the usual, “proper” ellipsoids,
A proper ellipsoid in
A degenerate flat ellipsoid corresponds to one where the central
matrix
An unbounded ellipsoid is one that has infinite extent in one or more
directions, and is characterized by infinite singular values in
-
gell()
Constructs a generalized ellipsoid using the$(\mathbf{U}, \mathbf{D})$ representation. The inputs can be specified in a variety of ways:- a non-negative definite variance matrix;
- an inner-product matrix
- a subspace with a given span
- a matrix giving a linear transformation of the unit sphere
-
dual()
calculates the dual or inverse of a generalized ellipsoid -
gmult()
calculates a linear transformation of a generalized ellipsoid -
signature()
calculates the signature of a generalized ellipsoid, a vector of length 3 giving the number of positive, zero and infinite singular values in the (U, D) representation. -
ell3d()
Plots generalized ellipsoids in 3D using thergl
package
You can install the gellipsoid
package from CRAN as follows:
install.packages("gellipsoid")
Or, You can install the development version of gellipsoid from GitHub with:
# install.packages("remotes")
remotes::install_github("friendly/gellipsoid")
The following examples illustrate gell
objects and their properties.
Each of these may be plotted in 3D using ell3d()
. These objects can be
specified in a variety of ways, but for these examples the span is
simplest.
A unit sphere in
library(gellipsoid)
(zsph <- gell(Sigma = diag(3))) # a unit sphere in R^3
#> $center
#> [1] 0 0 0
#>
#> $u
#> [,1] [,2] [,3]
#> [1,] 0 0 1
#> [2,] 0 1 0
#> [3,] 1 0 0
#>
#> $d
#> [1] 1 1 1
#>
#> attr(,"class")
#> [1] "gell"
signature(zsph)
#> pos zero inf
#> 3 0 0
isBounded(zsph)
#> [1] TRUE
isFlat(zsph)
#> [1] FALSE
A plane in
(zplane <- gell(span = diag(3)[, 1:2])) # a plane
#> $center
#> [1] 0 0 0
#>
#> $u
#> [,1] [,2] [,3]
#> [1,] 1 0 0
#> [2,] 0 1 0
#> [3,] 0 0 1
#>
#> $d
#> [1] Inf Inf 0
#>
#> attr(,"class")
#> [1] "gell"
signature(zplane)
#> pos zero inf
#> 0 1 2
isBounded(zplane)
#> [1] FALSE
isFlat(zplane)
#> [1] TRUE
dual(zplane) # line orthogonal to that plane
#> $center
#> [1] 0 0 0
#>
#> $u
#> [,1] [,2] [,3]
#> [1,] 0 0 1
#> [2,] 0 1 0
#> [3,] 1 0 0
#>
#> $d
#> [1] Inf 0 0
#>
#> attr(,"class")
#> [1] "gell"
signature(dual(zplane))
#> pos zero inf
#> 0 2 1
A hyperplane. Note that the gell
object with a center contains more
information than the geometric plane.
(zhplane <- gell(center = c(0, 0, 2),
span = diag(3)[, 1:2])) # a hyperplane
#> $center
#> [1] 0 0 2
#>
#> $u
#> [,1] [,2] [,3]
#> [1,] 1 0 0
#> [2,] 0 1 0
#> [3,] 0 0 1
#>
#> $d
#> [1] Inf Inf 0
#>
#> attr(,"class")
#> [1] "gell"
signature(zhplane)
#> pos zero inf
#> 0 1 2
dual(zhplane) # orthogonal line through same center
#> $center
#> [1] 0 0 2
#>
#> $u
#> [,1] [,2] [,3]
#> [1,] 0 0 1
#> [2,] 0 1 0
#> [3,] 1 0 0
#>
#> $d
#> [1] Inf 0 0
#>
#> attr(,"class")
#> [1] "gell"
A point:
zorigin <- gell(span = cbind(c(0, 0, 0)))
signature(zorigin)
#> pos zero inf
#> 0 3 0
# what is the dual (inverse) of a point?
dual(zorigin)
#> $center
#> [1] 0 0 0
#>
#> $u
#> [,1] [,2] [,3]
#> [1,] 0 0 1
#> [2,] 0 1 0
#> [3,] 1 0 0
#>
#> $d
#> [1] Inf Inf Inf
#>
#> attr(,"class")
#> [1] "gell"
signature(dual(zorigin))
#> pos zero inf
#> 0 0 3
The following figure shows views of two generalized ellipsoids.
This figure illustrates the orthogonality of each
Friendly, M., Monette, G. and Fox, J. (2013). Elliptical Insights: Understanding Statistical Methods through Elliptical Geometry. Statistical Science, 28(1), 1–39. Online paper; DOI
Friendly, M. (2013). Supplementary materials for “Elliptical Insights …”, https://www.datavis.ca/papers/ellipses/