pfa {robCompositions}R Documentation

Factor analysis for compositional data

Description

Computes the principal factor analysis of the input data.

Usage

pfa(x, factors, data = NULL, covmat = NULL, n.obs = NA, 
subset, na.action, start = NULL, 
scores = c("none", "regression", "Bartlett"), 
rotation = "varimax", maxiter = 5, control = NULL, ...)

Arguments

x (robustly) scaled input data
factors number of factors
data default value is NULL
covmat (robustly) computed covariance or correlation matrix
n.obs number of observations
subset if a subset is used
na.action what to do with NA values
start starting values
scores which method should be used to calculate the scores
rotation if a rotation should be made
maxiter maximum number of iterations
control default value is NULL
... arguments for creating a list

Details

The main difference to usual implementations is that uniquenesses are nor longer of diagonal form. This kind of factor analysis is designed for centered log-ratio transformed compositional data. A robust version using the isometric log-ratio transformation could be chosen (see the example below).

Value

loadings A matrix of loadings, one column for each factor. The factors are ordered in decreasing order of sums of squares of loadings.
uniquness uniquness
correlation correlation matrix
criteria The results of the optimization: the value of the negativ log-likelihood and information of the iterations used.
factors the factors
dof degrees of freedom
method “principal”
n.obs number of observations if available, or NA
call The matched call.
STATISTIC, PVAL The significance-test statistic and p-value, if they can be computed

Author(s)

Peter Filzmoser, Karel Hron

References

C. Reimann, P. Filzmoser, R.G. Garrett, and R. Dutter (2008): Statistical Data Analysis Explained. Applied Environmental Statistics with R. John Wiley and Sons, Chichester, 2008.

P. Filzmoser, K. Hron, C. Reimann, R. Garrett (2009): Robust Factor Analysis for Compositional Data. Computers and Geosciences, 35 (9), 1854–1861.

Examples

data(expenditures)
x <- expenditures

# construct orthonormal basis: 
V <- matrix(0,nrow=ncol(x),ncol=ncol(x)-1)
for (i in 1:ncol(V)){
  V[1:i,i] <- 1/i
  V[i+1,i] <- (-1)
  V[,i] <- V[,i]*sqrt(i/(i+1))
}

z <- ilr(x) #ilr transformed data
y <- z 

set.seed(200)
require(robustbase)
z.mcd <- covMcd(z)
mean_z <- z.mcd$center
mean_y <- V 

var_z <- z.mcd$cov
var_y <- V 

#classical scaling
y.sc <- scale(y,scale=FALSE) #only centering

#robust scaling
#y.rsc <- scale(y,mean_y,scale=FALSE) #only centering

res1logcentr <- pfa(y.sc, factors=1, scores="Bartlett", rotation="varimax")

#res1Rlogcentr <- pfa(y.rsc, factors=1, covmat=var_y, scores="Bartlett", rotation="varimax")


[Package robCompositions version 1.3.3 Index]