GOF: Goodness of Fit Distance

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/GOF.R

Description

Compute Goodness of Fit distances between models when removing the i_{th} case. If mirt is used, then the values will be associated with the unique response patterns instead.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
GOF(data, model, M2 = TRUE, progress = TRUE, ...)

## S3 method for class 'GOF'
print(x, ncases = 10, digits = 5, ...)

## S3 method for class 'GOF'
plot(
  x,
  y = NULL,
  main = "Goodness of Fit Distance",
  type = c("p", "h"),
  ylab = "GOF",
  absolute = FALSE,
  ...
)

Arguments

data

matrix or data.frame

model

if a single numeric number declares number of factors to extract in exploratory factor analysis (requires complete dataset, i.e., no missing). If class(model) is a sem (semmod), or lavaan (character), then a confirmatory approach is performed instead. Finally, if the model is defined with mirt::mirt.model() then distances will be computed for categorical data with the mirt package

M2

logical; use the M2 statistic for when using mirt objects instead of G2?

progress

logical; display the progress of the computations in the console?

...

additional parameters to be passed

x

an object of class GOF

ncases

number of extreme cases to display

digits

number of digits to round in the printed result

y

a NULL value ignored by the plotting function

main

the main title of the plot

type

type of plot to use, default displays points and lines

ylab

the y label of the plot

absolute

logical; use absolute values instead of deviations?

Details

Note that GOF is not limited to confirmatory factor analysis and can apply to nearly any model being studied where detection of influential observations is important.

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

gCD, LD, obs.resid, robustMD, setCluster

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## Not run: 

#run all GOF functions using multiple cores
setCluster()

#Exploratory
nfact <- 3
(GOFresult <- GOF(holzinger, nfact))
(GOFresult.outlier <- GOF(holzinger.outlier, nfact))
plot(GOFresult)
plot(GOFresult.outlier)

## include a progress bar
GOFresult <- GOF(holzinger, nfact, progress = TRUE)

#-------------------------------------------------------------------
#Confirmatory with sem
model <- sem::specifyModel()
  F1 -> Remndrs,    lam11
	  F1 -> SntComp,    lam21
	  F1 -> WrdMean,    lam31
	  F2 -> MissNum,    lam42
	  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

(GOFresult <- GOF(holzinger, model))
(GOFresult.outlier <- GOF(holzinger.outlier, model))
plot(GOFresult)
plot(GOFresult.outlier)

#-------------------------------------------------------------------
#Confirmatory with lavaan
model <- 'F1 =~  Remndrs + SntComp + WrdMean
F2 =~ MissNum + MxdArit + OddWrds
F3 =~ Boots + Gloves + Hatchts'

(GOFresult <- GOF(holzinger, model, orthogonal=TRUE))
(GOFresult.outlier <- GOF(holzinger.outlier, model, orthogonal=TRUE))
plot(GOFresult)
plot(GOFresult.outlier)


# categorical data with mirt
library(mirt)
data(LSAT7)
dat <- expand.table(LSAT7)
model <- mirt.model('F = 1-5')
result <- GOF(dat, model)
plot(result)


## End(Not run)

faoutlier documentation built on Jan. 13, 2021, 7:04 p.m.