https://github.com/cran/robCompositions
Raw File
Tip revision: daac2b4c2293b12523269bf2c21b43e304e733cf authored by Matthias Templ on 29 May 2018, 10:38:10 UTC
version 2.0.8
Tip revision: daac2b4
biplot.factanal.R
#' Biplot method
#' 
#' Provides robust compositional biplots.
#' 
#' The robust compositional biplot according to Aitchison and Greenacre (2002),
#' computed from resulting (robust) loadings and scores, is performed.
#' 
#' @param x object of class \sQuote{factanal}
#' @param \dots ...
#' @return The robust compositional biplot.
#' @author M. Templ, K. Hron
#' @seealso \code{\link{pfa}}
#' @references Aitchison, J. and Greenacre, M. (2002). Biplots of compositional
#' data. \emph{Applied Statistics}, \bold{51}, 375-392. \
#' 
#' Filzmoser, P., Hron, K., Reimann, C. (2009) Principal Component Analysis for
#' Compositional Data with Outliers. \emph{Environmetrics}, \bold{20} (6),
#' 621--632.
#' @keywords aplot
#' @export
#' @method biplot factanal
#' @examples
#' data(expenditures)
#' res.rob <- pfa(expenditures, factors=2, scores = "regression")
#' biplot(res.rob)
biplot.factanal <- function(x, ...){
  if(is.null(x$scores)) stop("no scores computed")
  if(x$factors == 1) stop("only one factor avalable, but need two")
  beschx <- if(x$robust) "Factor1 (clr-robust)" else "Factor1 (clr-classical)"
  beschy <- if(x$robust) "Factor2 (clr-robust)" else "Factor2 (clr-classical)"
  biplot(x$scores, x$loadings, xlab=beschx, ylab=beschy, ...)
}
back to top