Revision b6fe861fe48f12c1b45d1e68f8508ee6503821ac authored by Gilles Raiche on 24 April 2007, 00:00 UTC, committed by Gabor Csardi on 24 April 2007, 00:00 UTC
1 parent 4e9967d
Raw File
componentAxis.r
"componentAxis" <-
function(R, nFactors=2) {
  nVar            <- dim(R)[2]
  acp             <- principalComponents(R)
  values          <- acp$values[(1:nFactors)]
  varExplained    <- round((values/nVar)*100,    2)
  cumVarExplained <- round(cumsum(varExplained), 2)
  loadings        <- acp$vectors[,(1:nFactors)]  %*% diag(values^0.5)  # F1 * diag(E)
  communalities   <- apply(loadings*loadings,1,sum)
  apa             <- list(values          = values,
                          varExplained    = varExplained,
                          cumVarExplained = cumVarExplained,
                          loadings        = loadings,
                          communalities   = communalities)
  return(apa)
  }
back to top