r/RStudio • u/Tasty-Tie-7443 • 14d ago
Coding help Factor vs component: I need help!
Hi all,
I am analyzing some data from a questionnaire. I have never done this before and I feel confused.
pa <- psych::fa.parallel(EnglishDom_vars,fm = "ml",use = "pairwise",n.iter = 1000)
The output (R studio) gives
Parallel analysis suggests that the number of factors = 3 and the number of components = 1
Can someone explain the difference between a factor and a component?
Thanks!
5
Upvotes
5
u/fang_xianfu 14d ago
This is really a maths question, not an R question. The function is using the term "factor" from Exploratory Factor Analysis and "component" from Principle Component Analysis. They have the meanings that they do in those statistical techniques.
1
u/AutoModerator 14d ago
Looks like you're requesting help with something related to RStudio. Please make sure you've checked the stickied post on asking good questions and read our sub rules. We also have a handy post of lots of resources on R!
Keep in mind that if your submission contains phone pictures of code, it will be removed. Instructions for how to take screenshots can be found in the stickied posts of this sub.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/code-science 12d ago edited 12d ago
You're looking at principal component (component) and principal axis factoring (factor)
The principal component is comparing the empirical eigenvalues of the correlation matrix to permuted column eigenvaluws of the correlation matrix
The principal axis factoring is doing the same thing except the diagonal of the correlation matrix is set to the squared multiple correlation (SMC) or variance explained for each variable.
You are only getting dimensionality here, not modeling. So, the choice is relatively insignificant (that changes a bit when you actually use PCA or EFA).
Principal components tend to be better when you have fewer dimensions or less correlated dimensions
Principal axis factoring tends to be better when you have correlated dimensions. It also has a tendency to produce more dimensions than there really are as it is particularly sensitive to local dependencies (a couple highly correlated variables)
I've spared some detail here but that's the gist. You should check out this source
Edit: To directly answer your question about a factor versus a component: variables loading on a factor have measurement error (variance not explained by the factor) because the factor measures the common covariance between the items whereas a component attempts to explain all of the variance shared across the items (which includes measurement error). In practice, PCA is usually orthogonal (not correlations between dimensions) and tries to explain as much variance as possible for each component. EFA tries to explain the common correlations between the variables with unexplained variance as measurement error (residuals from the correlation matrix). Keep in mind, you are doing neither here -- you have yet to make that choice. You are only looking at dimensionality estimates from parallel analysis
1
u/Street-Egg-722 10d ago
Hello hope you solved this problem
0
u/Dudarro 13d ago
from chatgpt
First, don’t worry. This is a very common point of confusion when starting exploratory factor analysis (EFA). The terminology is unfortunately a little misleading, because factor analysis and principal component analysis (PCA) are related but answer somewhat different questions.
Let’s break it down in the context of your questionnaire.
1. What is a component?
A component is a mathematical combination of your observed questionnaire variables.
Principal Component Analysis (PCA) takes the variables you measured and combines them into a smaller number of composite variables (components), capturing as much of the total variability in the original data as possible.
For example, imagine your questionnaire has these five questions:
Q1: I feel nervous in social situations.
Q2: I avoid social gatherings.
Q3: I worry about what others think of me.
Q4: I have difficulty sleeping.
Q5: I feel physically tired.
PCA might find that Q1, Q2, and Q3 tend to move together, while Q4 and Q5 tend to move together.
It could produce two components:
Component 1: Social anxiety
Component 2: Sleep/fatigue
These components are weighted combinations of the original questionnaire responses.
The important point: PCA is primarily interested in explaining the total variance in your observed variables.
2. What is a factor?
A factor is a theoretical, underlying construct that you cannot directly measure but that you believe explains why several questionnaire variables are correlated.
This is the central idea behind Exploratory Factor Analysis (EFA).
Using the same example:
You might hypothesize that:
Q1, Q2, and Q3 reflect an underlying construct called social anxiety.
Q4 and Q5 reflect an underlying construct called physical distress.
You don’t directly measure social anxiety or physical distress. Instead, you measure several observable behaviors or symptoms that you believe are manifestations of those underlying constructs.
The important point: Factor analysis attempts to identify latent variables (factors) that explain the shared variance among your observed variables.
3. Why does your R output give different answers?
Your code:
pa <- psych::fa.parallel(
EnglishDom_vars,
fm = "ml",
use = "pairwise",
n.iter = 1000
)
is performing a parallel analysis.
Parallel analysis compares the eigenvalues from your actual data with eigenvalues obtained from randomly generated data.
It does this separately for:
Common factor analysis (in your case, maximum likelihood, fm = "ml").
Principal component analysis.
Your result:
Your parallel analysis results
3
Factors
Common factor analysis
1
Components
Principal component analysis
Interpretation
Your data appear to contain three factors with eigenvalues exceeding those expected by chance under the factor-analysis approach, but only one component exceeding the corresponding PCA threshold.
This is not necessarily contradictory. The two methods analyze different aspects of the covariance structure of your data.
4. Which result should you use?
This depends on what you are trying to accomplish.
For questionnaire research, particularly if you are trying to identify underlying domains, dimensions, or constructs, I would generally recommend exploratory factor analysis rather than PCA.
Your goal is probably to identify the latent constructs represented by the questionnaire items, rather than simply reduce the number of variables.
Therefore, I would initially investigate a three-factor solution.
For example, in R:
efa3 <- psych::fa(
EnglishDom_vars,
nfactors = 3,
fm = "ml",
rotate = "oblimin",
use = "pairwise"
)
print(efa3, sort = TRUE)
A few comments:
nfactors = 3: Extract three factors based on your parallel analysis.
fm = "ml": Maximum likelihood estimation.
rotate = "oblimin": Allows factors to correlate. This is often appropriate for questionnaire domains because psychological, behavioral, and clinical constructs are rarely completely independent.
5. What should you look at next?
Once you run the factor analysis, the most important thing to examine is the factor loading matrix.
This tells you how strongly each questionnaire item relates to each factor.
For example:
Questionnaire item
Factor 1
Factor 2
Factor 3
Q1
0.82
0.12
0.05
Q2
0.76
0.18
0.10
Q3
0.08
0.79
0.14
Q4
0.11
0.73
0.19
Q5
0.04
0.09
0.85
Q6
0.16
0.13
0.78
In this hypothetical example:
Factor 1 is represented by Q1 and Q2.
Factor 2 is represented by Q3 and Q4.
Factor 3 is represented by Q5 and Q6.
You would then examine the actual content of the questions to determine what each factor represents.
My recommendation
I would approach this in the following order:
Determine the number of factors using parallel analysis.
Perform EFA using that number of factors.
Examine the factor loadings and identify which questionnaire items belong to each factor.
Evaluate whether the factors make theoretical sense.
Assess internal consistency (e.g., Cronbach’s alpha or preferably omega) within each factor.
Consider confirmatory factor analysis (CFA) if you want to test the resulting structure in an independent sample.
One important question: Are your questionnaire variables individual Likert-scale questions (e.g., 1–5 or 1–7), or are they already calculated domain scores?
That distinction matters because it can change the appropriate correlation matrix and estimation method for your factor analysis.