3
$\begingroup$

I'm getting the warning In cor.smooth(R) : Matrix was not positive definite, smoothing was done, but what is it in this case? Can I get away with that?

  • code:
library(psych)

## note: Q11 and Q15 have reversed scales (thus, -1)

psych::alpha(PBQuest,
             keys = c(1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 
    1, 1))

  • output with the warning:
Reliability analysis   
Call: psych::alpha(x = PBQuest, keys = c(1, 1, 1, 1, 1, -1, 1, 1, 1, 
    -1, 1, 1, 1, 1, 1, 1, 1))

  raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
      0.82      0.82    0.91      0.22 4.7 0.072  2.6 0.48     0.23

    95% confidence boundaries 
         lower alpha upper
Feldt     0.64  0.82  0.93
Duhachek  0.68  0.82  0.96

 Reliability if an item is dropped:
     raw_alpha std.alpha G6(smc) average_r S/N var.r med.r
Q6        0.81      0.82    0.93      0.22 4.5 0.064  0.23
Q7        0.82      0.82    0.94      0.22 4.5 0.065  0.23
Q8        0.80      0.81    0.93      0.21 4.2 0.069  0.22
Q9        0.80      0.81    0.92      0.21 4.2 0.068  0.22
Q10       0.80      0.81    0.92      0.21 4.3 0.069  0.22
Q11-      0.81      0.82    0.93      0.22 4.5 0.069  0.23
Q12       0.81      0.81    0.95      0.21 4.3 0.067  0.23
Q13       0.80      0.81    0.92      0.21 4.2 0.070  0.22
Q14       0.82      0.82    0.94      0.22 4.6 0.065  0.23
Q15-      0.80      0.81    0.92      0.21 4.3 0.063  0.24
Q16       0.81      0.81    0.96      0.22 4.4 0.067  0.22
Q17       0.80      0.80    0.92      0.20 4.0 0.066  0.21
Q18       0.81      0.82    0.93      0.22 4.5 0.070  0.24
Q19       0.81      0.82    0.94      0.22 4.5 0.063  0.23
Q20       0.79      0.80    0.92      0.20 3.9 0.064  0.20
Q21       0.82      0.83    0.94      0.23 4.8 0.065  0.24
Q22       0.82      0.82    0.93      0.23 4.7 0.062  0.23

 Item statistics 
      n raw.r std.r r.cor r.drop mean   sd
Q6   14  0.50  0.46  0.46   0.39  2.8 1.05
Q7   14  0.42  0.42  0.41   0.30  1.9 1.07
Q8   14  0.59  0.58  0.58   0.53  3.8 0.80
Q9   14  0.65  0.62  0.61   0.55  3.1 1.23
Q10  14  0.59  0.56  0.56   0.50  3.5 1.02
Q11- 14  0.43  0.43  0.40   0.33  3.1 0.95
Q12  14  0.53  0.57  0.57   0.47  1.4 0.65
Q13  14  0.59  0.60  0.58   0.50  2.1 1.03
Q14  14  0.36  0.37  0.37   0.28  3.6 0.74
Q15- 14  0.58  0.56  0.51   0.49  2.8 0.97
Q16  14  0.47  0.51  0.52   0.38  2.3 0.91
Q17  14  0.68  0.71  0.69   0.63  1.8 0.70
Q18  14  0.43  0.44  0.39   0.32  1.9 1.00
Q19  14  0.46  0.45  0.44   0.35  1.7 0.99
Q20  14  0.77  0.76  0.67   0.72  2.5 1.02
Q21  14  0.30  0.28  0.24   0.18  2.6 1.01
Q22  14  0.32  0.35  0.32   0.22  3.4 0.85

Non missing response frequency for each item
       1    2    3    4    5 miss
Q6  0.07 0.43 0.14 0.36 0.00    0
Q7  0.43 0.36 0.07 0.14 0.00    0
Q8  0.00 0.14 0.00 0.79 0.07    0
Q9  0.14 0.14 0.21 0.43 0.07    0
Q10 0.00 0.21 0.21 0.43 0.14    0
Q11 0.00 0.50 0.14 0.36 0.00    0
Q12 0.64 0.29 0.07 0.00 0.00    0
Q13 0.29 0.43 0.14 0.14 0.00    0
Q14 0.00 0.14 0.07 0.79 0.00    0
Q15 0.00 0.36 0.07 0.57 0.00    0
Q16 0.14 0.57 0.14 0.14 0.00    0
Q17 0.36 0.50 0.14 0.00 0.00    0
Q18 0.36 0.50 0.00 0.14 0.00    0
Q19 0.57 0.21 0.14 0.07 0.00    0
Q20 0.14 0.43 0.21 0.21 0.00    0
Q21 0.07 0.50 0.14 0.29 0.00    0
Q22 0.00 0.21 0.14 0.64 0.00    0
There were 20 warnings (use warnings() to see them)
> warnings()
Mensagens de aviso:
1: In cor.smooth(r) : Matrix was not positive definite, smoothing was done
2: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
3: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
4: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
5: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
6: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
7: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
8: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
9: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
10: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
11: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
12: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
13: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
14: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
15: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
16: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
17: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
18: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
19: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
20: In cor.smooth(R) : Matrix was not positive definite, smoothing was done
  • the data:
> dput(PBQuest)
structure(list(Q6 = c(2, 2, 4, 4, 2, 3, 2, 2, 2, 4, 4, 1, 4, 
3), Q7 = c(2, 1, 1, 1, 1, 2, 4, 4, 2, 2, 1, 1, 2, 3), Q8 = c(4, 
4, 5, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4), Q9 = c(3, 3, 4, 4, 2, 
3, 4, 4, 1, 2, 4, 1, 5, 4), Q10 = c(3, 4, 4, 3, 2, 2, 5, 5, 2, 
4, 4, 3, 4, 4), Q11 = c(4, 2, 3, 2, 4, 2, 2, 2, 4, 4, 2, 3, 4, 
2), Q12 = c(2, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 3), Q13 = c(2, 
1, 3, 2, 2, 3, 2, 2, 1, 4, 1, 2, 1, 4), Q14 = c(4, 4, 4, 4, 2, 
4, 4, 4, 4, 4, 2, 3, 4, 4), Q15 = c(4, 4, 2, 2, 4, 4, 4, 4, 4, 
2, 2, 3, 4, 2), Q16 = c(2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 1, 3, 1, 
4), Q17 = c(2, 1, 2, 2, 2, 2, 3, 2, 1, 1, 2, 1, 1, 3), Q18 = c(4, 
2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 4), Q19 = c(2, 1, 2, 3, 1, 
1, 1, 1, 1, 1, 4, 2, 1, 3), Q20 = c(2, 1, 3, 3, 2, 2, 3, 2, 1, 
4, 4, 2, 2, 4), Q21 = c(4, 4, 2, 2, 1, 2, 3, 2, 2, 4, 2, 2, 4, 
3), Q22 = c(4, 2, 4, 4, 4, 3, 4, 2, 4, 4, 4, 3, 2, 4)), class = "data.frame", row.names = c(NA, 
-14L))
  • I've seen some posts for the same error, but not for calculating Cronbach's alpha.
$\endgroup$
1

1 Answer 1

5
$\begingroup$

Per the package function linked by Jeremy Miles, cor.smooth is a function within the psych package that is used to transform a non-positive-definite matrix by using a principal components smoothing of your data. This can be done explicitly with the function itself, but it is also included as a default in some of the other functions in the psych package. The reason it does this is because various matrix operations like factor analysis will estimate poorly and kick back an error regarding the non-positive-definite matrix (which is not supposed to be possible, indicating a severe error).

This isn't necessarily an issue, if anything it is trying to fix what is likely a weird data structure (lots of missing data or lots of binary data for example). I would still try to investigate what your data actually looks like first, but I don't think its a point of concern.

$\endgroup$
2
  • $\begingroup$ Hi, Shawn, would you mind exploring on "The reason it does this is because various matrix operations like factor analysis will estimate poorly and kick back an error regarding the non-positive-definite matrix" ? I've read the documentation, but I couldn't get my head around that $\endgroup$ Commented Dec 7, 2022 at 21:53
  • 1
    $\begingroup$ Check out the link here stats.stackexchange.com/a/590492/345611 $\endgroup$ Commented Dec 8, 2022 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.