1
$\begingroup$

In the documentation for the R compositions package, and in reference to ternary diagrams, it is stated that:

However the ternary diagram can only display compositions of three parts. In case of more parts a scatter plot matrix like matrix of ternary diagrams is displayed which selects two components against some sort of margin of the rest:

plot(acomp(sa.lognormals5))
plot(acomp(sa.lognormals5), margin = "rcomp")
plot(acomp(sa.lognormals5), margin = "Cu")

In here the author presents this (tantalizingly beautiful) plot:

enter image description here

... without the code!

The "mystery" asterisk $(*)$ is clarified in this passage in Analyzing Compositional Data with R By K. Gerald van den Boogaart, Raimon Tolosana-Delgado

margin = "acomp" (or nothing, the default) computes the third part as the geometric of all components except those two from row and colum (symbolized with "*").


The question is:

What are the meaning and mathematics behind these deformed circles (lines or curves) generated by the function ellipses, and how to generate them?

$\endgroup$
2
  • $\begingroup$ (2) sounds like it's purely an R question: after all, if you have the code to draw one curve (they're evidently not ellipses!), iteration will draw as many curves as you like. If you want this to fly on Stack Overflow, supply a simple dataset so that people can reproduce your computation. For (1) I don't know the answer, because I don't want to research your references, but the first thing that comes to mind is to plot each pair of components $(X_i,X_j)$ against the sum of all other components: that gives a meaningful three-component mixture. $\endgroup$
    – whuber
    Commented Apr 21, 2017 at 19:10
  • $\begingroup$ @whuber Thank you! I'll reopen the question on SO with the code of what I tried - it may not survive since it got a bunch of calls for closure; and if I start a new question, I may be called on it, but I digress. Depending on how it goes, I'll leave the question open (if you are not against it), or come back to delete it. Yes, ellipses is the function in the package. Finally, I do think you answered my more meaningful question (1) to the point that if you happened not to be exactly correct, it wouldn't make any conceptual difference. $\endgroup$ Commented Apr 21, 2017 at 19:26

1 Answer 1

2
$\begingroup$

The color-coding in the points signify grouping into categorical variable:

> levels(sa.groups.area)
[1] "Lower"  "Middle" "Upper" 

After much trying and error, I got a practically identical plot with this code:

library(compositions)
data(SimulatedAmounts)
colors = c("gray38", "red", "olivedrab3")

tt = acomp(sa.groups5)

windows(width = 10, height = 10, pointsize = 10)

plot(tt, col = rgb(0,0,0,0), bg = colors[as.numeric(sa.groups.area)], pch = 21, cex = 1.2)

strata = sa.groups5.area
temp = cbind(sa.groups5,strata)

a = acomp(temp[temp[ , 6] == 1, ][,1:5])
ellipses(mean(a), var(a), r = 2, col = colors[1])

b = acomp(temp[temp[ , 6] == 2, ][,1:5])
ellipses(mean(b), var(b), r = 2, col = colors[2])

c = acomp(temp[temp[ , 6] == 3, ][,1:5])
ellipses(mean(c), var(c), r = 2, col = colors[3])

enter image description here


As for the meaning of the curves, or circles around groups of points corresponding to the levels in sa.groups.area...

In Analyzing Compositional Data with R By K. Gerald van den Boogaart, Raimon Tolosana-Delgado the following plot can be found with a telling caption:

enter image description here

and (minimally) paraphrasing:

in which the radius of the lines contain 95% of the probability assuming a normal model for the composition and a known variance.

The code of this latter plot likely includes the lines:

r = sqrt(qchisq(p = .095, df = 2))
mm = mean(tt)
vr = var(tt)
ellipses(mean = mm, var = vr, r = r)

... and ?ellipses describes the r parameter in the function ellipses as:

r      a scaling of the half-diameters
$\endgroup$
2
  • $\begingroup$ Please be aware these curves are definitely not ellipses as drawn. They likely are ellipses in some nonlinearly transformed coordinates. Although displaying the code is informative for those interested in using this package, it doesn't answer the underlying question of the "meaning and mathematics" of those curves. It is unclear what the caption means by the "variance structure." $\endgroup$
    – whuber
    Commented Apr 22, 2017 at 16:36
  • $\begingroup$ @whuber I would like very much an answer illuminating further the Aitchison geometric transformations involved. However, after many hours digging out possible leads I started to have that feeling of asking something obvious to everyone else - these are just distorted ellipses corraling in a 95% CI of observations assuming normality (?), and instead of deleting the post, I split it up... $\endgroup$ Commented Apr 22, 2017 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.