Learn R Programming

sem (version 0.9-13)

residuals.sem: Residual Covariances for a Structural Equation Model

Description

These functions compute residual covariances, variance-standardized residual covariances, and normalized residual covariances for the observed variables in a structural-equation model fit by sem.

Usage

## S3 method for class 'sem':
residuals(object, ...)

standardized.residuals(object, ...)

## S3 method for class 'sem':
standardized.residuals(object, ...)

normalized.residuals(object, ...)

## S3 method for class 'sem':
normalized.residuals(object, ...)

Arguments

object
an object of class sem returned by the sem function.
...
not for the user.

Value

  • Each function returns a matrix of residuals.

Details

Residuals are defined as $S - C$, where $S$ is the sample covariance matrix of the observed variables and $C$ is the model-reproduced covariance matrix. The standardized residual covariance for a pair of variables divides the residual covariance by the product of the sample standard deviations of the two variables, $(s_{ij} - c_{ij})/(s_{ii}s_{jj})^{1/2}$. The normalized residual is given by $$\frac{s_{ij}-c_{ij}} {[(c_{ii}c_{jj}-c_{ij}^2)/N^{*}]^{1/2}}$$ where $N^{*}$ is the number of observations minus one if the model is fit to a covariance matrix, or the number of observations if it is fit to a raw moment matrix.

References

Bollen, K. A. (1989) Structural Equations With Latent Variables. Wiley.

See Also

sem

Examples

Run this code
# ------------- assumes that Duncan, Haller and Portes peer-influences model
# -------------     has been fit and is in sem.dhp.1

residuals(sem.dhp.1)

##                  ROccAsp        REdAsp       FOccAsp        FEdAsp
##    ROccAsp  4.156103e-07 -2.896368e-07 -2.866110e-02  9.102874e-02
##    REdAsp  -2.896368e-07 -1.541581e-06 -1.094841e-02 -2.379215e-02
##    FOccAsp -2.866110e-02 -1.094841e-02 -3.740356e-06 -9.564103e-07
##    
##    . . .
##    
##                      FIQ       FParAsp
##    ROccAsp  3.467853e-02 -3.187309e-02
##    REdAsp   4.878970e-03 -4.443480e-02
##    FOccAsp -7.354686e-03  2.488120e-02
##    FEdAsp   1.124604e-02 -3.690078e-02
##    RParAsp  2.775558e-17  5.551115e-17
##    RIQ      2.220446e-16  6.938894e-17
##    RSES     0.000000e+00 -1.387779e-17
##    FSES     1.110223e-16 -2.775558e-17
##    FIQ      4.440892e-16  1.110223e-16
##    FParAsp  1.110223e-16  4.440892e-16

normalized.residuals(sem.dhp.1) 

##                  ROccAsp        REdAsp       FOccAsp        FEdAsp
##    ROccAsp  5.330519e-06 -4.455587e-06 -4.898232e-01  1.567678e+00
##    REdAsp  -4.455587e-06 -1.977191e-05 -1.857670e-01 -4.071582e-01
##    FOccAsp -4.898232e-01 -1.857670e-01 -4.797271e-05 -1.460881e-05
##    
##    . . .
##    
##                      FIQ       FParAsp
##    ROccAsp  6.080514e-01 -5.747909e-01
##    REdAsp   8.518738e-02 -8.007295e-01
##    FOccAsp -1.180429e-01  4.374639e-01
##    FEdAsp   1.832159e-01 -6.514685e-01
##    RParAsp  5.019082e-16  1.000322e-15
##    RIQ      3.818356e-15  1.252092e-15
##    RSES     0.000000e+00 -2.506364e-16
##    FSES     1.931472e-15 -5.029583e-16
##    FIQ      5.695780e-15  1.971289e-15
##    FParAsp  1.971289e-15  5.695780e-15
      
standardized.residuals(sem.dhp.1)

##                  ROccAsp        REdAsp       FOccAsp        FEdAsp
##    ROccAsp  4.156103e-07 -2.896368e-07 -2.866110e-02  9.102874e-02
##    REdAsp  -2.896368e-07 -1.541581e-06 -1.094841e-02 -2.379215e-02
##    FOccAsp -2.866110e-02 -1.094841e-02 -3.740356e-06 -9.564103e-07
##    
##    . . .
##    
##                      FIQ       FParAsp
##    ROccAsp  3.467853e-02 -3.187309e-02
##    REdAsp   4.878970e-03 -4.443480e-02
##    FOccAsp -7.354686e-03  2.488120e-02
##    FEdAsp   1.124604e-02 -3.690078e-02
##    RParAsp  2.775558e-17  5.551115e-17
##    RIQ      2.220446e-16  6.938894e-17
##    RSES     0.000000e+00 -1.387779e-17
##    FSES     1.110223e-16 -2.775558e-17
##    FIQ      4.440892e-16  1.110223e-16
##    FParAsp  1.110223e-16  4.440892e-16

Run the code above in your browser using DataLab