factanal
Estimate a Factor Analysis Model
Description
Fits a factor analysis model.
Creates an object of class factanal that represents the fitted model.
Usage
factanal (x, factors, data = NULL, covmat = NULL, n.obs = NA,
subset, na.action, start = NULL, scores = c("none", "regression",
"Bartlett"), rotation = "varimax", control = NULL, ...)
## S3 method for class 'factanal':
print(x, digits = 3, ...)
Arguments
at least one of
x or
covmat must be given.
when
covmat is given,
x is ignored.
x |
a matrix, data frame or formula.
If a matrix, the columns should correspond to variables and the rows to
observations.
If a formula, no variables may appear on the left (response) side.
|
factors |
the number of factors to fit.
|
data |
a data frame or matrix. This is used only when x is a formula.
|
covmat |
a covariance list at least with cov(covariance matrix) and
n.obs (number of observations) components,
or a covariance matrix, or NULL.
Another type of covmat results in an error.
|
n.obs |
the number of observations.
Used only when covmat is a matrix.
The number of observations is obtained inside of the function for other cases.
|
subset |
the subset of the observations.
|
na.action |
the function to handle missing values.
The default is to create an error if missing values are found.
|
start |
a matrix of starting values for the maximum likelihood estimation procedure.
The number of rows of start must equal the number of columns
of the covariance matrix.
|
scores |
a character string specifying the factor score to compute.
This must partially match "none", "regression",
or "Bartlett".
Scores are only computed if covmat is not given.
|
rotation |
a character string giving the name of rotation function to use.
Currently, the supported rotation functions are "varimax"
and "promax".
"none" means no rotation used.
|
control |
a list of control parameters for the maximum likelihood estimation procedure.
The supported parameters are:
nstart | the number of starting values if start is NULL. Default is 1. |
trace | logical value to indicate if print out the trace information for each
maximum likelihood estimation fit. Default is FALSE. |
lower | positive number giving the lower bound for the square root of
the uniquenesses. Default is 0.005 |
opt | (optional) list of control values to be passed to optim's control argument. |
rotate | (optional) list of additional arguments to be passed to rotation function.
|
|
... |
control parameters listed in control can be passed in named argument(s).
|
Details
Factor analysis essentially assumes a model for the correlation matrix
and produces estimates of the model.
Factor analysis modeling can include undesirable features.
There is not a clear way of deciding if the
model is appropriate, and if so, how many factors there should be.
Also, it has been shown that the estimates need not look like the original
generators of a factor model, even when the covariance matrix precisely
fits the model (corresponding to an infinite sample size).
See Seber (1984, pp. 222-235) for a discussion and further references.
- factanal uses a method of maximum likelihood estimate for factor analysis.
Factor scores are computed with two methods:
- The regression method of Thomson (1951).
- The weighted least squares method of Bartlett (1937).
- print.factanal is a non-visible method of generic function print
for class "factanal".
It prints out the following components of the "factanal" object:
- "call"
- "uniquenesses"
- "loadings"
- "rotmat"
- "STATISTIC"
- "PVAL"
and so on.
Value
returns an object of class
"factanal" with following components:
converged |
a logical value. TRUE indicates a successful convergence.
This value is not returned in Spotfire Enterprise Runtime for R.
|
loadings |
a matrix of class "loadings" giving the loadings for each factor.
The first column is the linear combination of columns of x
defining the first factor, and so on. The factors are sorted in decreasing order
of sums of squares of loadings, and given the sign that will make the sum
of the loadings positive.
|
uniquenesses |
a vector of the standardized uniquenesses for each variable.
|
correlation |
the correlation matrix of the data, which is being modeled.
|
criteria |
information on the optimization. It gives the objective and the number of iterations used.
|
factors |
the number of factors in the model.
|
dof |
the number of degrees of freedom for the model
|
method |
a character string giving the method used. Currently, it is always "mle".
|
rotmat |
the rotation matrix.
|
scores |
a computed matrix of factor scores. This is not present if the scores
argument was "none" or if there were no data from which to compute scores.
|
na.action |
napredict is applied to handle the treatment of values omitted by the na.action.
|
STATISTIC |
the statistics of model fit if it can be computed.
|
PVAL |
the p-value of model fit if it can be computed.
|
n.obs |
the number of observations on which the estimates are based, or NA.
|
call |
the matched call.
|
The print method prints the sums of squares of the factor loadings,
the size of the data, the names of the components in
x,
and the call that created
x.
It also prints the results of a hypothesis test on the number of factors
if maximum likelihood estimation was used for the factor analysis.
Background
Factor analysis assumes that the data may be successfully
summarized by one or more "factors" which are
unknown linear combinations of the variables known to the data analyst.
For example, suppose we have the answers from 1000 subjects on a
psychological test of 100 questions.
Each question is one of our 100 observed variables, and we may consider
performing factor analysis to find the two factors "aggressiveness"
and "intelligence" that the test was designed to measure.
These factors will each be a linear combination of the 100 questions.
Differences between Spotfire Enterprise Runtime for R and Open-source R
The Spotfire Enterprise Runtime for R factanal uses a different algorithm for computing
the MLE estimates so the results can be slightly different.
The return value from Spotfire Enterprise Runtime for R does not include the rotmat
component when a rotation is performed.
The current Spotfire Enterprise Runtime for R version of factanal produces the same
results as factanal in S-PLUS.
References
Bartlett, M. S. 1937. The statistical conception of mental factors. British Journal of Psychology. Volume 28. 97-104.
Bartlett, M. S. 1938. Methods of estimating mental factors. Nature. Volume 141. 609-610.
Harman, H. H. 1976. Modern Factor Analysis. Third Edition. Chicago, IL: University of Chicago Press.
Johnson, R. A. and Wichern, D. W. 1982. Applied Multivariate Statistical Analysis. Englewood Cliffs, NJ: Prentice-Hall.
Jöreskog., K. G. 1963. Statistical Estimation in Factor Analysis. Stockholm, SWE: Almqvist and Wicksell.
Lawley, D. N. and Maxwell, A. E. 1971. Factor Analysis as a Statistical Method. Second Edition. London, UK: Butterworths.
Mardia, K. V., Kent, J. T., and Bibby, J. M. 1979. Multivariate Analysis. London, UK: Academic Press.
Seber, G. A. F. 1984. Multivariate Observations. New York, NY: Wiley.
Thomson, G. H. 1951. The Factorial Analysis of Human Ability. London, UK: University of London Press.
See Also
Examples
v1 <- c(1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6)
v2 <- c(1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5)
v3 <- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
v4 <- c(3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4)
v5 <- c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5)
v6 <- c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4)
x <- cbind(v1,v2,v3,v4,v5,v6)
factanal(x, factors = 3) # default rotation = "varimax"
factanal(x, factors = 3, rotation = "promax")
# formula interface
factanal(~v1+v2+v3+v4+v5+v6, factors = 3)