Description Usage Arguments Value Note Author(s) References See Also Examples
For data with more variables than observations (D>>N), the covariance matrix is singular and a general inverse is used to determine the inverse correlation matrix and estimate scores. Using the principal axes method of Factor Analysis, communalities are estimated by iteratively updating the diagonal of the correlation matrix and solving the eigenvector decomposition. Communalities for each variable are estimated according to the number of factors and convergence is defined by the stabalization of total communalities between iterations.
1 |
r |
Covariance matrix or raw data matrix. A correlation matrix is computed using pairwise deletion. |
nfactors |
Number of factors to extract. Default is 1. |
residuals |
logical. If residual matrix is included in result |
prerotate |
logical. Rotate the loadings using a varimax orthogonal rotation before applying a different rotation. |
rotate |
"none", "varimax", "promax" rotation applied to the loadings |
m |
integer. power of the fitting function in a promax rotation. Default is 4. |
n.obs |
Number of observations used to find the correlation matrix if using a correlation matrix. Used for finding the goodness of fit statistics. |
scores |
If TRUE, estimate factor scores. If D>>N, ginv(r) is used during the calculation. |
force |
if TRUE, a square matrix r will be interpreted as a data matrix. The default is FALSE, and square matrices are assumed to represent covariance |
SMC |
Use squared multiple correlations (SMC=TRUE) or use 1 as initial communality estimate. Try using 1 if imaginary eigen values are reported. |
missing |
If scores are TRUE, and missing=TRUE, then impute missing values using either the median or the mean |
impute |
"median" or "mean" values are used to replace missing values |
min.err |
Iterate until the change in communalities is less than min.err. Default is 0.001 |
digits |
Number of digits to display in output |
max.iter |
Maximum number of iterations for convergence |
symmetric |
symmetric=TRUE forces symmetry by just looking at the lower off diagonal values |
warnings |
warnings=TRUE displays warning messages encountered during estimation |
values |
Eigen values of the final solution |
communality |
Communality estimates for each item. These are merely the sum of squared factor loadings for that item. |
rotation |
which rotation was requested? |
n.obs |
number of observations specified or found |
loadings |
An item by factor loading matrix of class “loadings" Suitable for use in other programs (e.g., GPA rotation or factor2cluster. |
fit |
How well does the factor model reproduce the correlation matrix. (See VSS, ICLUST, and principal for this fit statistic. |
fit.off |
how well are the off diagonal elements reproduced? |
dof |
Degrees of Freedom for this model. This is the number of observed correlations minus the number of independent parameters. Let n=Number of items, nf = number of factors then dof = n * (n-1)/2 - n * nf + nf*(nf-1)/2 |
objective |
value of the function that is minimized by maximum likelihood procedures. This is reported for comparison purposes and as a way to estimate chi square goodness of fit. The objective function is log(trace ((FF'+U2)^(-1) R) - log(|(FF'+U2)^-1 R|) - n.items. |
STATISTIC |
If the number of observations is specified or found, this is a chi square based upon the objective function, f. Using the formula from factanal(which seems to be Bartlett's test) : chi^2 = (n.obs - 1 - (2 * p + 5)/6 - (2 * factors)/3)) * f |
PVAL |
If n.obs > 0, then what is the probability of observing a chisquare this large or larger? |
Phi |
If oblique rotations (using oblimin from the GPArotation package or promax) are requested, what is the interfactor correlation. |
communality.iterations |
The history of the communality estimates. Probably only useful for teaching what happens in the process of iterative fitting. |
residual |
If residuals are requested, this is the matrix of residual correlations after the factor model is applied. |
This is a direct adaptation from the factor.pa function implemented in the psych package.
Lisa McFerrin
Gorsuch, Richard, (1983) Factor Analysis. Lawrence Erlebaum Associates. Revelle, William. (in prep) An introduction to psychometric theory with applications in R. Springer. Working draft available at http://personality-project.org/r/book.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #compare Principal Components and Factor Analysis methods on Amino Acid data with D>>N
data(AA54)
AA54_PCA = princomp(AA54, covmat = cov.wt(AA54))
Factor54 = factor.pa.ginv(AA54, nfactors = 5, m=3, prerotate=TRUE, rotate="Promax", scores="regression")
Factor54$loadings[order(Factor54$loadings[,1]),]
require(scatterplot3d)
Factor3d =scatterplot3d(Factor54$scores[,1:3], pch = AminoAcids, main="Factor Scores", box = FALSE, grid=FALSE, xlab="pah", ylab="pss", zlab="ms")
Factor3d$plane3d(c(0,0,0), col="grey")
Factor3d$points3d(c(0,0), c(0,0), c(-3,2), lty="solid", type="l" )
Factor3d$points3d(c(0,0), c(-1.5,2), c(0,0), lty="solid", type="l" )
Factor3d$points3d(c(-1.5,2), c(0,0), c(0,0), lty="solid", type="l" )
Factor3d$points3d(Factor54$scores[hydrophobic,1:3], col="blue", cex = 2.7, lwd=1.5)
Factor3d$points3d(Factor54$scores[polar,1:3], col="green", cex = 3.3, lwd=1.5)
Factor3d$points3d(Factor54$scores[small,1:3], col="orange", cex = 3.9, lwd=1.5)
legend(x=5, y=4.5, legend=c("hydrophobic", "polar", "small"), col=c("blue", "green", "orange"), pch=21, box.lty =0)
cor(AA54_PCA$scores, Factor54$scores)
|
Loading required package: psych
Loading required package: MASS
Warning message:
In data(AA54) : data set 'AA54' not found
Could not solve for inverse correlation. Using general inverse ginv(r)
Warning message:
In cor.smooth(R) : Matrix was not positive definite, smoothing was done
F1 F2 F3 F4 F5
Percentage of buried residues -1.03 -0.13 -0.19 -0.07 -0.03
Transfer free energy -1.02 -0.04 -0.14 -0.11 0.15
Average interactions per side chain atom -0.94 -0.13 -0.17 0.06 -0.13
Average side chain orientation angle -0.90 -0.16 -0.01 -0.11 -0.18
Solvation free energy -0.87 0.01 0.15 0.01 0.27
Hydropathy index -0.86 -0.16 0.10 0.22 0.03
Information measure for pleated-sheet -0.51 -0.11 0.44 0.06 -0.17
Normalized frequency of beta-sheet -0.48 0.04 0.58 0.02 -0.11
Normalized frequency of beta-sheet unweighted -0.43 0.13 0.61 0.12 -0.04
Normalized frequency of extended structure -0.36 0.36 0.70 0.15 -0.05
Hydrophobicity factor -0.19 0.23 0.84 -0.01 0.10
Heat capacity -0.17 -0.38 0.18 -0.65 0.00
Free energy in alpha-helical region -0.17 0.85 -0.01 -0.09 0.10
Normalized frequency of left-handed alpha-helix -0.10 0.34 -0.65 -0.07 -0.27
Normalized relative frequency of coil -0.07 0.33 -0.59 -0.08 -0.13
Refractivity -0.04 -0.06 0.51 -0.62 -0.09
Bulkiness 0.00 -0.07 1.00 0.06 0.24
Average non-bonded energy per residue 0.04 0.36 0.02 -0.50 0.30
Relative frequency in alpha-helix 0.04 -1.00 -0.26 -0.22 -0.02
Normalized frequency of turn 0.08 0.82 -0.08 -0.39 0.05
Net charge 0.09 0.06 0.01 0.13 -0.96
Amino acid composition 0.10 -0.01 -0.28 0.85 -0.06
Number of codon(s) 0.10 0.16 0.06 0.85 -0.30
Helix-coil equilibrium constant 0.11 -0.71 0.39 -0.12 -0.05
Alpha-helix indices 0.12 -0.95 -0.17 -0.22 -0.01
Relative frequency of occurrence 0.12 -0.10 -0.12 0.92 -0.01
Average relative probability of helix 0.13 -1.01 -0.16 -0.07 0.04
AA composition of total proteins 0.16 -0.14 -0.08 0.95 -0.05
Free energy in beta-strand region 0.19 0.44 -0.13 0.13 0.15
Chou-Fasman parameter of the coil conformation 0.20 0.77 -0.34 -0.05 -0.05
Information measure for loop 0.20 0.77 -0.18 -0.33 -0.18
Side chain volume 0.21 -0.18 0.79 -0.30 -0.09
Optimized propensity to form reverse turn 0.21 -0.02 -0.45 0.32 0.19
Conformational parameter of beta-turn 0.24 0.68 -0.17 -0.43 -0.07
Isolelectric point 0.24 -0.04 -0.03 0.14 -0.96
Residue volume 0.26 -0.15 0.83 -0.30 -0.04
Normalized frequency coil 0.29 0.87 0.03 0.12 -0.08
Average volume of buried residue 0.30 -0.13 0.81 -0.34 -0.02
Relative mutability 0.33 -0.17 -0.20 0.30 0.29
Molecular weight 0.39 -0.08 0.70 -0.50 0.05
Normalized frequency of beta-turn 0.41 0.63 -0.35 -0.02 0.08
Positive charge 0.44 -0.25 -0.20 -0.10 -0.70
Negative charge 0.44 -0.23 -0.02 -0.04 0.70
Normalized relative frequency of bend 0.44 0.66 -0.23 0.08 0.11
Size 0.48 -0.08 0.85 -0.15 -0.11
Long range non-bonded energy per atom 0.71 -0.03 -0.39 0.19 0.09
Polar requirement 0.76 -0.14 -0.33 -0.02 0.24
Hydrophobicity value 0.77 -0.16 -0.33 0.21 -0.03
Polarity 0.78 -0.06 -0.38 0.03 0.08
Number of hydrogen bond donors 0.83 0.03 0.15 0.01 -0.36
Residue accessible surface area in folded protein 0.97 0.11 0.21 0.03 -0.24
Average accessible surface area 1.02 -0.02 0.19 0.05 -0.16
Percentage of exposed residues 1.04 0.03 0.22 0.09 -0.03
Average non-bonded energy per atom 1.04 0.08 0.18 0.04 0.07
Loading required package: scatterplot3d
F1 F2 F3 F4 F5
Comp.1 -0.8106203315 -0.4566660892 0.747622937 -0.1057289382 -0.170598401
Comp.2 -0.5774966688 0.4927272849 -0.451227698 0.5037488773 0.359586160
Comp.3 0.0451196733 -0.7220363040 -0.281156209 0.5049111361 0.368473720
Comp.4 -0.0216656410 -0.0951326589 -0.261225464 -0.6321249964 0.660787814
Comp.5 0.0750155644 0.1149143881 0.288614990 0.2633040806 0.504511649
Comp.6 0.0056126030 0.0116526296 0.017311708 0.0196970338 0.021070738
Comp.7 -0.0113758596 -0.0083252698 -0.033370976 -0.0261296463 -0.065496111
Comp.8 -0.0035876854 0.0132277611 -0.029356228 -0.0318075031 -0.002681595
Comp.9 -0.0016408412 -0.0120687349 0.016786244 0.0218828313 0.008607202
Comp.10 -0.0006935937 -0.0154169548 0.021212769 -0.0092435117 -0.009364415
Comp.11 -0.0022665370 0.0025243203 0.020495595 -0.0375195332 0.010593865
Comp.12 -0.0045375559 -0.0333312845 0.002643028 -0.0041886243 -0.016825747
Comp.13 0.0126597766 -0.0136103712 0.009919731 -0.0076216626 0.056718490
Comp.14 0.0031842890 -0.0363758277 0.014804896 0.0390695436 0.030556071
Comp.15 -0.0088354005 -0.0046151292 -0.019090818 -0.0044874315 -0.018556781
Comp.16 -0.0031331322 0.0177805017 -0.020959197 0.0058402203 0.050615262
Comp.17 0.0170894316 -0.0006343807 -0.009558521 -0.0272598196 -0.011948708
Comp.18 -0.0013052937 -0.0365719846 -0.017854272 -0.0630728061 0.043892287
Comp.19 -0.0224728732 0.0044033752 0.043611299 0.0279303494 -0.014977143
Comp.20 0.1773319161 0.1251772298 -0.241801295 0.1480876430 0.053244349
Comp.21 -0.0338412233 0.1020911328 -0.104173009 0.0949018579 0.130699162
Comp.22 -0.1713891990 -0.1455708385 0.173519853 -0.0820683629 0.014291819
Comp.23 0.1396662887 0.1042713770 -0.033381895 -0.2719252825 0.115019906
Comp.24 0.0449665591 -0.3049682542 0.100554939 0.1394745367 0.103860571
Comp.25 0.1520704138 0.1447690738 0.171074396 -0.1824348470 -0.019724657
Comp.26 -0.1391934351 -0.1176626625 0.276324950 -0.0292182370 -0.011136316
Comp.27 0.1884532138 0.0562801647 -0.178500454 0.0300282657 0.069086240
Comp.28 -0.2209687744 0.2469488594 -0.140080934 0.2455696998 -0.054437828
Comp.29 -0.0382286448 -0.0227379887 0.172353506 -0.0159491282 -0.055423065
Comp.30 0.1193149928 -0.0838014307 -0.013205320 0.0131194749 0.114509256
Comp.31 -0.2559176168 0.0462987113 -0.016747803 -0.0898003662 0.005354114
Comp.32 -0.0944146435 0.1123214187 -0.063994166 0.0878298581 0.080324738
Comp.33 -0.0694294938 0.1306793645 -0.161819331 0.1405587593 -0.153039397
Comp.34 0.0063401094 -0.2385726947 0.059029585 0.0155304899 -0.058881878
Comp.35 0.1649380201 0.1550294839 -0.074603378 0.1125305240 -0.027957588
Comp.36 -0.0670319975 0.2152486707 0.061035060 0.1314115429 -0.217410945
Comp.37 0.0511981960 -0.0855643820 -0.023411712 0.2493886251 0.094469876
Comp.38 0.1187956493 -0.0102159311 -0.224970384 -0.0049557593 0.090023278
Comp.39 0.2361075229 0.0884974930 -0.057863729 0.0515462885 -0.013445952
Comp.40 -0.1401340711 0.0391589864 0.011024854 -0.0070430905 -0.038715181
Comp.41 0.0424616918 -0.0841596914 0.158228260 0.0404016305 -0.065298475
Comp.42 0.0796059336 0.2374107356 -0.070531767 -0.0515543298 0.043693852
Comp.43 0.2535672418 0.2073026849 -0.158768443 -0.1674205817 0.348926287
Comp.44 -0.2739563953 0.0150466231 0.090078357 -0.0007495945 -0.123612741
Comp.45 -0.1349167057 -0.0005915606 -0.006119946 0.0158292746 0.067889583
Comp.46 0.1069507217 -0.0032352888 -0.002197007 -0.1275499305 0.070427117
Comp.47 -0.1308048371 0.0964690293 -0.021688404 0.0639750469 -0.115960688
Comp.48 -0.0193842966 -0.1614826806 0.073628942 0.0359607864 0.031437767
Comp.49 -0.3199348510 -0.0567098478 0.382860155 -0.0720994501 -0.202035756
Comp.50 -0.1345977804 0.1259527428 -0.133324460 0.1118129372 0.219191366
Comp.51 -0.1696102121 -0.2000841365 0.187678642 -0.0624320167 0.016784843
Comp.52 0.0862959954 0.0083437960 -0.082696807 -0.0417041626 0.059495653
Comp.53 -0.2322517992 -0.1083575029 0.155080746 -0.0168860795 -0.068317221
Comp.54 -0.0675610331 0.0380492633 -0.104373931 0.3066742451 -0.014402601
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.