Factor Analysis

In most data analysis problems, there are some quantities that we can observe and some that we cannot. The classic examples come from the social sciences. Suppose that you wanted to measure intelligence. It’s not possible to directly measure an abstract concept like intelligence, but it is possible to measure performance on different tests. You could use factor analysis to analyze a set of test scores (the observed values) to try to determine intelligence (the hidden value).

Factor analysis is available in R through the function factanal in the stats package:

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

Here is a description of the arguments to factanal.

ArgumentDescriptionDefault
xA formula or a numeric matrix to be used for analysis. 
factorsA numeric value indicating the number of factors to be fitted. 
dataA data frame in which to evaluate x (if x is a formula).NULL
covmatA covariance matrix (or a list returned by cov.wt).NULL
n.obsThe number of observations (if covmat is specified).NA
subsetSpecifies which observations to include in the analysis. 
na.actionA function that specifies how to handle missing observations (if x is a formula). 
startA matrix of starting values for the algorithm.NULL
scoresA character value specifying the type of scores to produce. Use scores="none" for no scores, scores="regression" for Thompson’s scores, or ...

Get R in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.