knickodem / kfa

k-fold cross validation for factor analysis
GNU General Public License v3.0
7 stars 1 forks source link

Error stops rendering of kfa_report() #11

Closed brianmsm closed 1 year ago

brianmsm commented 1 year ago

Unfortunately for now I cannot provide you with a fully reproducible example, however, I will try to explain the problem and how it might be feasible to solve it after having traced where it is originating from.

When evaluating models with the kfafunction, I got one that had the following warning:

Warning messages:
1: In lav_object_post_check(object) :
  lavaan WARNING: covariance matrix of latent variables
                is not positive definite;
                use lavInspect(fit, "cov.lv") to investigate.
2: In lav_object_post_check(object) :
  lavaan WARNING: covariance matrix of latent variables
                is not positive definite;
                use lavInspect(fit, "cov.lv") to investigate.

This message in this model is only a warning message, since its fit indices and factor loadings are fully estimated.

When I use the kfa_report() function, I get the following error and the rendering never finishes executing.

image

When tracing the error, I notice that this originates when the same specific model from which I was getting the above warning, passed as an argument to the semPlot::semPaths() function: https://github.com/knickodem/kfa/blob/4ac1bf9eccbac19ff49eed8df09f1667b41cfdf0/inst/rmd/kfa-report.Rmd#L120

Since this error is a problem related to semPlot and cannot be solved from this package, I suggest 2 alternatives:

  1. Modify in the rmd template the general chunk options to allow rendering the document despite errors 2. This code: https://github.com/knickodem/kfa/blob/4ac1bf9eccbac19ff49eed8df09f1667b41cfdf0/inst/rmd/kfa-report.Rmd#L3 to:
knitr::opts_chunk$set(echo = FALSE, warning = TRUE)
  1. Or, include an argument in the kfa_report function that allows to choose the inclusion of the graph of the factorial models, something like kfa_report(..., plots = FALSE)
brianmsm commented 1 year ago

After giving the matter some thought, I have seen that the error only occurs with the latest version of lavaan (0.6-14) and when kfa evaluates a 2-factor model specified by its same EFA result:

library(kfa)
library(lavaan)
#> This is lavaan 0.6-14
#> lavaan is FREE software! Please report any bugs.
# simulate data based on a 3-factor model with standardized loadings
sim.mod <- "f1 =~ .7*x1 + .8*x2 + .3*x3 + .7*x4 + .6*x5 + .8*x6 + .4*x7
                f2 =~ .8*x8 + .7*x9 + .6*x10 + .5*x11 + .5*x12 + .7*x13 + .6*x14
                f3 =~ .6*x15 + .5*x16 + .9*x17 + .4*x18 + .7*x19 + .5*x20
                f1 ~~ .2*f2
                f2 ~~ .2*f3
                f1 ~~ .2*f3
                x9 ~~ .2*x10"
set.seed(1161)
sim.data <- simstandard::sim_standardized(sim.mod,
                                          n = 900,
                                          latent = FALSE,
                                          errors = FALSE)[c(2:9,1,10:20)]

# include a custom 2-factor model
custom2f <- paste0("f1 =~ ", paste(colnames(sim.data)[1:10], collapse = " + "),
                   "\nf2 =~ ",paste(colnames(sim.data)[11:20], collapse = " + "))

mods <- kfa(data = sim.data,
            k = NULL,    # NULL prompts power analysis to determine number of folds
            custom.cfas = custom2f  # can be a single object or named list

)
#> [1] "Using 11 cores for parallelization."
#> [1] "Finished EFAs. Starting CFAs"

semPlot::semPaths(mods$cfas[[1]]$`2-factor`)
#> Error in data.frame(label = pars$label, lhs = ifelse(pars$op == "~" | : arguments imply differing number of rows: 43, 1, 63

Created on 2023-02-21 with reprex v2.0.2

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.2 (2022-10-31 ucrt) #> os Windows 10 x64 (build 22621) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate Spanish_Peru.utf8 #> ctype Spanish_Peru.utf8 #> tz America/Bogota #> date 2023-02-21 #> pandoc 2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> ! package * version date (UTC) lib source #> abind 1.4-5 2016-07-21 [1] CRAN (R 4.2.0) #> arm 1.13-1 2022-08-28 [1] CRAN (R 4.2.2) #> askpass 1.1 2019-01-13 [1] CRAN (R 4.2.2) #> backports 1.4.1 2021-12-13 [1] CRAN (R 4.2.0) #> base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.2.0) #> boot 1.3-28 2021-05-03 [2] CRAN (R 4.2.2) #> cachem 1.0.6 2021-08-19 [1] CRAN (R 4.2.2) #> carData 3.0-5 2022-01-06 [1] CRAN (R 4.2.2) #> caret 6.0-93 2022-08-09 [1] CRAN (R 4.2.2) #> checkmate 2.1.0 2022-04-21 [1] CRAN (R 4.2.2) #> class 7.3-20 2022-01-16 [2] CRAN (R 4.2.2) #> cli 3.6.0 2023-01-09 [1] CRAN (R 4.2.2) #> cluster 2.1.4 2022-08-22 [2] CRAN (R 4.2.2) #> coda 0.19-4 2020-09-30 [1] CRAN (R 4.2.2) #> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.2) #> colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.2) #> corpcor 1.6.10 2021-09-16 [1] CRAN (R 4.2.0) #> crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.2) #> crul 1.3 2022-09-03 [1] CRAN (R 4.2.2) #> curl 5.0.0 2023-01-12 [1] CRAN (R 4.2.2) #> data.table 1.14.6 2022-11-16 [1] CRAN (R 4.2.2) #> deldir 1.0-6 2021-10-23 [1] CRAN (R 4.2.1) #> digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.2) #> doParallel 1.0.17 2022-02-07 [1] CRAN (R 4.2.2) #> dplyr 1.1.0 2023-01-29 [1] CRAN (R 4.2.2) #> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.2) #> emmeans 1.8.4-1 2023-01-17 [1] CRAN (R 4.2.2) #> estimability 1.4.1 2022-08-05 [1] CRAN (R 4.2.1) #> evaluate 0.20 2023-01-17 [1] CRAN (R 4.2.2) #> fansi 1.0.4 2023-01-22 [1] CRAN (R 4.2.2) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.2) #> fdrtool 1.2.17 2021-11-13 [1] CRAN (R 4.2.0) #> flextable 0.8.5 2023-01-29 [1] CRAN (R 4.2.2) #> foreach 1.5.2 2022-02-02 [1] CRAN (R 4.2.2) #> foreign 0.8-83 2022-09-28 [2] CRAN (R 4.2.2) #> Formula 1.2-4 2020-10-16 [1] CRAN (R 4.2.0) #> fs 1.6.0 2023-01-23 [1] CRAN (R 4.2.2) #> future 1.31.0 2023-02-01 [1] CRAN (R 4.2.2) #> future.apply 1.10.0 2022-11-05 [1] CRAN (R 4.2.2) #> gdtools 0.3.0 2023-01-15 [1] CRAN (R 4.2.2) #> generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.2) #> gfonts 0.2.0 2023-01-08 [1] CRAN (R 4.2.2) #> ggplot2 3.4.0 2022-11-04 [1] CRAN (R 4.2.2) #> glasso 1.11 2019-10-01 [1] CRAN (R 4.2.0) #> globals 0.16.2 2022-11-21 [1] CRAN (R 4.2.2) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.2) #> gower 1.0.1 2022-12-22 [1] CRAN (R 4.2.2) #> GPArotation 2022.10-2 2022-10-22 [1] CRAN (R 4.2.1) #> gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.2) #> gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.2) #> gtools 3.9.4 2022-11-27 [1] CRAN (R 4.2.2) #> hardhat 1.2.0 2022-06-30 [1] CRAN (R 4.2.2) #> Hmisc 4.7-2 2022-11-18 [1] CRAN (R 4.2.2) #> htmlTable 2.4.1 2022-07-07 [1] CRAN (R 4.2.2) #> htmltools 0.5.4 2022-12-07 [1] CRAN (R 4.2.2) #> htmlwidgets 1.6.1 2023-01-07 [1] CRAN (R 4.2.2) #> httpcode 0.3.0 2020-04-10 [1] CRAN (R 4.2.2) #> httpuv 1.6.8 2023-01-12 [1] CRAN (R 4.2.2) #> igraph 1.3.5 2022-09-22 [1] CRAN (R 4.2.2) #> interp 1.1-3 2022-07-13 [1] CRAN (R 4.2.2) #> ipred 0.9-13 2022-06-02 [1] CRAN (R 4.2.2) #> iterators 1.0.14 2022-02-05 [1] CRAN (R 4.2.2) #> jpeg 0.1-10 2022-11-29 [1] CRAN (R 4.2.2) #> jsonlite 1.8.4 2022-12-06 [1] CRAN (R 4.2.2) #> kfa * 0.2.1 2023-02-20 [1] Github (knickodem/kfa@4ac1bf9) #> knitr 1.42 2023-01-25 [1] CRAN (R 4.2.2) #> kutils 1.70 2020-04-29 [1] CRAN (R 4.2.2) #> later 1.3.0 2021-08-18 [1] CRAN (R 4.2.2) #> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.2) #> latticeExtra 0.6-30 2022-07-04 [1] CRAN (R 4.2.2) #> lava 1.7.1 2023-01-06 [1] CRAN (R 4.2.2) #> lavaan * 0.6-14 2023-02-09 [1] CRAN (R 4.2.2) #> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.2) #> lisrelToR 0.1.5 2022-05-09 [1] CRAN (R 4.2.0) #> listenv 0.9.0 2022-12-16 [1] CRAN (R 4.2.2) #> lme4 1.1-31 2022-11-01 [1] CRAN (R 4.2.2) #> lubridate 1.9.1 2023-01-24 [1] CRAN (R 4.2.2) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.2) #> MASS 7.3-58.1 2022-08-03 [2] CRAN (R 4.2.2) #> Matrix 1.5-1 2022-09-13 [2] CRAN (R 4.2.2) #> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.2) #> mi 1.1 2022-06-06 [1] CRAN (R 4.2.2) #> mime 0.12 2021-09-28 [1] CRAN (R 4.2.0) #> minqa 1.2.5 2022-10-19 [1] CRAN (R 4.2.2) #> mnormt 2.1.1 2022-09-26 [1] CRAN (R 4.2.1) #> ModelMetrics 1.2.2.2 2020-03-17 [1] CRAN (R 4.2.2) #> multcomp 1.4-20 2022-08-07 [1] CRAN (R 4.2.2) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.2) #> mvtnorm 1.1-3 2021-10-08 [1] CRAN (R 4.2.0) #> nlme 3.1-160 2022-10-10 [2] CRAN (R 4.2.2) #> nloptr 2.0.3 2022-05-26 [1] CRAN (R 4.2.2) #> nnet 7.3-18 2022-09-28 [2] CRAN (R 4.2.2) #> officer 0.5.2 2023-01-27 [1] CRAN (R 4.2.2) #> OpenMx 2.21.1 2023-01-19 [1] CRAN (R 4.2.2) #> openssl 2.0.5 2022-12-06 [1] CRAN (R 4.2.2) #> openxlsx 4.2.5.1 2022-10-24 [1] CRAN (R 4.2.2) #> parallelly 1.34.0 2023-01-13 [1] CRAN (R 4.2.2) #> pbapply 1.7-0 2023-01-13 [1] CRAN (R 4.2.2) #> pbivnorm 0.6.0 2015-01-23 [1] CRAN (R 4.2.0) #> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.2) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.2) #> plyr 1.8.8 2022-11-11 [1] CRAN (R 4.2.2) #> png 0.1-8 2022-11-29 [1] CRAN (R 4.2.2) #> pROC 1.18.0 2021-09-03 [1] CRAN (R 4.2.2) #> prodlim 2019.11.13 2019-11-17 [1] CRAN (R 4.2.2) #> promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.2) #> psych 2.2.9 2022-09-29 [1] CRAN (R 4.2.2) #> purrr 1.0.1 2023-01-10 [1] CRAN (R 4.2.2) #> qgraph 1.9.3 2022-12-09 [1] CRAN (R 4.2.2) #> quadprog 1.5-8 2019-11-20 [1] CRAN (R 4.2.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.2) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0) #> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0) #> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.2.2) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.2) #> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.2.0) #> Rcpp 1.0.10 2023-01-22 [1] CRAN (R 4.2.2) #> D RcppParallel 5.1.6 2023-01-09 [1] CRAN (R 4.2.2) #> recipes 1.0.4 2023-01-11 [1] CRAN (R 4.2.2) #> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.2) #> reshape2 1.4.4 2020-04-09 [1] CRAN (R 4.2.2) #> rlang 1.0.6 2022-09-24 [1] CRAN (R 4.2.2) #> rmarkdown 2.20 2023-01-19 [1] CRAN (R 4.2.2) #> rockchalk 1.8.157 2022-08-06 [1] CRAN (R 4.2.2) #> rpart 4.1.19 2022-10-21 [2] CRAN (R 4.2.2) #> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.2) #> sandwich 3.0-2 2022-06-15 [1] CRAN (R 4.2.2) #> scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.2) #> sem 3.1-15 2022-04-10 [1] CRAN (R 4.2.2) #> semPlot 1.1.6 2022-08-10 [1] CRAN (R 4.2.2) #> semTools 0.5-6 2022-05-10 [1] CRAN (R 4.2.2) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.2) #> shiny 1.7.4 2022-12-15 [1] CRAN (R 4.2.2) #> simstandard 0.6.3 2021-05-07 [1] CRAN (R 4.2.2) #> stringi 1.7.12 2023-01-11 [1] CRAN (R 4.2.2) #> stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.2) #> styler 1.9.0 2023-01-15 [1] CRAN (R 4.2.2) #> survival 3.4-0 2022-08-09 [2] CRAN (R 4.2.2) #> systemfonts 1.0.4 2022-02-11 [1] CRAN (R 4.2.2) #> TH.data 1.1-1 2022-04-26 [1] CRAN (R 4.2.2) #> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.2) #> tidyr 1.3.0 2023-01-24 [1] CRAN (R 4.2.2) #> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.2) #> timechange 0.2.0 2023-01-11 [1] CRAN (R 4.2.2) #> timeDate 4022.108 2023-01-07 [1] CRAN (R 4.2.2) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.2) #> uuid 1.1-0 2022-04-19 [1] CRAN (R 4.2.0) #> vctrs 0.5.2 2023-01-23 [1] CRAN (R 4.2.2) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.2) #> xfun 0.36 2022-12-21 [1] CRAN (R 4.2.2) #> XML 3.99-0.13 2022-12-04 [1] CRAN (R 4.2.2) #> xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.2) #> xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.2) #> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.2.2) #> zip 2.2.2 2022-10-26 [1] CRAN (R 4.2.2) #> zoo 1.8-11 2022-09-17 [1] CRAN (R 4.2.2) #> #> [1] C:/Users/brian/AppData/Local/R/win-library/4.2 #> [2] C:/Program Files/R/R-4.2.2/library #> #> D ── DLL MD5 mismatch, broken installation. #> #> ────────────────────────────────────────────────────────────────────────────── ```

When using lavaan 0.6-13 down, there is no error in the line associated with semPlot::semPaths():

library(kfa)
library(lavaan)
#> This is lavaan 0.6-13
#> lavaan is FREE software! Please report any bugs.
# simulate data based on a 3-factor model with standardized loadings
sim.mod <- "f1 =~ .7*x1 + .8*x2 + .3*x3 + .7*x4 + .6*x5 + .8*x6 + .4*x7
                f2 =~ .8*x8 + .7*x9 + .6*x10 + .5*x11 + .5*x12 + .7*x13 + .6*x14
                f3 =~ .6*x15 + .5*x16 + .9*x17 + .4*x18 + .7*x19 + .5*x20
                f1 ~~ .2*f2
                f2 ~~ .2*f3
                f1 ~~ .2*f3
                x9 ~~ .2*x10"
set.seed(1161)
sim.data <- simstandard::sim_standardized(sim.mod,
                                          n = 900,
                                          latent = FALSE,
                                          errors = FALSE)[c(2:9,1,10:20)]

# include a custom 2-factor model
custom2f <- paste0("f1 =~ ", paste(colnames(sim.data)[1:10], collapse = " + "),
                   "\nf2 =~ ",paste(colnames(sim.data)[11:20], collapse = " + "))

mods <- kfa(data = sim.data,
            k = NULL,    # NULL prompts power analysis to determine number of folds
            custom.cfas = custom2f  # can be a single object or named list

)
#> [1] "Using 11 cores for parallelization."
#> [1] "Finished EFAs. Starting CFAs"

semPlot::semPaths(mods$cfas[[1]]$`2-factor`)

Created on 2023-02-21 with reprex v2.0.2

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.2 (2022-10-31 ucrt) #> os Windows 10 x64 (build 22621) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate Spanish_Peru.utf8 #> ctype Spanish_Peru.utf8 #> tz America/Bogota #> date 2023-02-21 #> pandoc 2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> ! package * version date (UTC) lib source #> abind 1.4-5 2016-07-21 [1] CRAN (R 4.2.0) #> arm 1.13-1 2022-08-28 [1] CRAN (R 4.2.2) #> askpass 1.1 2019-01-13 [1] CRAN (R 4.2.2) #> backports 1.4.1 2021-12-13 [1] CRAN (R 4.2.0) #> base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.2.0) #> boot 1.3-28 2021-05-03 [2] CRAN (R 4.2.2) #> cachem 1.0.6 2021-08-19 [1] CRAN (R 4.2.2) #> carData 3.0-5 2022-01-06 [1] CRAN (R 4.2.2) #> caret 6.0-93 2022-08-09 [1] CRAN (R 4.2.2) #> checkmate 2.1.0 2022-04-21 [1] CRAN (R 4.2.2) #> class 7.3-20 2022-01-16 [2] CRAN (R 4.2.2) #> cli 3.6.0 2023-01-09 [1] CRAN (R 4.2.2) #> cluster 2.1.4 2022-08-22 [2] CRAN (R 4.2.2) #> coda 0.19-4 2020-09-30 [1] CRAN (R 4.2.2) #> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.2) #> colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.2) #> corpcor 1.6.10 2021-09-16 [1] CRAN (R 4.2.0) #> crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.2) #> crul 1.3 2022-09-03 [1] CRAN (R 4.2.2) #> curl 5.0.0 2023-01-12 [1] CRAN (R 4.2.2) #> data.table 1.14.6 2022-11-16 [1] CRAN (R 4.2.2) #> deldir 1.0-6 2021-10-23 [1] CRAN (R 4.2.1) #> digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.2) #> doParallel 1.0.17 2022-02-07 [1] CRAN (R 4.2.2) #> dplyr 1.1.0 2023-01-29 [1] CRAN (R 4.2.2) #> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.2) #> emmeans 1.8.4-1 2023-01-17 [1] CRAN (R 4.2.2) #> estimability 1.4.1 2022-08-05 [1] CRAN (R 4.2.1) #> evaluate 0.20 2023-01-17 [1] CRAN (R 4.2.2) #> fansi 1.0.4 2023-01-22 [1] CRAN (R 4.2.2) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.2) #> fdrtool 1.2.17 2021-11-13 [1] CRAN (R 4.2.0) #> flextable 0.8.5 2023-01-29 [1] CRAN (R 4.2.2) #> foreach 1.5.2 2022-02-02 [1] CRAN (R 4.2.2) #> foreign 0.8-83 2022-09-28 [2] CRAN (R 4.2.2) #> Formula 1.2-4 2020-10-16 [1] CRAN (R 4.2.0) #> fs 1.6.0 2023-01-23 [1] CRAN (R 4.2.2) #> future 1.31.0 2023-02-01 [1] CRAN (R 4.2.2) #> future.apply 1.10.0 2022-11-05 [1] CRAN (R 4.2.2) #> gdtools 0.3.0 2023-01-15 [1] CRAN (R 4.2.2) #> generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.2) #> gfonts 0.2.0 2023-01-08 [1] CRAN (R 4.2.2) #> ggplot2 3.4.0 2022-11-04 [1] CRAN (R 4.2.2) #> glasso 1.11 2019-10-01 [1] CRAN (R 4.2.0) #> globals 0.16.2 2022-11-21 [1] CRAN (R 4.2.2) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.2) #> gower 1.0.1 2022-12-22 [1] CRAN (R 4.2.2) #> GPArotation 2022.10-2 2022-10-22 [1] CRAN (R 4.2.1) #> gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.2) #> gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.2) #> gtools 3.9.4 2022-11-27 [1] CRAN (R 4.2.2) #> hardhat 1.2.0 2022-06-30 [1] CRAN (R 4.2.2) #> highr 0.10 2022-12-22 [1] CRAN (R 4.2.2) #> Hmisc 4.7-2 2022-11-18 [1] CRAN (R 4.2.2) #> htmlTable 2.4.1 2022-07-07 [1] CRAN (R 4.2.2) #> htmltools 0.5.4 2022-12-07 [1] CRAN (R 4.2.2) #> htmlwidgets 1.6.1 2023-01-07 [1] CRAN (R 4.2.2) #> httpcode 0.3.0 2020-04-10 [1] CRAN (R 4.2.2) #> httpuv 1.6.8 2023-01-12 [1] CRAN (R 4.2.2) #> httr 1.4.4 2022-08-17 [1] CRAN (R 4.2.2) #> igraph 1.3.5 2022-09-22 [1] CRAN (R 4.2.2) #> interp 1.1-3 2022-07-13 [1] CRAN (R 4.2.2) #> ipred 0.9-13 2022-06-02 [1] CRAN (R 4.2.2) #> iterators 1.0.14 2022-02-05 [1] CRAN (R 4.2.2) #> jpeg 0.1-10 2022-11-29 [1] CRAN (R 4.2.2) #> jsonlite 1.8.4 2022-12-06 [1] CRAN (R 4.2.2) #> kfa * 0.2.1 2023-02-20 [1] Github (knickodem/kfa@4ac1bf9) #> knitr 1.42 2023-01-25 [1] CRAN (R 4.2.2) #> kutils 1.70 2020-04-29 [1] CRAN (R 4.2.2) #> later 1.3.0 2021-08-18 [1] CRAN (R 4.2.2) #> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.2) #> latticeExtra 0.6-30 2022-07-04 [1] CRAN (R 4.2.2) #> lava 1.7.1 2023-01-06 [1] CRAN (R 4.2.2) #> lavaan * 0.6-13 2023-01-09 [1] CRAN (R 4.2.2) #> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.2) #> lisrelToR 0.1.5 2022-05-09 [1] CRAN (R 4.2.0) #> listenv 0.9.0 2022-12-16 [1] CRAN (R 4.2.2) #> lme4 1.1-31 2022-11-01 [1] CRAN (R 4.2.2) #> lubridate 1.9.1 2023-01-24 [1] CRAN (R 4.2.2) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.2) #> MASS 7.3-58.1 2022-08-03 [2] CRAN (R 4.2.2) #> Matrix 1.5-1 2022-09-13 [2] CRAN (R 4.2.2) #> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.2) #> mi 1.1 2022-06-06 [1] CRAN (R 4.2.2) #> mime 0.12 2021-09-28 [1] CRAN (R 4.2.0) #> minqa 1.2.5 2022-10-19 [1] CRAN (R 4.2.2) #> mnormt 2.1.1 2022-09-26 [1] CRAN (R 4.2.1) #> ModelMetrics 1.2.2.2 2020-03-17 [1] CRAN (R 4.2.2) #> multcomp 1.4-20 2022-08-07 [1] CRAN (R 4.2.2) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.2) #> mvtnorm 1.1-3 2021-10-08 [1] CRAN (R 4.2.0) #> nlme 3.1-160 2022-10-10 [2] CRAN (R 4.2.2) #> nloptr 2.0.3 2022-05-26 [1] CRAN (R 4.2.2) #> nnet 7.3-18 2022-09-28 [2] CRAN (R 4.2.2) #> officer 0.5.2 2023-01-27 [1] CRAN (R 4.2.2) #> OpenMx 2.21.1 2023-01-19 [1] CRAN (R 4.2.2) #> openssl 2.0.5 2022-12-06 [1] CRAN (R 4.2.2) #> openxlsx 4.2.5.1 2022-10-24 [1] CRAN (R 4.2.2) #> parallelly 1.34.0 2023-01-13 [1] CRAN (R 4.2.2) #> pbapply 1.7-0 2023-01-13 [1] CRAN (R 4.2.2) #> pbivnorm 0.6.0 2015-01-23 [1] CRAN (R 4.2.0) #> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.2) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.2) #> plyr 1.8.8 2022-11-11 [1] CRAN (R 4.2.2) #> png 0.1-8 2022-11-29 [1] CRAN (R 4.2.2) #> pROC 1.18.0 2021-09-03 [1] CRAN (R 4.2.2) #> prodlim 2019.11.13 2019-11-17 [1] CRAN (R 4.2.2) #> promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.2) #> psych 2.2.9 2022-09-29 [1] CRAN (R 4.2.2) #> purrr 1.0.1 2023-01-10 [1] CRAN (R 4.2.2) #> qgraph 1.9.3 2022-12-09 [1] CRAN (R 4.2.2) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.2) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0) #> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0) #> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.2.2) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.2) #> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.2.0) #> Rcpp 1.0.10 2023-01-22 [1] CRAN (R 4.2.2) #> D RcppParallel 5.1.6 2023-01-09 [1] CRAN (R 4.2.2) #> recipes 1.0.4 2023-01-11 [1] CRAN (R 4.2.2) #> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.2) #> reshape2 1.4.4 2020-04-09 [1] CRAN (R 4.2.2) #> rlang 1.0.6 2022-09-24 [1] CRAN (R 4.2.2) #> rmarkdown 2.20 2023-01-19 [1] CRAN (R 4.2.2) #> rockchalk 1.8.157 2022-08-06 [1] CRAN (R 4.2.2) #> rpart 4.1.19 2022-10-21 [2] CRAN (R 4.2.2) #> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.2) #> sandwich 3.0-2 2022-06-15 [1] CRAN (R 4.2.2) #> scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.2) #> sem 3.1-15 2022-04-10 [1] CRAN (R 4.2.2) #> semPlot 1.1.6 2022-08-10 [1] CRAN (R 4.2.2) #> semTools 0.5-6 2022-05-10 [1] CRAN (R 4.2.2) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.2) #> shiny 1.7.4 2022-12-15 [1] CRAN (R 4.2.2) #> simstandard 0.6.3 2021-05-07 [1] CRAN (R 4.2.2) #> stringi 1.7.12 2023-01-11 [1] CRAN (R 4.2.2) #> stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.2) #> styler 1.9.0 2023-01-15 [1] CRAN (R 4.2.2) #> survival 3.4-0 2022-08-09 [2] CRAN (R 4.2.2) #> systemfonts 1.0.4 2022-02-11 [1] CRAN (R 4.2.2) #> TH.data 1.1-1 2022-04-26 [1] CRAN (R 4.2.2) #> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.2) #> tidyr 1.3.0 2023-01-24 [1] CRAN (R 4.2.2) #> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.2) #> timechange 0.2.0 2023-01-11 [1] CRAN (R 4.2.2) #> timeDate 4022.108 2023-01-07 [1] CRAN (R 4.2.2) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.2) #> uuid 1.1-0 2022-04-19 [1] CRAN (R 4.2.0) #> vctrs 0.5.2 2023-01-23 [1] CRAN (R 4.2.2) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.2) #> xfun 0.36 2022-12-21 [1] CRAN (R 4.2.2) #> XML 3.99-0.13 2022-12-04 [1] CRAN (R 4.2.2) #> xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.2) #> xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.2) #> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.2.2) #> zip 2.2.2 2022-10-26 [1] CRAN (R 4.2.2) #> zoo 1.8-11 2022-09-17 [1] CRAN (R 4.2.2) #> #> [1] C:/Users/brian/AppData/Local/R/win-library/4.2 #> [2] C:/Program Files/R/R-4.2.2/library #> #> D ── DLL MD5 mismatch, broken installation. #> #> ────────────────────────────────────────────────────────────────────────────── ```
knickodem commented 1 year ago

Thanks for the thorough investigation. This is not the first time the rendering has been derailed by an issue with the plots, which led me to consider an argument to opt out of the plots, just as you suggest. I'll keep this issue open until I make this addition (relatively soon).

I also like the idea of printing the warnings, but I would want to do so in a more user friendly way (i.e., interpretable for non-technical audiences) than what is provided by warning = TRUE.

brianmsm commented 1 year ago

Thanks for the prompt reply! I agree that the warning messages can be hidden by default, although it would be useful also a section in the report associated to convergence and undefined positive matrix problems (which are the most frequent).

I did not realize that I indicated in the first suggestion the warning = TRUE, my intention was:

knitr::opts_chunk$set(echo = FALSE, error = TRUE)

So that the rendering does not stop, even if some of the chunks end in an error.

knickodem commented 1 year ago

Yea at the moment any convergence or model issue problems are captured and counted in the improper solutions column of the model summary statement, but you would have to manually pull the model out of the kfa object to determine the specific problem.

I'm hesitate to set error = TRUE as the rendering interruption helps identify where there might be bugs that need to be fixed or model issues that we should address more directly.

I've added the plots argument to kfa_report() and it should be available on the developmental version.