This works fine but now I fail to extract the fit measures via fitMeasures() or lavTestLRT.mi()
I don't understand how to pass arguments from one to the other as is told.
fitMeasures(fit, A.method = "exact", scaled.shifted = FALSE) # NOT recommended
fitMeasures(out1)
lavTestLRT.mi(out1)
lavTestLRT(out1)
> lavTestLRT.mi(out1)
"D3" only available using maximum likelihood estimation. Changed test to "D2".
Robust correction can only be applied to pooled chi-squared statistic, not F statistic. "asymptotic" was switched to TRUE.
Robust corrections are made by pooling the naive chi-squared statistic across 5 imputations for which the model converged, then applying the average (across imputations) scaling factor and shift parameter to that pooled value.
To instead pool the robust test statistics, set test = "D2" and pool.robust = TRUE.
chisq df pvalue npar ntotal
478.301 206.000 0.000 138.000 304.000
chisq.scaled df.scaled pvalue.scaled chisq.scaling.factor chisq.shift.parameters
607.926 206.000 0.000 0.933 95.048
> fitMeasures(out1)
"D3" only available using maximum likelihood estimation. Changed test to "D2".
Robust corrections are made by pooling the naive chi-squared statistic across 5 imputations for which the model converged, then applying the average (across imputations) scaling factor and shift parameter to that pooled value.
To instead pool the robust test statistics, set test = "D2" and pool.robust = TRUE.
"D3" only available using maximum likelihood estimation. Changed test to "D2".
Robust corrections are made by pooling the naive chi-squared statistic across 5 imputations for which the model converged, then applying the average (across imputations) scaling factor and shift parameter to that pooled value.
To instead pool the robust test statistics, set test = "D2" and pool.robust = TRUE.
Error in gp.resid.lavaan.mi(Observed = object@SampleStatsList[useImps], :
object 'N' not found
In addition: Warning message:
In pchisq(X2.sc, DF.sc, ncp = N * DF.sc * 0.05^2/nG, lower.tail = FALSE) :
full precision may not have been achieved in 'pnchisq'
> lavTestLRT(out1)
Error in lavTestLRT(out1) :
no slot of name "optim" for this object of class "lavaan.mi"
> fitMeasures(out1, fit.measures = ("all"),asymptotic=TRUE, test = "D2", pool.robust=TRUE)
Error in .local(object, fit.measures, baseline.model, ...) :
unused arguments (asymptotic = TRUE, test = "D2", pool.robust = TRUE)
Error in gp.resid.lavaan.mi(Observed = object@SampleStatsList[useImps], :
object 'N' not found
> fitMeasures(out1, fit.measures = ("all"),asymptotic=TRUE, test = "D2", pool.robust=TRUE)
Error in .local(object, fit.measures, baseline.model, ...) :
unusedarguments (asymptotic = TRUE, test = "D2", pool.robust = TRUE)
I use the latest versions of both lavaan() and semTools()
install.packages("lavaan", repos = "http://www.da.ugent.be", type = "source")
devtools::install_github("simsem/semTools/semTools")
> lavTestLRT(out1)
Error in lavTestLRT(out1) :
no slot of name "optim" for this object of class "lavaan.mi"
> out1 <- runMI(CFATcool,
+ data=FBK_Subset,
+ m = 5,
+ miPackage="mice",
+ fun="cfa",
+ estimator = "WLSMV",
+ seed = 12345)
>
> summary(out1)
lavaan.mi object based on 5 imputed data sets.
See class?lavaan.mi help page for available methods.
Convergence information:
The model converged on 5 imputed data sets
Rubin's (1987) rules were used to pool point and SE estimates across 5 imputed data sets, and to calculate degrees of freedom for each parameter's t test and CI.
Parameter Estimates:
Information Expected
Information saturated (h1) model Unstructured
Standard Errors Robust.sem
Latent Variables:
Estimate Std.Err t-value df P(>|t|)
AllgemeinepsychischeStressoren =~
FBKP_1 1.000
FBKP_3 1.005 0.021 48.988 3730.703 0.000
FBKP_4 0.781 0.035 22.531 1906.053 0.000
FBKP_5 0.893 0.025 35.321 4253.089 0.000
FBKP_6 0.801 0.038 21.329 3989.771 0.000
FBKP_7 0.899 0.024 37.851 1636.363 0.000
FBKP_9 0.883 0.027 32.345 7896.067 0.000
FBKP_10 0.775 0.034 22.678 Inf 0.000
FBKP_12 0.963 0.021 45.726 Inf 0.000
Progredienzangst =~
FBKP_8 1.000
FBKP_15 1.001 0.031 32.579 Inf 0.000
FBKP_16 0.739 0.047 15.779 Inf 0.000
FBKP_17 1.021 0.030 33.680 3871.302 0.000
FBKP_18 0.759 0.049 15.616 1264.125 0.000
FBKP_20 0.941 0.034 27.862 502.513 0.000
FBKP_21 0.997 0.030 33.217 Inf 0.000
FBKP_22 0.715 0.050 14.235 3757.965 0.000
FBKP_23 1.053 0.028 37.551 744.200 0.000
PartnerschaftlicheStressoren =~
FBKP_2 1.000
FBKP_11 0.872 0.062 13.957 3839.797 0.000
FBKP_13 1.091 0.052 21.169 Inf 0.000
FBKP_14 1.076 0.054 20.075 686.255 0.000
Covariances:
Estimate Std.Err t-value df P(>|t|)
AllgemeinepsychischeStressoren ~~
Progredinzngst 0.543 0.033 16.285 7204.925 0.000
PrtnrschftlchS 0.410 0.041 10.089 Inf 0.000
Progredienzangst ~~
PrtnrschftlchS 0.305 0.040 7.700 6905.005 0.000
Intercepts:
Estimate Std.Err t-value df P(>|t|)
.FBKP_1 0.000
.FBKP_3 0.000
.FBKP_4 0.000
.FBKP_5 0.000
.FBKP_6 0.000
.FBKP_7 0.000
.FBKP_9 0.000
.FBKP_10 0.000
.FBKP_12 0.000
.FBKP_8 0.000
.FBKP_15 0.000
.FBKP_16 0.000
.FBKP_17 0.000
.FBKP_18 0.000
.FBKP_20 0.000
.FBKP_21 0.000
.FBKP_22 0.000
.FBKP_23 0.000
.FBKP_2 0.000
.FBKP_11 0.000
.FBKP_13 0.000
.FBKP_14 0.000
AllgmnpsychscS 0.000
Progredinzngst 0.000
PrtnrschftlchS 0.000
Thresholds:
Estimate Std.Err t-value df P(>|t|)
FBKP_1|t1 -0.596 0.079 -7.581 Inf 0.000
FBKP_1|t2 -0.071 0.074 -0.963 Inf 0.336
FBKP_1|t3 0.361 0.075 4.782 Inf 0.000
FBKP_1|t4 1.045 0.090 11.573 4370.060 0.000
FBKP_1|t5 1.727 0.131 13.138 1006.527 0.000
FBKP_3|t1 -0.553 0.078 -7.100 Inf 0.000
FBKP_3|t2 -0.181 0.074 -2.440 Inf 0.015
FBKP_3|t3 0.269 0.075 3.601 Inf 0.000
FBKP_3|t4 0.966 0.088 11.025 Inf 0.000
FBKP_3|t5 1.789 0.138 13.010 741.812 0.000
FBKP_4|t1 -0.049 0.074 -0.672 Inf 0.502
FBKP_4|t2 0.412 0.076 5.425 8073.090 0.000
FBKP_4|t3 0.738 0.081 9.065 Inf 0.000
FBKP_4|t4 1.256 0.099 12.663 Inf 0.000
FBKP_4|t5 1.877 0.147 12.775 6502.062 0.000
FBKP_5|t1 -0.262 0.075 -3.512 Inf 0.000
FBKP_5|t2 0.269 0.075 3.601 Inf 0.000
FBKP_5|t3 0.668 0.080 8.360 5708.816 0.000
FBKP_5|t4 1.068 0.091 11.719 2504.940 0.000
FBKP_5|t5 1.907 0.150 12.673 2274.567 0.000
FBKP_6|t1 0.013 0.074 0.179 3276.308 0.858
FBKP_6|t2 0.496 0.077 6.442 2631.275 0.000
FBKP_6|t3 0.856 0.084 10.148 1382.981 0.000
FBKP_6|t4 1.278 0.100 12.746 Inf 0.000
FBKP_6|t5 1.859 0.145 12.831 2802.615 0.000
FBKP_7|t1 -0.553 0.078 -7.100 Inf 0.000
FBKP_7|t2 0.136 0.074 1.836 Inf 0.066
FBKP_7|t3 0.524 0.077 6.772 Inf 0.000
FBKP_7|t4 1.065 0.091 11.701 6540.398 0.000
FBKP_7|t5 1.727 0.131 13.143 Inf 0.000
FBKP_9|t1 -0.493 0.077 -6.398 Inf 0.000
FBKP_9|t2 0.117 0.074 1.590 Inf 0.112
FBKP_9|t3 0.509 0.077 6.596 4332.059 0.000
FBKP_9|t4 1.062 0.091 11.682 942.202 0.000
FBKP_9|t5 1.831 0.142 12.912 7817.911 0.000
FBKP_10|t1 -0.636 0.079 -8.015 Inf 0.000
FBKP_10|t2 -0.139 0.074 -1.881 Inf 0.060
FBKP_10|t3 0.255 0.075 3.423 Inf 0.001
FBKP_10|t4 0.708 0.081 8.767 Inf 0.000
FBKP_10|t5 1.377 0.106 13.042 2700.219 0.000
FBKP_12|t1 -0.592 0.079 -7.537 Inf 0.000
FBKP_12|t2 -0.021 0.074 -0.291 Inf 0.771
FBKP_12|t3 0.389 0.076 5.137 Inf 0.000
FBKP_12|t4 1.071 0.091 11.737 8129.746 0.000
FBKP_12|t5 2.089 0.175 11.906 1007.018 0.000
FBKP_8|t1 -0.897 0.085 -10.492 Inf 0.000
FBKP_8|t2 -0.387 0.076 -5.115 Inf 0.000
FBKP_8|t3 0.104 0.074 1.411 3228.895 0.158
FBKP_8|t4 0.580 0.078 7.407 2182.588 0.000
FBKP_8|t5 1.340 0.104 12.946 Inf 0.000
FBKP_15|t1 -0.837 0.084 -9.984 Inf 0.000
FBKP_15|t2 -0.414 0.076 -5.448 4782.280 0.000
FBKP_15|t3 -0.194 0.074 -2.619 Inf 0.009
FBKP_15|t4 0.252 0.074 3.378 Inf 0.001
FBKP_15|t5 0.632 0.079 7.972 7175.969 0.000
FBKP_16|t1 -1.285 0.101 -12.772 4429.571 0.000
FBKP_16|t2 -0.823 0.083 -9.861 Inf 0.000
FBKP_16|t3 -0.394 0.076 -5.204 Inf 0.000
FBKP_16|t4 0.018 0.074 0.246 Inf 0.805
FBKP_16|t5 0.642 0.079 8.080 Inf 0.000
FBKP_17|t1 -1.186 0.096 -12.364 6055.854 0.000
FBKP_17|t2 -0.742 0.082 -9.107 Inf 0.000
FBKP_17|t3 -0.392 0.076 -5.182 Inf 0.000
FBKP_17|t4 0.035 0.074 0.470 Inf 0.638
FBKP_17|t5 0.644 0.079 8.101 Inf 0.000
FBKP_18|t1 -0.984 0.088 -11.160 1629.171 0.000
FBKP_18|t2 -0.496 0.077 -6.442 4365.146 0.000
FBKP_18|t3 -0.111 0.074 -1.500 9795.253 0.134
FBKP_18|t4 0.384 0.076 5.070 Inf 0.000
FBKP_18|t5 0.976 0.088 11.103 5163.115 0.000
FBKP_20|t1 -1.282 0.100 -12.759 Inf 0.000
FBKP_20|t2 -0.784 0.082 -9.507 2758.456 0.000
FBKP_20|t3 -0.359 0.075 -4.760 8492.501 0.000
FBKP_20|t4 0.023 0.074 0.314 Inf 0.754
FBKP_20|t5 0.640 0.079 8.058 Inf 0.000
FBKP_21|t1 -1.503 0.113 -13.244 Inf 0.000
FBKP_21|t2 -0.909 0.086 -10.593 Inf 0.000
FBKP_21|t3 -0.427 0.076 -5.603 4752.969 0.000
FBKP_21|t4 0.058 0.074 0.784 7482.226 0.433
FBKP_21|t5 0.620 0.079 7.842 Inf 0.000
FBKP_22|t1 -0.914 0.086 -10.632 Inf 0.000
FBKP_22|t2 -0.400 0.076 -5.270 Inf 0.000
FBKP_22|t3 -0.117 0.074 -1.590 5786.860 0.112
FBKP_22|t4 0.389 0.076 5.137 3584.561 0.000
FBKP_22|t5 0.873 0.085 10.291 2351.218 0.000
FBKP_23|t1 -1.180 0.096 -12.332 Inf 0.000
FBKP_23|t2 -0.666 0.080 -8.338 Inf 0.000
FBKP_23|t3 -0.184 0.074 -2.484 Inf 0.013
FBKP_23|t4 0.320 0.075 4.270 Inf 0.000
FBKP_23|t5 0.873 0.085 10.291 Inf 0.000
FBKP_2|t1 -0.166 0.074 -2.238 Inf 0.025
FBKP_2|t2 0.405 0.076 5.337 4765.323 0.000
FBKP_2|t3 0.832 0.084 9.943 Inf 0.000
FBKP_2|t4 1.513 0.114 13.252 Inf 0.000
FBKP_2|t5 2.133 0.182 11.700 Inf 0.000
FBKP_11|t1 -0.538 0.078 -6.925 Inf 0.000
FBKP_11|t2 0.051 0.074 0.694 Inf 0.488
FBKP_11|t3 0.305 0.075 4.069 Inf 0.000
FBKP_11|t4 0.771 0.082 9.381 Inf 0.000
FBKP_11|t5 1.408 0.107 13.109 Inf 0.000
FBKP_13|t1 0.021 0.074 0.291 Inf 0.771
FBKP_13|t2 0.494 0.077 6.420 Inf 0.000
FBKP_13|t3 0.849 0.084 10.087 Inf 0.000
FBKP_13|t4 1.170 0.095 12.284 6341.644 0.000
FBKP_13|t5 1.898 0.149 12.697 522.160 0.000
FBKP_14|t1 -0.033 0.074 -0.448 Inf 0.654
FBKP_14|t2 0.513 0.077 6.640 Inf 0.000
FBKP_14|t3 0.773 0.082 9.402 5606.978 0.000
FBKP_14|t4 1.297 0.101 12.811 3454.131 0.000
FBKP_14|t5 2.059 0.171 12.063 Inf 0.000
Variances:
Estimate Std.Err t-value df P(>|t|)
.FBKP_1 0.178
.FBKP_3 0.171
.FBKP_4 0.499
.FBKP_5 0.344
.FBKP_6 0.472
.FBKP_7 0.336
.FBKP_9 0.360
.FBKP_10 0.507
.FBKP_12 0.237
.FBKP_8 0.299
.FBKP_15 0.297
.FBKP_16 0.617
.FBKP_17 0.269
.FBKP_18 0.596
.FBKP_20 0.379
.FBKP_21 0.304
.FBKP_22 0.642
.FBKP_23 0.222
.FBKP_2 0.346
.FBKP_11 0.503
.FBKP_13 0.221
.FBKP_14 0.242
AllgmnpsychscS 0.822 0.023 35.324 2404.089 0.000
Progredinzngst 0.701 0.036 19.471 4554.905 0.000
PrtnrschftlchS 0.654 0.049 13.408 4521.102 0.000
Scales y*:
Estimate Std.Err t-value df P(>|t|)
FBKP_1 1.000
FBKP_3 1.000
FBKP_4 1.000
FBKP_5 1.000
FBKP_6 1.000
FBKP_7 1.000
FBKP_9 1.000
FBKP_10 1.000
FBKP_12 1.000
FBKP_8 1.000
FBKP_15 1.000
FBKP_16 1.000
FBKP_17 1.000
FBKP_18 1.000
FBKP_20 1.000
FBKP_21 1.000
FBKP_22 1.000
FBKP_23 1.000
FBKP_2 1.000
FBKP_11 1.000
FBKP_13 1.000
FBKP_14 1.000
> fitMeasures(out1)
"D3" only available using maximum likelihood estimation. Changed test to "D2".
Robust corrections are made by pooling the naive chi-squared statistic across 5 imputations for which the model converged, then applying the average (across imputations) scaling factor and shift parameter to that pooled value.
To instead pool the robust test statistics, set test = "D2" and pool.robust = TRUE.
"D3" only available using maximum likelihood estimation. Changed test to "D2".
Robust corrections are made by pooling the naive chi-squared statistic across 5 imputations for which the model converged, then applying the average (across imputations) scaling factor and shift parameter to that pooled value.
To instead pool the robust test statistics, set test = "D2" and pool.robust = TRUE.
Error in gp.resid.lavaan.mi(Observed = object@SampleStatsList[useImps], :
object 'N' not found
In addition: Warning message:
In pchisq(X2.sc, DF.sc, ncp = N * DF.sc * 0.05^2/nG, lower.tail = FALSE) :
full precision may not have been achieved in 'pnchisq'
>
> lavTestLRT.mi(out1)
"D3" only available using maximum likelihood estimation. Changed test to "D2".
Robust correction can only be applied to pooled chi-squared statistic, not F statistic. "asymptotic" was switched to TRUE.
Robust corrections are made by pooling the naive chi-squared statistic across 5 imputations for which the model converged, then applying the average (across imputations) scaling factor and shift parameter to that pooled value.
To instead pool the robust test statistics, set test = "D2" and pool.robust = TRUE.
chisq df pvalue npar ntotal chisq.scaled df.scaled
478.200 206.000 0.000 135.000 304.000 612.335 206.000
pvalue.scaled chisq.scaling.factor chisq.shift.parameters
0.000 0.923 94.182
> fitMeasures(out1,test = "D2" , pool.robust = TRUE)
Error in .local(object, fit.measures, baseline.model, ...) :
unused arguments (test = "D2", pool.robust = TRUE)
I followed your instructions and installed the latest versions of semTools and lavaan but my problem was not resolved.
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] semTools_0.5-1 lavaan_0.6-4.1374
loaded via a namespace (and not attached):
[1] compiler_3.5.3 tools_3.5.3 mnormt_1.5-5 pbivnorm_0.6.0 stats4_3.5.3
other attached packages:
[1] semTools_0.5-1 lavaan_0.6-4.1374
install.packages("devtools")
devtools::install_github("simsem/semTools/semTools")
> devtools::install_github("simsem/semTools/semTools") Error in curl::curl_fetch_memory(url, handle = h) : Failed to connect to api.github.com port 443: Timed out
Kind regards
Jan
I follow your instructions but when I try to update semTools from your link, the following error is desplayed:
> devtools::install_github("simsem/semTools/semTools") Error in curl::curl_fetch_memory(url, handle = h) : Failed to connect to api.github.com port 443: Timed out
It would be great, to get such a sourcefile
install.packages("semTools_0.5-1.917.tar.gz", type = "source", repos = NULL)
> install.packages("semTools_0.5-1.917.tar.gz", type = "source", repos = NULL)
Installing package into ‘C:/Users/brederja/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
ERROR: cannot extract package from 'semTools_0.5-1.917.tar.gz'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘semTools_0.5-1.917.tar.gz’ had non-zero exit status