Skip to content

Commit aea945e

Browse files
CopilotDominiqueMakowskistrengejacke
authored
Rename RMSA to RMSR in model_performance() for psych FA objects (#884)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DominiqueMakowski <8875533+DominiqueMakowski@users.noreply.github.com> Co-authored-by: Daniel <mail@danielluedecke.de> Co-authored-by: strengejacke <26301769+strengejacke@users.noreply.github.com>
1 parent 8134aea commit aea945e

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Changes
44

5+
* `model_performance()` for psych FA objects now correctly names the metric as
6+
`RMSR` (Root Mean Square Residual) instead of `RMSA`. The `RMSR_corrected`
7+
column (previously `RMSA_corrected`) is also renamed accordingly.
8+
59
* `check_model()` now limits the number of data points for models with many
610
observations, to reduce the time for rendering the plot via the `maximum_dots`
711
argument.

R/model_performance.psych.R

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
#' `principal` (e.g., from `psych::principal()`), or from
88
#' `parameters::factor_analysis()` or `item_omega()`.
99
#' @param metrics Can be `"all"` or a character vector of metrics to be computed
10-
#' (some of `"Chi2"`, `"Chi2_df"`, `"df"`, `"p_Chi2"`, `"RMSA"`,
11-
#' `"RMSA_corrected"`, `"TLI"`, `"RMSEA"`, and `"BIC"`. For omega-models, can
10+
#' (some of `"Chi2"`, `"Chi2_df"`, `"df"`, `"p_Chi2"`, `"RMSR"`,
11+
#' `"RMSR_corrected"`, `"TLI"`, `"RMSEA"`, and `"BIC"`. For omega-models, can
1212
#' also include `"R2"` and `"Correlation"`.
1313
#' @param verbose Toggle off warnings.
1414
#' @param ... Arguments passed to or from other methods.
1515
#'
1616
#' @details
17+
#' The `RMSR_corrected` metric is the Root Mean Square Residual corrected for
18+
#' degrees of freedom (i.e., dividing by degrees of freedom rather than the
19+
#' number of observations).
20+
#'
1721
#' For omega-models, the columns `R2` and `Correlation` are measures of factor
1822
#' score adequacy. `R2` refers to the multiple R square of scores with factors,
1923
#' while `Correlation` indicates the correlation of scores with factors.
@@ -33,8 +37,8 @@ model_performance.fa <- function(model, metrics = "all", verbose = TRUE, ...) {
3337
Chi2 = ifelse(is.null(model$STATISTIC), NA_real_, model$STATISTIC),
3438
Chi2_df = ifelse(is.null(model$dof), NA_real_, model$dof),
3539
p_Chi2 = ifelse(is.null(model$PVAL), NA_real_, model$PVAL),
36-
RMSA = ifelse(is.null(model$rms), NA_real_, model$rms),
37-
RMSA_corrected = ifelse(is.null(model$crms), NA_real_, model$crms),
40+
RMSR = ifelse(is.null(model$rms), NA_real_, model$rms),
41+
RMSR_corrected = ifelse(is.null(model$crms), NA_real_, model$crms),
3842
TLI = ifelse(is.null(model$TLI), NA_real_, model$TLI),
3943
RMSEA = ifelse(is.null(model$RMSEA), NA_real_, model$RMSEA[1]),
4044
RMSEA_CI = ifelse(is.null(model$RMSEA), NA_real_, 0.9),
@@ -92,8 +96,8 @@ model_performance.omega <- function(model, metrics = "all", verbose = TRUE, ...)
9296
Chi2 = ifelse(is.null(stats$STATISTIC), NA_real_, stats$STATISTIC),
9397
df = ifelse(is.null(stats$dof), NA_real_, stats$dof),
9498
p_Chi2 = ifelse(is.null(stats$PVAL), NA_real_, stats$PVAL),
95-
RMSA = ifelse(is.null(stats$rms), NA_real_, stats$rms),
96-
RMSA_corrected = ifelse(is.null(stats$crms), NA_real_, stats$crms),
99+
RMSR = ifelse(is.null(stats$rms), NA_real_, stats$rms),
100+
RMSR_corrected = ifelse(is.null(stats$crms), NA_real_, stats$crms),
97101
TLI = ifelse(is.null(stats$TLI), NA_real_, stats$TLI),
98102
RMSEA = ifelse(is.null(stats$RMSEA), NA_real_, stats$RMSEA[1]),
99103
RMSEA_CI = ifelse(is.null(stats$RMSEA), NA_real_, 0.9),
@@ -148,7 +152,7 @@ print.performance_omega <- function(x, ...) {
148152
n <- attr(x, "n", exact = TRUE)
149153
insight::print_color(
150154
insight::format_message(sprintf(
151-
"\nCompare the model fit of the %i-factor solution with the g-only model. If the g-model has smaller RMSA and RMSEA then your items are more likely to describe a single unidimensional construct. If the %i-factor model has smaller RMSA and RMSEA then your construct is more likely to be made up of %i sub-constructs.",
155+
"\nCompare the model fit of the %i-factor solution with the g-only model. If the g-model has smaller RMSR and RMSEA then your items are more likely to describe a single unidimensional construct. If the %i-factor model has smaller RMSR and RMSEA then your construct is more likely to be made up of %i sub-constructs.",
152156
n,
153157
n,
154158
n

man/model_performance.fa.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/model_performance.psych.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
Output
9090
# Indices of model performance
9191
92-
Chi2(167) | p (Chi2) | RMSA | RMSA_corrected | TLI | RMSEA | RMSEA 90% CI | BIC
92+
Chi2(167) | p (Chi2) | RMSR | RMSR_corrected | TLI | RMSEA | RMSEA 90% CI | BIC
9393
----------------------------------------------------------------------------------------
9494
267.210 | < .001 | 0.013 | 0.015 | 0.991 | 0.015 | [0.012, 0.019] | -1044.1
9595

@@ -100,7 +100,7 @@
100100
Output
101101
# Indices of model performance
102102
103-
Chi2(1) | p (Chi2) | RMSA
103+
Chi2(1) | p (Chi2) | RMSR
104104
--------------------------
105105
4.119 | 0.042 | 0.035
106106

@@ -111,15 +111,15 @@
111111
Output
112112
# Indices of model performance
113113
114-
Model | Chi2 | df | p (Chi2) | RMSA | RMSA_corrected | TLI | RMSEA | RMSEA 90% CI | BIC | R2 | Correlation
114+
Model | Chi2 | df | p (Chi2) | RMSR | RMSR_corrected | TLI | RMSEA | RMSEA 90% CI | BIC | R2 | Correlation
115115
-----------------------------------------------------------------------------------------------------------------------------------
116116
3-factor solution | 31.796 | 25 | 0.164 | 0.015 | 0.023 | | 0.087 | [0.000, 0.181] | -54.8 | |
117117
g-model | 264.781 | 44 | < .001 | 0.393 | 0.440 | 0.195 | 0.395 | [0.356, 0.450] | 112.3 | 0.761 | 0.873
118118
119119
Compare the model fit of the 3-factor solution with the g-only model.
120-
If the g-model has smaller RMSA and RMSEA then your items are more
120+
If the g-model has smaller RMSR and RMSEA then your items are more
121121
likely to describe a single unidimensional construct. If the 3-factor
122-
model has smaller RMSA and RMSEA then your construct is more likely to
122+
model has smaller RMSR and RMSEA then your construct is more likely to
123123
be made up of 3 sub-constructs.
124124

125125
---
@@ -129,14 +129,14 @@
129129
Output
130130
# Indices of model performance
131131
132-
Model | Chi2 | df | p (Chi2) | RMSA | RMSA_corrected | TLI | RMSEA | RMSEA 90% CI | BIC | R2 | Correlation
132+
Model | Chi2 | df | p (Chi2) | RMSR | RMSR_corrected | TLI | RMSEA | RMSEA 90% CI | BIC | R2 | Correlation
133133
-----------------------------------------------------------------------------------------------------------------------------------
134134
3-factor solution | 31.796 | 25 | 0.164 | 0.015 | 0.023 | | 0.087 | [0.000, 0.181] | -54.8 | |
135135
g-model | 264.781 | 44 | < .001 | 0.393 | 0.440 | 0.195 | 0.395 | [0.356, 0.450] | 112.3 | 0.761 | 0.873
136136
137137
Compare the model fit of the 3-factor solution with the g-only model.
138-
If the g-model has smaller RMSA and RMSEA then your items are more
138+
If the g-model has smaller RMSR and RMSEA then your items are more
139139
likely to describe a single unidimensional construct. If the 3-factor
140-
model has smaller RMSA and RMSEA then your construct is more likely to
140+
model has smaller RMSR and RMSEA then your construct is more likely to
141141
be made up of 3 sub-constructs.
142142

0 commit comments

Comments
 (0)