https://github.com/cran/robCompositions
Raw File
Tip revision: bea0f6203c78ee704dca8deb7c74cc48e13ee950 authored by Matthias Templ on 15 May 2012, 15:35:41 UTC
version 1.6.0
Tip revision: bea0f62
ternaryDiagEllipse.R
ternaryDiagEllipse <- function(x, tolerance=c(0.9,0.95,0.975), locscatt="MCD", ...){
	z <- ilr(x)
	if(locscatt=="MCD"){
		cv <- covMcd(z)
		mu <- cv$center
		cm <- cv$cov
	} else {
		mu <- colMeans(z)
		cm <- cov(z)
	}
	dat1 <- drawMahal(z, mu, cm, plot=FALSE, whichlines=tolerance) 
	for(i in 1:length(tolerance)){
		e <- invilr(cbind(dat1$mdX[,i], dat1$mdY[,i]))
		xp1 <- e[, 2] + e[, 3]/2
		yp1 <- e[, 3] * sqrt(3)/2	  
		lines(xp1, yp1, xlim = c(0, 1), ylim = c(0, 0.9), #frame.plot = FALSE, 
				xaxt = "n", yaxt = "n", xlab = "", ylab = "", ...)
	}
}
back to top