score
calculates principal component or factor scores
based on the model generated by PCA
and FA
functions
score(data, model)
data | the data frame used to generate a PCA or FA model. |
---|---|
model | the model generated by the |
the data frame with component or factor scores appended.
The score
function adds component or factor scores to a data frame. Scores
are calculated using the regression method.
ratings <- read.csv("https://www.promptcloud.com/wp-content/uploads/2017/02/EFA.csv") fit.pca <- PCA(ratings, nfactors=2, rotate="varimax")#> #> Principal Components Analysis #> Number of Factors: 2 Rotation: varimax #> #> Component Structure #> PC1 PC2 h2 #> Price 0.54 0.08 0.30 #> Safety -0.33 0.32 0.21 #> Exterior_Looks -0.25 0.27 0.13 #> Space_comfort -0.08 0.80 0.65 #> Technology 0.07 0.48 0.24 #> After_Sales_Service 0.24 0.60 0.42 #> Resale_Value 0.67 -0.24 0.51 #> Fuel_Type -0.01 0.61 0.37 #> Fuel_Efficiency 0.69 0.30 0.56 #> Color 0.56 -0.04 0.32 #> Maintenance 0.74 0.05 0.55 #> Test_drive 0.19 0.41 0.20 #> Product_reviews 0.48 0.34 0.34 #> Testimonials -0.06 0.33 0.11 #> #> PC1 PC2 #> Variance 2.59 2.33 #> Var Explained 0.19 0.17 #> Cum Var Explained 0.19 0.35#> Price Safety Exterior_Looks Space_comfort Technology After_Sales_Service #> 1 4 4 5 4 3 4 #> 2 3 5 3 3 4 4 #> 3 4 4 3 4 5 5 #> 4 4 4 4 3 3 4 #> 5 5 5 4 4 5 4 #> 6 4 4 5 3 4 5 #> Resale_Value Fuel_Type Fuel_Efficiency Color Maintenance Test_drive #> 1 5 4 4 2 4 2 #> 2 3 4 3 4 3 2 #> 3 5 4 5 4 5 4 #> 4 5 5 4 4 4 2 #> 5 5 3 4 5 5 5 #> 6 3 4 3 2 3 2 #> Product_reviews Testimonials PC1 PC2 #> 1 4 3 -0.3494735 -0.76706234 #> 2 2 2 -1.5464964 -1.58854139 #> 3 4 3 1.2949130 0.09537139 #> 4 5 3 0.5124876 -1.00007813 #> 5 5 2 1.4584077 -0.31851462 #> 6 2 3 -1.6599795 -0.85914096