I'm trying to understand factor analyisis. Let's say we observed $n$ $d$-dimensional values and want to have $p$ factors. Then after doing a factor analysis the j-th component of one observation can be represented as:
$ X_j = \mu_j + \sum_{k=1}^p l_{j,k} \cdot f_{k} + \epsilon_j $
Hope this is right so far. Now my question: If we have done that, how can we obtain the factor values of each observation. Shouldn't there be p Values for every observation, so that we "create" $n \cdot p$ values?
Even doing a factor analysis using R I can't find any command to obtain these values. Can someone please help me?
Factor Analysis is built upon whats called The Orthogonal Factor Model, which is this in matrix form:
$X-\mu =LF+\epsilon \ \ \ $
Your notation is off where its supposed be : $X_p=\mu_p+\Sigma_k^ml_{p,k}*f_k+\epsilon_p$, where p is the number of variables and m is the number of observations.
Factor Analysis Steps:
1) We have different methods of estimating the loadings, $L$, either through principal components or maximum likelihood; from here on I will use principal components. Let $\Sigma$ be the covariance matrix of the data set you are observing. Then $\Sigma$=$LL'+0$, where $L$ is the principal components (i.e. eigenvectors) of the covariance matrix. However we want to 'reduce' our variable number so we will delete the principal components that do not high variance proportions. If we reduce our principal component amount then $\Sigma$=$LL'+\Psi$, where $L$ is less than the number of eigenvectors and $\Psi$ is actually the identity matrix whose diagonal values are some value $\Psi_i=\sigma_{ii}-\Sigma_j^ml^2_{i,j}$ for i=1...p.
2) We could now perform a factor rotation but I'll skip this step for now
3) Now to estimate the factor scores $F$, we will use ordinary least squares because we are using principal components, where in matrix form: $F=(L'L)^{-1}L'(X-\bar x)$.
If you are using R, look up the package FactorMiner, its a good package for performing a full factor analysis.
Full Example Using R:
I am going to be using the iris data set with only variables 1-4
1)
which outputs
2) Now we will find the principal components (eigenvectors) of the covariance matrix.
which outputs:
Now we see which principal components contribute the most variance to the data, we need to calculate the variance contributed by each component, which is calculated by the eigenvalue divided by the sum of the eigenvalues, $Var_k=\lambda_k/\Sigma_i^p\lambda_i$. The sum of the eigenvalues is 4.57, so the first component contributes 4.228/4.57=0.92% of the variance, and component two contributes 0.24/4.57=0.052% of the variance, and so forth. In principal component analysis we would cut off the components that do not contribute much variance to the dateset, so we would actually cut off components 2-4, as they contribute less than 10% of the data, but I will include component 2 as its typical to include at least two components .
3) Now our factor Analysis model becomes $\Sigma=LL'+\Psi$ where L is only the first principal component because it envelopes the most variance in the model L:
which outputs, which is the first and second eigenvector:
To calculate $\Psi$ we do $1-\Sigma_i l^2_i$, so for the first $\Psi_1$ it would be $1-0.36^2-0.65^2$, which is the first row of our L, which equates to 0.4479.
which outputs:
Now we can calculate our residual matrix by $\Sigma-LL'-\Psi$
which outputs:
So these will be our errors that we would have to add on to our model to make it exact.
4) To calculate the factor scores $F$, we use $F=(L'L)^{-1}L'(X-\bar x)$, where $\bar x$ is the mean vector, mean of the variables:
which outputs:
Now we calculate $F$ by:
which outputs:
These are the factor scores, hopefully this is what you were looking for.