* using log directory ‘/data/blackswan/ripley/R/packages/tests-devel/psychonetrics.Rcheck’ * using R Under development (unstable) (2026-02-11 r89406) * using platform: x86_64-pc-linux-gnu * R was compiled by gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3) GNU Fortran (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3) * running under: Fedora Linux 40 (Workstation Edition) * using session charset: UTF-8 * current time: 2026-02-11 22:29:07 UTC * checking for file ‘psychonetrics/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘psychonetrics’ version ‘0.13.2’ * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘psychonetrics’ can be installed ... [14m/10m] OK * used C++ compiler: ‘g++ (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)’ * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking whether startup messages can be suppressed ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [43s/44s] OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of ‘data’ directory ... OK * checking data for non-ASCII characters ... OK * checking data for ASCII and uncompressed saves ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking compilation flags in Makevars ... OK * checking for GNU extensions in Makefiles ... OK * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK * checking use of PKG_*FLAGS in Makefiles ... OK * checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK * checking compilation flags used ... OK * checking compiled code ... OK * checking examples ... OK * checking examples with --run-donttest ... [21s/21s] ERROR Running examples in ‘psychonetrics-Ex.R’ failed The error most likely occurred in: > ### Name: lvm > ### Title: Continuous latent variable family of psychonetrics models > ### Aliases: lvm lnm rnm lrnm > > ### ** Examples > > library("dplyr") Attaching package: ‘dplyr’ The following objects are masked from ‘package:stats’: filter, lag The following objects are masked from ‘package:base’: intersect, setdiff, setequal, union > > ### Confirmatory Factor Analysis ### > > # Example also shown in https://youtu.be/Hdu5z-fwuk8 > > # Load data: > data(StarWars) > > # Originals only: > Lambda <- matrix(1,4) > > # Model: > mod0 <- lvm(StarWars, lambda = Lambda, vars = c("Q1","Q5","Q6","Q7"), + identification = "variance", latents = "Originals") > > # Run model: > mod0 <- mod0 %>% runmodel > > # Evaluate fit: > mod0 %>% fit Measure Value logl -1676.50 unrestricted.logl -1676.04 baseline.logl -1791.67 nvar 4 nobs 14 npar 12 df 2 objective 5.02 chisq 0.93 pvalue 0.63 baseline.chisq 231.26 baseline.npar 8 baseline.df 6 baseline.pvalue ~ 0 nfi 1.0 pnfi 0.33 tli 1.01 nnfi 1.01 rfi 0.99 ifi 1.00 rni 1.00 cfi 1 rmsea ~ 0 rmsea.ci.lower ~ 0 rmsea.ci.upper 0.096 rmsea.pvalue 0.78 aic.ll 3377.00 aic.ll2 3378.21 aic.x -3.07 aic.x2 24.93 bic 3420.23 bic2 3382.18 ebic.25 3436.86 ebic.5 3453.50 ebic.75 3466.81 ebic1 3486.77 > > ## No test: > # Full analysis > # Factor loadings matrix: > Lambda <- matrix(0, 10, 3) > Lambda[1:4,1] <- 1 > Lambda[c(1,5:7),2] <- 1 > Lambda[c(1,8:10),3] <- 1 > > # Observed variables: > obsvars <- paste0("Q",1:10) > > # Latents: > latents <- c("Prequels","Original","Sequels") > > # Make model: > mod1 <- lvm(StarWars, lambda = Lambda, vars = obsvars, + identification = "variance", latents = latents) > > # Run model: > mod1 <- mod1 %>% runmodel > > # Look at fit: > mod1 _ _ _ | | | | (_) _ __ ___ _ _ ___| |__ ___ _ __ ___| |_ _ __ _ ___ ___ | _ \/ __| | | |/ __| _ \ / _ \| _ \ / _ \ __| __| |/ __/ __| | |_) \__ \ |_| | (__| | | | (_) | | | | __/ |_| | | | (__\__ \ | .__/|___/\__, |\___|_| |_|\___/|_| |_|\___|\__|_| |_|\___|___/ | | __/ | |_| |___/ Version: 0.13.2 General: - psychonetrics version: 0.13.2 - Model last edited at: 2026-02-11 22:41:45.03815 Sample: - Number of cases: 271 - Number of groups: 1 - Number of observed summary statistics: 65 Model: - Model used: Latent variable model (LVM) - Submodel used: Structural equation model (SEM) - Number of parameters: 35 Estimation: - Optimizer used: nlminb - Estimator used: Maximum likelihood estimation (ML) - Message: relative convergence (4) Fit: - Model Fit Test Statistic: 34.58 - Degrees of freedom: 30 - p-value (Chi-square): 0.26 Tips: - Use 'psychonetrics::compare' to compare psychonetrics models - Use 'psychonetrics::fit' to inspect model fit - Use 'psychonetrics::parameters' to inspect model parameters - Use 'psychonetrics::MIs' to inspect modification indices > > # Look at parameter estimates: > mod1 %>% parameters Parameters for group fullsample - nu var1 op var2 est se p row col par Q1 ~1 2.76 0.088 < 0.0001 1 1 1 Q2 ~1 4.19 0.069 < 0.0001 2 1 2 Q3 ~1 2.82 0.068 < 0.0001 3 1 3 Q4 ~1 3.21 0.074 < 0.0001 4 1 4 Q5 ~1 2.44 0.073 < 0.0001 5 1 5 Q6 ~1 2.69 0.073 < 0.0001 6 1 6 Q7 ~1 3.00 0.074 < 0.0001 7 1 7 Q8 ~1 2.38 0.084 < 0.0001 8 1 8 Q9 ~1 3.25 0.063 < 0.0001 9 1 9 Q10 ~1 2.12 0.062 < 0.0001 10 1 10 - lambda var1 op var2 est se p row col par Q1 ~= Prequels 0.21 0.15 0.18 1 1 11 Q2 ~= Prequels 0.30 0.10 0.0031 2 1 12 Q3 ~= Prequels 0.63 0.12 < 0.0001 3 1 13 Q4 ~= Prequels -0.49 0.11 < 0.0001 4 1 14 Q1 ~= Original 1.02 0.20 < 0.0001 1 2 15 Q5 ~= Original 0.57 0.077 < 0.0001 5 2 16 Q6 ~= Original 0.94 0.074 < 0.0001 6 2 17 Q7 ~= Original 0.67 0.077 < 0.0001 7 2 18 Q1 ~= Sequels -0.0049 0.25 0.98 1 3 19 Q8 ~= Sequels 0.85 0.10 < 0.0001 8 3 20 Q9 ~= Sequels 0.15 0.076 0.055 9 3 21 Q10 ~= Sequels 0.63 0.074 < 0.0001 10 3 22 - sigma_zeta (symmetric) var1 op var2 est se p row col par Prequels ~~ Prequels 1 1 1 0 Original ~~ Prequels 0.29 0.11 0.0080 2 1 23 Sequels ~~ Prequels 0.50 0.12 < 0.0001 3 1 24 Original ~~ Original 1 2 2 0 Sequels ~~ Original 0.72 0.078 < 0.0001 3 2 25 Sequels ~~ Sequels 1 3 3 0 - sigma_epsilon (symmetric) var1 op var2 est se p row col par Q1 ~~ Q1 0.90 0.13 < 0.0001 1 1 26 Q2 ~~ Q2 1.19 0.11 < 0.0001 2 2 27 Q3 ~~ Q3 0.86 0.15 < 0.0001 3 3 28 Q4 ~~ Q4 1.25 0.14 < 0.0001 4 4 29 Q5 ~~ Q5 1.10 0.10 < 0.0001 5 5 30 Q6 ~~ Q6 0.57 0.093 < 0.0001 6 6 31 Q7 ~~ Q7 1.05 0.10 < 0.0001 7 7 32 Q8 ~~ Q8 1.20 0.15 < 0.0001 8 8 33 Q9 ~~ Q9 1.05 0.091 < 0.0001 9 9 34 Q10 ~~ Q10 0.65 0.083 < 0.0001 10 10 35 > > # Look at modification indices: > mod1 %>% MIs Top 10 modification indices: var1 op var2 est mi pmi epc matrix row col group Q10 ~~ Q4 0 9.28 0.0023 -0.21 sigma_epsilon 10 4 fullsample Q5 ~~ Q3 0 5.12 0.024 0.16 sigma_epsilon 5 3 fullsample Q9 ~= Original 0 3.81 0.051 -0.28 lambda 9 2 fullsample Q5 ~= Prequels 0 3.30 0.069 0.21 lambda 5 1 fullsample Q8 ~~ Q2 0 3.25 0.071 -0.15 sigma_epsilon 8 2 fullsample Q5 ~= Sequels 0 3.01 0.083 0.30 lambda 5 3 fullsample Q10 ~~ Q8 0 2.67 0.10 -0.53 sigma_epsilon 10 8 fullsample Q9 ~~ Q1 0 2.56 0.11 -0.11 sigma_epsilon 9 1 fullsample Q10 ~~ Q3 0 2.53 0.11 -0.11 sigma_epsilon 10 3 fullsample Q7 ~~ Q2 0 2.51 0.11 -0.12 sigma_epsilon 7 2 fullsample group_id 1 1 1 1 1 1 1 1 1 1 > > # Add and refit: > mod2 <- mod1 %>% freepar("sigma_epsilon","Q10","Q4") %>% runmodel > > # Compare: > compare(original = mod1, adjusted = mod2) model DF AIC BIC RMSEA Chisq Chisq_diff DF_diff p_value adjusted 29 8315.19 8444.87 ~ 0 25.07 original 30 8322.70 8448.78 0.024 34.58 9.51 1 0.0020 Note: Chi-square difference test assumes models are nested.> > # Fit measures: > mod2 %>% fit Measure Value logl -4121.60 unrestricted.logl -4109.06 baseline.logl -4322.24 nvar 10 nobs 65 npar 36 df 29 objective 12.04 chisq 25.07 pvalue 0.67 baseline.chisq 426.35 baseline.npar 20 baseline.df 45 baseline.pvalue ~ 0 nfi 0.94 pnfi 0.61 tli 1.02 nnfi 1.02 rfi 0.91 ifi 1.01 rni 1.01 cfi 1 rmsea ~ 0 rmsea.ci.lower ~ 0 rmsea.ci.upper 0.038 rmsea.pvalue 0.99 aic.ll 8315.19 aic.ll2 8326.58 aic.x -32.93 aic.x2 97.07 bic 8444.87 bic2 8330.73 ebic.25 8527.76 ebic.5 8610.66 ebic.75 8676.97 ebic1 8776.44 > > ### Path diagrams ### > # semPlot is not (yet) supported by default, but can be used as follows: > # Load packages: > library("semPlot") > > # Estimates: > lambdaEst <- getmatrix(mod2, "lambda") > psiEst <- getmatrix(mod2, "sigma_zeta") > thetaEst <- getmatrix(mod2, "sigma_epsilon") > > # LISREL Model: LY = Lambda (lambda-y), TE = Theta (theta-epsilon), PS = Psi > mod <- lisrelModel(LY = lambdaEst, PS = psiEst, TE = thetaEst) > > # Plot with semPlot: > semPaths(mod, "std", "est", as.expression = "nodes") > > > # We can make this nicer (set whatLabels = "none" to hide labels): > semPaths(mod, + + # this argument controls what the color of edges represent. In this case, + # standardized parameters: + what = "std", + + # This argument controls what the edge labels represent. In this case, parameter + # estimates: + whatLabels = "est", + + # This argument draws the node and edge labels as mathematical exprssions: + as.expression = "nodes", + + # This will plot residuals as arrows, closer to what we use in class: + style = "lisrel", + + # This makes the residuals larger: + residScale = 10, + + # qgraph colorblind friendly theme: + theme = "colorblind", + + # tree layout options are "tree", "tree2", and "tree3": + layout = "tree2", + + # This makes the latent covariances connect at a cardinal center point: + cardinal = "lat cov", + + # Changes curve into rounded straight lines: + curvePivot = TRUE, + + # Size of manifest variables: + sizeMan = 4, + + # Size of latent varibales: + sizeLat = 10, + + # Size of edge labels: + edge.label.cex = 1, + + # Sets the margins: + mar = c(9,1,8,1), + + # Prevents re-ordering of ovbserved variables: + reorder = FALSE, + + # Width of the plot: + width = 8, + + # Height of plot: + height = 5, + + # Colors according to latents: + groups = "latents", + + # Pastel colors: + pastel = TRUE, + + # Disable borders: + borders = FALSE + ) > > # Use arguments filetype = "pdf" and filename = "semPlotExample1" to store PDF > > ### Latent Network Modeling ### > > # Latent network model: > lnm <- lvm(StarWars, lambda = Lambda, vars = obsvars, + latents = latents, identification = "variance", + latent = "ggm") > > # Run model: > lnm <- lnm %>% runmodel > > # Look at parameters: > lnm %>% parameters Parameters for group fullsample - nu var1 op var2 est se p row col par Q1 ~1 2.76 0.088 < 0.0001 1 1 1 Q2 ~1 4.19 0.069 < 0.0001 2 1 2 Q3 ~1 2.82 0.068 < 0.0001 3 1 3 Q4 ~1 3.21 0.074 < 0.0001 4 1 4 Q5 ~1 2.44 0.073 < 0.0001 5 1 5 Q6 ~1 2.69 0.073 < 0.0001 6 1 6 Q7 ~1 3.00 0.074 < 0.0001 7 1 7 Q8 ~1 2.38 0.084 < 0.0001 8 1 8 Q9 ~1 3.25 0.063 < 0.0001 9 1 9 Q10 ~1 2.12 0.062 < 0.0001 10 1 10 - lambda var1 op var2 est se p row col par Q1 ~= Prequels 0.18 0.13 0.17 1 1 11 Q2 ~= Prequels 0.25 0.089 0.0043 2 1 12 Q3 ~= Prequels 0.54 0.13 < 0.0001 3 1 13 Q4 ~= Prequels -0.42 0.11 < 0.0001 4 1 14 Q1 ~= Original 0.70 0.13 < 0.0001 1 2 15 Q5 ~= Original 0.39 0.071 < 0.0001 5 2 16 Q6 ~= Original 0.65 0.099 < 0.0001 6 2 17 Q7 ~= Original 0.46 0.077 < 0.0001 7 2 18 Q1 ~= Sequels -0.0034 0.16 0.98 1 3 19 Q8 ~= Sequels 0.53 0.11 < 0.0001 8 3 20 Q9 ~= Sequels 0.091 0.049 0.067 9 3 21 Q10 ~= Sequels 0.39 0.082 < 0.0001 10 3 22 - omega_zeta (symmetric) var1 op var2 est se p row col par Original -- Prequels -0.11 0.19 0.56 2 1 23 Sequels -- Prequels 0.43 0.17 0.011 3 1 24 Sequels -- Original 0.70 0.097 < 0.0001 3 2 25 - delta_zeta (diagonal) var1 op var2 est se p row col par Prequels ~/~ Prequels 1 1 1 0 Original ~/~ Original 1 2 2 0 Sequels ~/~ Sequels 1 3 3 0 - sigma_epsilon (symmetric) var1 op var2 est se p row col par Q1 ~~ Q1 0.89 0.13 < 0.0001 1 1 26 Q2 ~~ Q2 1.19 0.11 < 0.0001 2 2 27 Q3 ~~ Q3 0.86 0.15 < 0.0001 3 3 28 Q4 ~~ Q4 1.25 0.14 < 0.0001 4 4 29 Q5 ~~ Q5 1.10 0.10 < 0.0001 5 5 30 Q6 ~~ Q6 0.57 0.093 < 0.0001 6 6 31 Q7 ~~ Q7 1.05 0.10 < 0.0001 7 7 32 Q8 ~~ Q8 1.20 0.15 < 0.0001 8 8 33 Q9 ~~ Q9 1.05 0.091 < 0.0001 9 9 34 Q10 ~~ Q10 0.65 0.083 < 0.0001 10 10 35 > > # Remove non-sig latent edge: > lnm <- lnm %>% prune(alpha = 0.05) > > # Compare to the original CFA model: > compare(cfa = mod1, lnm = lnm) model DF AIC BIC RMSEA Chisq Chisq_diff DF_diff p_value cfa 30 8322.70 8448.78 0.024 34.58 lnm 31 8321.02 8443.49 0.022 34.89 0.31 1 0.58 Note: Chi-square difference test assumes models are nested.> > # Plot network: > library("qgraph") > qgraph(lnm@modelmatrices[[1]]$omega_zeta, labels = latents, + theme = "colorblind", vsize = 10) > > # A wrapper for the latent network model is the lnm function: > lnm2 <- lnm(StarWars, lambda = Lambda, vars = obsvars, + latents = latents, identification = "variance") > lnm2 <- lnm2 %>% runmodel %>% prune(alpha = 0.05) > compare(lnm, lnm2) # Is the same as the model before. model DF AIC BIC RMSEA Chisq Chisq_diff DF_diff p_value Model 1 31 8321.02 8443.49 0.022 34.89 Model 2 31 8321.02 8443.49 0.022 34.89 ~ 0 0 1 Note: Chi-square difference test assumes models are nested.> > # I could also estimate a "residual network model", which adds partial correlations to > # the residual level: > # This can be done using lvm(..., residal = "ggm") or with rnm(...) > rnm <- rnm(StarWars, lambda = Lambda, vars = obsvars, + latents = latents, identification = "variance") > # Stepup search: > rnm <- rnm %>% stepup > > # It will estimate the same model (with link Q10 - Q4) as above. In the case of only one > # partial correlation, There is no difference between residual covariances (SEM) or > # residual partial correlations (RNM). > > > # For more information on latent and residual network models, see: > # Epskamp, S., Rhemtulla, M.T., & Borsboom, D. Generalized Network Psychometrics: > # Combining Network and Latent Variable Models > # (2017). Psychometrika. doi:10.1007/s11336-017-9557-x > > ### Gaussian graphical models ### > > # All psychonetrics functions (e.g., lvm, lnm, rnm...) allow input via a covariance > # matrix, with the "covs" and "nobs" arguments. > # The following fits a baseline GGM network with no edges: > S <- (nrow(StarWars) - 1)/ (nrow(StarWars)) * cov(StarWars[,1:10]) > ggmmod <- ggm(covs = S, nobs = nrow(StarWars)) Assuming denominator n was used in covariance computation (covtype = 'ML'). > > # Run model with stepup search and pruning: > ggmmod <- ggmmod%>% prune %>% modelsearch > > # Fit measures: > ggmmod %>% fit Measure Value logl -4131.43 unrestricted.logl -4109.06 baseline.logl -4322.24 nvar 10 nobs 55 npar 23 df 32 objective 12.11 chisq 44.74 pvalue 0.067 baseline.chisq 426.35 baseline.npar 10 baseline.df 45 baseline.pvalue ~ 0 nfi 0.90 pnfi 0.64 tli 0.95 nnfi 0.95 rfi 0.85 ifi 0.97 rni 0.97 cfi 0.97 rmsea 0.038 rmsea.ci.lower ~ 0 rmsea.ci.upper 0.063 rmsea.pvalue 0.76 aic.ll 8308.87 aic.ll2 8313.34 aic.x -19.26 aic.x2 90.74 bic 8391.72 bic2 8318.79 ebic.25 8444.68 ebic.5 8497.63 ebic.75 8540.00 ebic1 8603.55 > > # Plot network: > nodeNames <- c( + "I am a huge Star Wars\nfan! (star what?)", + "I would trust this person\nwith my democracy.", + "I enjoyed the story of\nAnakin's early life.", + "The special effects in\nthis scene are awful (Battle of\nGeonosis).", + "I would trust this person\nwith my life.", + "I found Darth Vader's big\nreveal in 'Empire' one of the greatest + moments in movie history.", + "The special effects in\nthis scene are amazing (Death Star\nExplosion).", + "If possible, I would\ndefinitely buy this\ndroid.", + "The story in the Star\nWars sequels is an improvement to\nthe previous movies.", + "The special effects in\nthis scene are marvellous (Starkiller\nBase Firing)." + ) > library("qgraph") > qgraph(as.matrix(ggmmod@modelmatrices[[1]]$omega), nodeNames = nodeNames, + legend.cex = 0.25, theme = "colorblind", layout = "spring") > > # We can actually compare this model statistically (note they are not nested) to the > # latent variable model: > compare(original_cfa = mod1, adjusted_cfa = mod2, exploratory_ggm = ggmmod) model DF AIC BIC RMSEA Chisq Chisq_diff DF_diff p_value adjusted_cfa 29 8315.19 8444.87 ~ 0 25.07 original_cfa 30 8322.70 8448.78 0.024 34.58 9.51 1 0.0020 exploratory_ggm 32 8308.87 8391.72 0.038 44.74 10.16 2 0.0062 Note: Chi-square difference test assumes models are nested.> > > ### Meausrement invariance ### > # Let's say we are interested in seeing if people >= 30 like the original trilogy better > # than people < 30. > # First we can make a grouping variable: > StarWars$agegroup <- ifelse(StarWars$Q12 < 30, "young", "less young") > > # Let's look at the distribution: > table(StarWars$agegroup) # Pretty even... less young young 118 153 > > # Observed variables: > obsvars <- paste0("Q",1:10) > > # Let's look at the mean scores: > StarWars %>% group_by(agegroup) %>% summarize_each_(funs(mean),vars = obsvars) Error: ! `summarise_each_()` was deprecated in dplyr 0.7.0 and is now defunct. ℹ Please use `across()` instead. Backtrace: ▆ 1. ├─StarWars %>% group_by(agegroup) %>% ... 2. └─dplyr::summarize_each_(., funs(mean), vars = obsvars) 3. └─dplyr:::each_defunct("summarise_each_()") 4. └─lifecycle::deprecate_stop(when = "0.7.0", what = fun, with = "across()") 5. └─lifecycle:::deprecate_stop0(msg) 6. └─rlang::cnd_signal(...) Execution halted * checking PDF version of manual ... OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * checking for new files in some other directories ... OK * DONE Status: 1 ERROR See ‘/data/blackswan/ripley/R/packages/tests-devel/psychonetrics.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 13:22.04, 915.78 + 94.88