# How can I calculate the standardized root mean square residual (SRMR) from the psych package in R? [closed]

The psych package in R provides the root mean square of the residuals (RMSR) when using the principal (principal components analysis) or fa (factor analysis) functions. How could I calculate the standardized root mean square of the residuals (SRMR)?

All of my variables are on the same likert scale from 0 to 6.

Update: This is an old post, but for those with a similar question, SRMR is named the standardized form of RMSR. So, the comment below is correct. The psych package labels it RMSR likely because it allows for running factor analysis on a covariance matrix which would produce the unstandardized RMSR. However the default in fa when using raw data is that it performs the fa on the correlation matrix so although labeled RMSR, the value given is the standardized root mean square of the residuals (SRMR).

To verify, here are are the RMSR and SRMR comparing the psych and lavaan packages.

library(psych)
library(lavaan)

# Load the Humor Styles Questionnaire dataset
url <- "https://assets.datacamp.com/production/course_4249/datasets/humor_dataset.csv"
hsq <- read.csv(url, sep = ";")

#Use only 32 humor questions
humor <- hsq[1:32]


Run the factor analysis in psych on the covariance matrix to get RMSR and on the correlation matrix to get SRMR

# Get RMSR (unstandardized) using the covariance matrix in psych package
cov.mod <- fa(humor,
rotate = "oblimin",
fm = "ml",
covar = TRUE, # factor the covariance matrix
nfactors = 5)

cov.mod$rms # .04 = the root mean square of the residuals (RMSR). # This is unstandardized because we used the covariance matrix cor.mod <- fa(humor, rotate = "oblimin", fm = "ml", covar = FALSE, # factor the correlation matrix nfactors = 5) cor.mod$rms
# .03 = SRMR. It still says RMSR, but is now SRMR
# because we used the correlation matrix


Check using EFA in lavaan (which labels rmr and srmr separately)

# 5-factor model
f5 <- '
efa("efa")*f1 +
efa("efa")*f2 +
efa("efa")*f3 +
efa("efa")*f4 +
efa("efa")*f5 =~ Q1 + Q2 + Q3 + Q4 + Q5 + Q6 + Q7 + Q8 + Q9 + Q10 +
Q11 + Q12 + Q13 + Q14 + Q15 + Q16 + Q17 + Q18 + Q19 + Q20 +
Q21 + Q22 + Q23 + Q24 + Q25 + Q26 + Q27 + Q28 + Q29 + Q30 +
Q31 + Q32'

# Create the EFA model
efa_f5 <-
cfa(model = f5,
data = humor,
rotation = "oblimin",
estimator = "ml")
# Get the fit measures
fitmeasures(efa_f5,fit.measures = c("rmr","srmr"))


Compare psych and lavaan fit measures

round(data.frame(psych_RMSR = cov.mod$$rms, lavaan_rmr = fitmeasures(efa_f3,fit.measures = "rmr"), psych_SRMR = cor.mod$$rms,
lavaan_srmr = fitmeasures(efa_f3,fit.measures = "srmr")),2)

psych_RMSR lavaan_rmr psych_SRMR lavaan_srmr
rmr       0.04       0.04       0.03        0.03
$$$$
`
• If you are analyzing a correlation matrix, I believe you have SRMR. Sep 14, 2018 at 15:32
• The extraction method (by default) is minimum residual and the RMSR and df corrected values are listed in the model results. See Here- from CRAN psych Sep 17, 2018 at 13:13