Description Usage Arguments Details Value See Also Examples
View source: R/feasible_overlap.R
feasible_overlap
will find the smallest radius such that the ellipses
have a non-empty intersection.
1 | feasible_overlap(ell, ...)
|
ell |
a list of at least two (non degenerate) ellipses; see
|
... |
additional arguments to be passed to internal functions. |
Given a list of ellipses ell
the function feasible_overlap
will
find the smallest radius such that the ellipses from ell
overlap. This
is done by solving the following quadratically constrained problem
  |   min(x,s)   | s | |
s.t. | (x - ci)T Pi (x - ci) - ri ≤ s |   for all i = 1, ..., d | |
To solve this convex problem the logarithmic barrier method is used.
Note that it is not necessary to specify ellipse radii in ell
.
feasible_overlap
returns an object of class
"feasible_overlap
". This object is a list with the following entries:
radii |
the smallest ellipse radii resulting in a non-empty intersection. |
x |
The limiting common point. |
distance |
The ellipse specific distances. |
call |
The matched call. |
wrangle_ellipse
for detailed on ellipse
parameterization.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## two dimensional ellipses
e1 <- list("c" = c(1,1), "P" = matrix(c(2,0,0,0.5), ncol = 2))
e2 <- list("c" = c(0,0), "S" = matrix(c(1, 0.2, 0.2, 2), ncol = 2), "r" = 1)
# note: it is not necessary to specify an ellipse radius "r"
feasible_overlap(list(e1, e2))
## regression example
# generate data
n <- 100
E <- rbinom(n, 1, 0.5)
X <- rnorm(n, E * 3, 1)
Y <- rnorm(n, 2 + 1.5 * X, 1)
# create confidence region ellipses
m0 <- lm(Y ~ X, data = data.frame(Y, X), subset = (E == 0))
m1 <- lm(Y ~ X, data = data.frame(Y, X), subset = (E == 1))
ConfRegion0 <- list(c = coefficients(m0), S = vcov(m0))
ConfRegion1 <- list(c = coefficients(m0), S = vcov(m0))
# find smallest radius
res <- feasible_overlap(list(ConfRegion0, ConfRegion1))
# this radius now corresponds to the chisq quantile at which
# the confidence regions intersect non-emptily.
# In other words the (1 - alpha)-confidence intervals intersect for alpha:
alpha <- pchisq(res$radii, 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.