Residuals in the various psych functions are extracted and then may be "pretty" printed.

# S3 method for class 'psych'
residuals(object,diag=TRUE,...)
# S3 method for class 'psych'
resid(object,diag=TRUE,...)

Arguments

object

The object returned by a psych function.

diag

if FALSE, then convert the diagonal of the residuals to NA

...

Other parameters to be passed to residual (ignored but required by the generic function)

Details

Currently implemented for fa, principal, omega, irt.fa, and fa.extension.

Value

residuals: a matrix of residual estimates

Author

William Revelle

Examples

f3 <- fa(Thurstone,3)
residuals(f3)
#>                   Sntnc Vcblr Snt.C Frs.L F.L.W Sffxs Ltt.S Pdgrs Ltt.G
#> Sentences          0.18                                                
#> Vocabulary         0.01  0.16                                          
#> Sent.Completion    0.00 -0.01  0.26                                    
#> First.Letters     -0.01  0.00  0.01  0.27                              
#> Four.Letter.Words  0.01  0.00  0.00  0.00  0.37                        
#> Suffixes           0.00  0.00  0.00  0.00  0.00  0.50                  
#> Letter.Series      0.00  0.01 -0.01  0.01 -0.01  0.00  0.27            
#> Pedigrees         -0.01  0.00  0.02  0.00  0.00  0.01  0.00  0.49      
#> Letter.Group       0.01 -0.01  0.00  0.00  0.01  0.00  0.00  0.00  0.48
sum(residuals(f3)^2) #include diagonal
#> [1] 1.142454
sum(residuals(f3,diag=FALSE)^2,na.rm=TRUE) #drop diagonal
#> [1] 0.002456811