Dear R users: I'm wondering if it's possible to get the residual correlation matrix when using factanal. Since factanal assumes that the errors are normally distributed and independent (provided the factor model fits the data) this would be useful. Of course you would need to submit the data to the function to get the residuals (not just their correlation matrix), but it should be possible to get the residual correlation matrix if only the data correlation matrix is provided. Don McNeil
factanal question
5 messages · Don McNeil, John Fox, William Revelle
Dear Don,
All long as you leave the factors unrotated or do an orthogonal rotation (as
is the default), you can compute reproduced correlations among the variables
from the factor loadings, and thus residual correlations given the loadings
and the original correlation matrix, both of which are accessible in the
object returned by factanal(); the following isn't carefully tested, but
should work:
repRes <- function(F, round=3){
A <- loadings(F)
R <- F$correlation
RR <- A %*% t(A)
ResR <- R - RR
list(reproduced.correlations=round(RR, round),
residual.correlations=round(ResR, round))
}
Here F is an object returned by factanal(). The diagonal elements of the
reproduced correlations are the communalities, and of the residual
correlations, the uniquenesses.
To do this from an oblique rotation would require the factor-correlation
matrix, which, as has been pointed out previously, factanal() oddly doesn't
provide. In this case, that's not a real impediment, since reproduced and
residual correlations are invariant with respect to rotation of the factors.
I hope this helps,
John
------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Don McNeil Sent: November-30-08 11:39 PM To: r-help at r-project.org Subject: [R] factanal question Dear R users: I'm wondering if it's possible to get the residual correlation matrix when using factanal. Since factanal assumes that the errors are normally distributed and independent (provided the factor model fits the data) this would be
useful.
Of course you would need to submit the data to the function to get the residuals (not just their correlation matrix), but it should be possible
to
get the residual correlation matrix if only the data correlation matrix is provided. Don McNeil
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Don and John, factor.residuals in the psych package does what you want (and basically what John wrote). Bill
At 9:30 AM -0500 12/1/08, John Fox wrote:
Dear Don,
All long as you leave the factors unrotated or do an orthogonal rotation (as
is the default), you can compute reproduced correlations among the variables
from the factor loadings, and thus residual correlations given the loadings
and the original correlation matrix, both of which are accessible in the
object returned by factanal(); the following isn't carefully tested, but
should work:
repRes <- function(F, round=3){
A <- loadings(F)
R <- F$correlation
RR <- A %*% t(A)
ResR <- R - RR
list(reproduced.correlations=round(RR, round),
residual.correlations=round(ResR, round))
}
Here F is an object returned by factanal(). The diagonal elements of the
reproduced correlations are the communalities, and of the residual
correlations, the uniquenesses.
To do this from an oblique rotation would require the factor-correlation
matrix, which, as has been pointed out previously, factanal() oddly doesn't
provide. In this case, that's not a real impediment, since reproduced and
residual correlations are invariant with respect to rotation of the factors.
I hope this helps,
John
------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Don McNeil Sent: November-30-08 11:39 PM To: r-help at r-project.org Subject: [R] factanal question Dear R users: I'm wondering if it's possible to get the residual correlation matrix when using factanal. Since factanal assumes that the errors are normally distributed and independent (provided the factor model fits the data) this would be
useful.
Of course you would need to submit the data to the function to get the residuals (not just their correlation matrix), but it should be possible
to
get the residual correlation matrix if only the data correlation matrix is provided. Don McNeil
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ Attend ISSID/ARP:2009 http://issid.org/issid.2009/
Dear Bill, Thanks for pointing out that this functionality is already in the psych package. Shouldn't factor.residuals() avoid this computation for oblique rotations? Regards, John ------------------------------ John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of William Revelle Sent: December-01-08 10:26 AM To: John Fox; 'Don McNeil' Cc: r-help at r-project.org Subject: Re: [R] factanal question Don and John, factor.residuals in the psych package does what you want (and basically what John wrote). Bill At 9:30 AM -0500 12/1/08, John Fox wrote:
Dear Don, All long as you leave the factors unrotated or do an orthogonal rotation
(as
is the default), you can compute reproduced correlations among the
variables
from the factor loadings, and thus residual correlations given the
loadings
and the original correlation matrix, both of which are accessible in the
object returned by factanal(); the following isn't carefully tested, but
should work:
repRes <- function(F, round=3){
A <- loadings(F)
R <- F$correlation
RR <- A %*% t(A)
ResR <- R - RR
list(reproduced.correlations=round(RR, round),
residual.correlations=round(ResR, round))
}
Here F is an object returned by factanal(). The diagonal elements of the
reproduced correlations are the communalities, and of the residual
correlations, the uniquenesses.
To do this from an oblique rotation would require the factor-correlation
matrix, which, as has been pointed out previously, factanal() oddly
doesn't
provide. In this case, that's not a real impediment, since reproduced and residual correlations are invariant with respect to rotation of the
factors.
I hope this helps, John ------------------------------ John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox
-----Original Message----- From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org]
On
Behalf Of Don McNeil Sent: November-30-08 11:39 PM To: r-help at r-project.org Subject: [R] factanal question Dear R users: I'm wondering if it's possible to get the residual correlation matrix
when
using factanal. Since factanal assumes that the errors are normally distributed and independent (provided the factor model fits the data) this would be
useful.
Of course you would need to submit the data to the function to get the residuals (not just their correlation matrix), but it should be
possible
to
get the residual correlation matrix if only the data correlation
matrix
is
provided. Don McNeil
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
-- William Revelle http://personality-project.org/revelle.html Professor
http://personality-project.org/personality.html
Department of Psychology
http://www.wcas.northwestern.edu/psych/
Northwestern University http://www.northwestern.edu/ Attend ISSID/ARP:2009 http://issid.org/issid.2009/
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
1 day later
At 11:04 AM -0500 12/1/08, John Fox wrote:
Dear Bill, Thanks for pointing out that this functionality is already in the psych package. Shouldn't factor.residuals() avoid this computation for oblique rotations?
John, Good suggestion. I will add that in the next revision. Bill
Regards, John ------------------------------ John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of William Revelle
Sent: December-01-08 10:26 AM
To: John Fox; 'Don McNeil'
Cc: r-help at r-project.org
Subject: Re: [R] factanal question
Don and John,
factor.residuals in the psych package does what you want (and
basically what John wrote).
Bill
At 9:30 AM -0500 12/1/08, John Fox wrote:
>Dear Don, > >All long as you leave the factors unrotated or do an orthogonal rotation
(as
>is the default), you can compute reproduced correlations among the
variables
>from the factor loadings, and thus residual correlations given the
loadings
>and the original correlation matrix, both of which are accessible in the
>object returned by factanal(); the following isn't carefully tested, but
>should work:
>
>repRes <- function(F, round=3){
> A <- loadings(F)
> R <- F$correlation
> RR <- A %*% t(A)
> ResR <- R - RR
> list(reproduced.correlations=round(RR, round),
> residual.correlations=round(ResR, round))
> }
>
>Here F is an object returned by factanal(). The diagonal elements of the
>reproduced correlations are the communalities, and of the residual
>correlations, the uniquenesses.
>
>To do this from an oblique rotation would require the factor-correlation
>matrix, which, as has been pointed out previously, factanal() oddly
doesn't
>provide. In this case, that's not a real impediment, since reproduced and >residual correlations are invariant with respect to rotation of the
factors.
> >I hope this helps, > John > >------------------------------ >John Fox, Professor >Department of Sociology >McMaster University >Hamilton, Ontario, Canada >web: socserv.mcmaster.ca/jfox > >
>> -----Original Message----- >> From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org]
>On
>> Behalf Of Don McNeil >> Sent: November-30-08 11:39 PM >> To: r-help at r-project.org >> Subject: [R] factanal question >> >> Dear R users: >> I'm wondering if it's possible to get the residual correlation matrix
when
>> using factanal. >> Since factanal assumes that the errors are normally distributed and >> independent (provided the factor model fits the data) this would be
>useful.
>> Of course you would need to submit the data to the function to get the >> residuals (not just their correlation matrix), but it should be
possible
>to
>> get the residual correlation matrix if only the data correlation
matrix
is
>> provided. >> Don McNeil >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
> >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. -- William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ > Attend ISSID/ARP:2009 http://issid.org/issid.2009/ ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ Attend ISSID/ARP:2009 http://issid.org/issid.2009/