obs.resid {faoutlier} | R Documentation |
Model predicted residual outliers
Description
Compute model predicted residuals for each variable using regression estimated factor scores.
Usage
obs.resid(data, model, ...)
## S3 method for class 'obs.resid'
print(x, restype = "obs", ...)
## S3 method for class 'obs.resid'
plot(
x,
y = NULL,
main = "Observed Residuals",
type = c("p", "h"),
restype = "obs",
...
)
Arguments
data |
matrix or data.frame |
model |
if a single numeric number declares number of factors to extract in
exploratory factor analysis. If |
... |
additional parameters to be passed |
x |
an object of class |
restype |
type of residual used, either |
y |
a |
main |
the main title of the plot |
type |
type of plot to use, default displays points and lines |
Author(s)
Phil Chalmers rphilip.chalmers@gmail.com
References
Chalmers, R. P. & Flora, D. B. (2015). faoutlier: An R Package for Detecting Influential Cases in Exploratory and Confirmatory Factor Analysis. Applied Psychological Measurement, 39, 573-574. doi: 10.1177/0146621615597894
Flora, D. B., LaBrish, C. & Chalmers, R. P. (2012). Old and new ideas for data screening and assumption testing for exploratory and confirmatory factor analysis. Frontiers in Psychology, 3, 1-21. doi: 10.3389/fpsyg.2012.00055
See Also
Examples
## Not run:
data(holzinger)
data(holzinger.outlier)
#Exploratory
nfact <- 3
(ORresult <- obs.resid(holzinger, nfact))
(ORresult.outlier <- obs.resid(holzinger.outlier, nfact))
plot(ORresult)
plot(ORresult.outlier)
#-------------------------------------------------------------------
#Confirmatory with sem
model <- sem::specifyModel()
F1 -> Remndrs, lam11
F1 -> SntComp, lam21
F1 -> WrdMean, lam31
F2 -> MissNum, lam41
F2 -> MxdArit, lam52
F2 -> OddWrds, lam62
F3 -> Boots, lam73
F3 -> Gloves, lam83
F3 -> Hatchts, lam93
F1 <-> F1, NA, 1
F2 <-> F2, NA, 1
F3 <-> F3, NA, 1
(ORresult <- obs.resid(holzinger, model))
(ORresult.outlier <- obs.resid(holzinger.outlier, model))
plot(ORresult)
plot(ORresult.outlier)
#-------------------------------------------------------------------
#Confirmatory with lavaan
model <- 'F1 =~ Remndrs + SntComp + WrdMean
F2 =~ MissNum + MxdArit + OddWrds
F3 =~ Boots + Gloves + Hatchts'
(obs.resid2 <- obs.resid(holzinger, model, orthogonal=TRUE))
(obs.resid2.outlier <- obs.resid(holzinger.outlier, model, orthogonal=TRUE))
plot(obs.resid2)
plot(obs.resid2.outlier)
## End(Not run)