sfcheung / semfindr

A find(e)r of influential cases and outliers in SEM
https://sfcheung.github.io/semfindr/
GNU General Public License v3.0
1 stars 0 forks source link

Bug in the `cutoff_gcd` argument in `gcd_gof_plot()` #37

Closed marklhc closed 2 years ago

marklhc commented 2 years ago

Hi Shu Fai,

Looks like there's a bug in the cutoff_gcd argument in gcd_gof_plot(), as documented below:

library(semfindr)
dat <- pa_dat

library(lavaan)
#> This is lavaan 0.6-9
#> lavaan is FREE software! Please report any bugs.
mod <-
  "
m1 ~ iv1 + iv2
dv ~ m1
"
fit <- sem(mod, dat)

fit_rerun <- lavaan_rerun(fit)
#> The expected CPU time is 9.3 second(s).
#> Could be faster if ran in parallel.

fit_influence <- influence_stat(fit_rerun)

gcd_gof_plot(fit_influence,
             fit_measure = "rmsea",
             cutoff_gcd = 0.25,
             largest_fit_measure = 3)

Created on 2021-10-25 by the reprex package (v2.0.1)

As shown the cut value was set on gof instead of gcd. I'll create a quick fix on a new branch.

Mark

marklhc commented 2 years ago

It's fixed now in the iss37 branch.

library(semfindr)
dat <- pa_dat

library(lavaan)
#> This is lavaan 0.6-9
#> lavaan is FREE software! Please report any bugs.
mod <-
  "
m1 ~ iv1 + iv2
dv ~ m1
"
fit <- sem(mod, dat)

fit_rerun <- lavaan_rerun(fit)
#> The expected CPU time is 7.5 second(s).
#> Could be faster if ran in parallel.

fit_influence <- influence_stat(fit_rerun)

gcd_gof_plot(fit_influence,
             fit_measure = "rmsea",
             cutoff_gcd = 0.25,
             largest_fit_measure = 3)

Created on 2021-10-25 by the reprex package (v2.0.1)

sfcheung commented 2 years ago

Thanks a lot, @marklhc ! I merged it to the devel branch.