Skip to content

get_scores() support for factor scores from Factor_analysis() #1120

@profandyfield

Description

@profandyfield

The problem

You'd want the output of get_scores() to match my_fa$scores, but it doesn't. This was discussed in easystats/performance#793 (comment) but hasn't been implimented from what I can tell:

raq_items <- discovr::raq |>  dplyr::select(-id)

# fit model with factor_analysis()`
raq_fa <- parameters::factor_analysis(x = raq_items,
                    n = 4,
                    rotation = "oblimin",
                    scores = "tenBerge",
                    cor = "poly",
                    standardize = FALSE)
#> Loading required namespace: GPArotation

# fit model with psych::fa()`

raq_psych <- psych::fa(r = raq_items,
                    nfactors = 4,
                    rotate = "oblimin",
                    scores = "tenBerge",
                    cor = "poly")

# factor scores from `get_scores()`
parameters::get_scores(raq_fa) |> head()
#>   Component_1 Component_2 Component_3 Component_4
#> 1       2.875         2.4    3.142857    2.333333
#> 2       4.125         4.6    3.142857    4.000000
#> 3       4.000         3.4    3.714286    3.666667
#> 4       3.875         3.8    4.000000    2.666667
#> 5       3.125         3.0    4.142857    4.333333
#> 6       2.625         3.2    3.285714    1.666667

# factor scores from the model
head(raq_psych$scores)
#>             MR1        MR2         MR4        MR3
#> [1,] -0.7502691 -1.1467623 -0.83575656 -1.1905427
#> [2,]  1.1393274  1.2766368 -0.09268713  0.6338831
#> [3,]  0.7312033 -0.3316442  0.44931175  0.3721934
#> [4,]  0.6988114  0.3045080  0.44057780 -0.8456754
#> [5,] -0.8202342 -0.4459138  0.31950316  1.2180701
#> [6,] -1.3696455 -0.4248642 -0.37670361 -2.0118668

Created on 2025-06-26 with reprex v2.1.1

Proposed solution

Have a method on get_scores() that returns the my_fa$scores dataframe from a factor analysis object. (i.e. different behaviour to what it does for principal components)

Metadata

Metadata

Assignees

Labels

Docs 📚Something to be adressed in docs and/or vignettes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions