{"word_count": 169, "character_count": 2642}
Consider here the case where, in some parametric inference problem, parameter  is a point in the Simplex,For instance, consider some regression, on compositional data,&#62; library(compositions)&#62;  data(DiagnosticProb)&#62;  Y=DiagnosticProb[,"type"]-1&#62;  X=DiagnosticProb[,c("A","B","C")]&#62;  model = glm(Y~ilr(X),family=binomial)&#62;  b = ilrInv(coef(model)[-1],orig=X)&#62;  as.numeric(b)[1] 0.3447106 0.2374977 0.4177917We can visualize that estimator on the simplex, using&#62;  tripoint=function(s){+    p=s/sum(s)+    abc2xy(matrix(p,1,3))+  }&#62;  lab=LETTERS[1:3]&#62;  xl=c(-.1,1.25)&#62;  yl=c(-.1,1.15)&#62;  library(trifield)&#62;  A=abc2xy(matrix(c(1,0,0),1,3)) &#62;  B=abc2xy(matrix(c(0,1,0),1,3))&#62;  C=abc2xy(matrix(c(0,0,1),1,3)) &#62;  plot(0:1,0:1,col="white",+  xlim=xl,ylim=yl,xlab="",ylab="",axes=FALSE)&#62;  polygon(rbind(A,B,C),col="light yellow")&#62;  text(B[1],-.05,lab[2])&#62;  text(A[1],1.05,lab[1])&#62;  text(C[1],-.05,lab[3])&#62;  segments((A[1]+C[1])/2,(A[2]+C[2])/2,B[1],B[2],col="grey",lty=2)&#62;  segments((A[1]+B[1])/2,(A[2]+B[2])/2,C[1],C[2],col="grey",lty=2)&#62;  segments((B[1]+C[1])/2,(B[2]+C[2])/2,A[1],A[2],col="grey",lty=2)&#62;  points(tripoint(b),pch=19,cex=2,col="red")If we want to compute a 'confidence region', we can either use Bayesian models (with a Dirichlet distribution as prior distribution), or use bootstrap. We will use here the second idea&#62;  MB=matrix(NA,1e4,2)&#62;  for(sim in 1:1e4){+    idx=sample(1:nrow(DiagnosticProb),+    size=nrow(DiagnosticProb),replace=TRUE)+  Y=DiagnosticProb[idx,"type"]-1+  X=DiagnosticProb[idx,c("A","B","C")]+  model = glm(Y~ilr(X),family=binomial)+  MB[sim,]=tripoint(as.numeric(+    ilrInv(coef(model)[-1],orig=X)))}To get some 'confidence region', we can then use the bagplot, to get either a region where 50% of the boostraped estimators are, or 95%,&#62;  library(aplpack)&#62; P1=bagplot(MB[,1],MB[,2], factor =1.96, cex=.9,+ dkmethod=2,show.baghull=TRUE) &#62; P2=bagplot(MB[,1],MB[,2], factor =0.67, cex=.9,+ dkmethod=2,show.baghull=TRUE) Then we can easily plot those two regions,&#62;  plot(0:1,0:1,col="white")&#62;  polygon(rbind(A,B,C),col="light yellow")&#62;  text(B[1],-.05,lab[2])&#62;  text(A[1],1.05,lab[1])&#62;  text(C[1],-.05,lab[3])&#62;  polygon(P1$hull.loop,col="yellow",border=NA)&#62;  polygon(P2$hull.loop,col="orange",border=NA)&#62;  segments((A[1]+C[1])/2,(A[2]+C[2])/2,B[1],B[2],col="grey",lty=2)&#62;  segments((A[1]+B[1])/2,(A[2]+B[2])/2,C[1],C[2],col="grey",lty=2)&#62;  segments((B[1]+C[1])/2,(B[2]+C[2])/2,A[1],A[2],col="grey",lty=2)&#62;  points(tripoint(b),pch=19,cex=2,col="red")&#160;