├── .Rbuildignore ├── .gitignore ├── .vscode ├── launch.json └── settings.json ├── DESCRIPTION ├── MplusAutomation.Rproj ├── NAMESPACE ├── NEWS ├── R ├── MplusAutomation.R ├── compareModels.R ├── createModels.R ├── data.R ├── extractAuxDis.R ├── extractEFAparameters.R ├── extractIndirect.R ├── extractModIndices.R ├── extractParameters.R ├── extractSaveData.R ├── graphModels.R ├── methods.R ├── mixtures.R ├── mplus.R ├── mplusModel.R ├── mplusglm.R ├── parseOutput.R ├── prepareMplusData.R ├── readModels.R ├── runModels.R ├── submitModels.R ├── summary.R ├── trainlgmm.R └── utilityFunctions.R ├── README.md ├── data └── lcademo.rda ├── docs ├── 404.html ├── articles │ ├── index.html │ ├── mplusAutomationFMMPlot.png │ ├── runModels_Interactive-Screenshot.png │ ├── vignette.html │ └── vignette_files │ │ ├── header-attrs-2.6 │ │ └── header-attrs.js │ │ └── header-attrs-2.9 │ │ └── header-attrs.js ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── index.html ├── link.svg ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml └── reference │ ├── HTMLSummaryTable.html │ ├── LatexSummaryTable.html │ ├── MplusAutomation.html │ ├── MplusAutomationUtils.html │ ├── OS.html │ ├── Rplot001.png │ ├── SummaryTable.html │ ├── addHeaderToSavedata.html │ ├── addNode.html │ ├── cd.html │ ├── classifyTags.html │ ├── clipString.html │ ├── coef.mplus.model.html │ ├── compareModels.html │ ├── confint.mplus.model.html │ ├── connectNodes.html │ ├── createMixtures.html │ ├── createModels.html │ ├── createSyntax.html │ ├── createVarSyntax.html │ ├── detectColumnNames.html │ ├── detectMplus.html │ ├── detectVariables.html │ ├── divideIntoFields.html │ ├── dot-convertData.html │ ├── dot-mplusMultinomial.html │ ├── evaluateConditional.html │ ├── extract.html │ ├── extractAux.html │ ├── extractClassCounts.html │ ├── extractDataSummary.html │ ├── extractEFAparameters.html │ ├── extractFacScoreStats.html │ ├── extractFreeFile.html │ ├── extractIndirect.html │ ├── extractIndirect_section.html │ ├── extractInput_1file.html │ ├── extractModIndices.html │ ├── extractModIndices_1chunk.html │ ├── extractModIndices_1file.html │ ├── extractModelParameters.html │ ├── extractModelSummaries.html │ ├── extractParameters_1chunk.html │ ├── extractParameters_1file.html │ ├── extractParameters_1section.html │ ├── extractResiduals.html │ ├── extractResiduals_1section.html │ ├── extractSampstat.html │ ├── extractSummaries_1file.html │ ├── extractSummaries_1plan.html │ ├── extractSummaries_1section.html │ ├── extractTech1.html │ ├── extractTech10.html │ ├── extractTech12.html │ ├── extractTech15.html │ ├── extractTech3.html │ ├── extractTech4.html │ ├── extractTech7.html │ ├── extractTech8.html │ ├── extractTech9.html │ ├── extractValue.html │ ├── extractWarningsErrors_1file.html │ ├── finalizeInitCollection.html │ ├── friendlyGregexpr.html │ ├── getInitTags.html │ ├── getMultilineSection.html │ ├── getOutFileList.html │ ├── getSavedata_Bparams.html │ ├── getSavedata_Data.html │ ├── getSavedata_Fileinfo.html │ ├── getSection.html │ ├── get_efa_nfactors.html │ ├── get_results.html │ ├── graphModel.html │ ├── htmlout.html │ ├── index.html │ ├── isEmpty.html │ ├── l_getSavedata_Bparams.html │ ├── l_getSavedata_Fileinfo.html │ ├── l_getSavedata_readRawFile.html │ ├── lcademo.html │ ├── long2LGMM.html │ ├── lookupSimpleTags.html │ ├── lookupTech1Parameter.html │ ├── lookupValue.html │ ├── matrixExtract.html │ ├── mixtureSummaryTable.html │ ├── mplus.traceplot.html │ ├── mplusAvailable.html │ ├── mplusGLM.html │ ├── mplusModeler.html │ ├── mplusObject.html │ ├── mplusRcov.html │ ├── mplus_as.numeric.html │ ├── paramExtract.html │ ├── parseCatOutput.html │ ├── parseMplus.html │ ├── parseTags.html │ ├── plot.mplusObject.html │ ├── plotGrowthMixtures.html │ ├── plotLTA.html │ ├── plotMixtureDensities.html │ ├── plotMixtures.html │ ├── prepareMplusData.html │ ├── prepareMplusData_Mat.html │ ├── print.MplusRstructure.html │ ├── processConditionalTags.html │ ├── processInit.html │ ├── readModels.html │ ├── recurseReplace.html │ ├── replaceBodyTags.html │ ├── replaceInitTags.html │ ├── rmVarWarnings.html │ ├── runModels.html │ ├── runModels_Interactive.html │ ├── separateHyphens.html │ ├── showSummaryTable.html │ ├── splitDFByRow.html │ ├── splitFilePath.html │ ├── subsetModelList.html │ ├── summary.mplusObject.html │ ├── testBParamCompoundConstraint.html │ ├── testBParamConstraint.html │ ├── trainLGMM.html │ ├── trimSpace.html │ ├── unlabeledMatrixExtract.html │ ├── update.mplusObject.html │ └── updateCurrentValues.html ├── examples ├── lca_cfa_example │ ├── analyze_lca.inp │ ├── analyze_lca.out │ ├── analyze_lca_3class.inp │ ├── analyze_lca_3class.out │ ├── lca_cfa_example.dat │ ├── sim_lca_cfa.inp │ ├── sim_lca_cfa.out │ ├── templateExample.txt │ └── templateExample │ │ ├── CFA │ │ ├── CFA.gh5 │ │ ├── CFA.inp │ │ └── CFA.out │ │ ├── LCA2 │ │ ├── LCA2.gh5 │ │ ├── LCA2.inp │ │ └── LCA2.out │ │ ├── LCA3 │ │ ├── LCA3.gh5 │ │ ├── LCA3.inp │ │ └── LCA3.out │ │ ├── LCA4 │ │ ├── LCA4.gh5 │ │ ├── LCA4.inp │ │ └── LCA4.out │ │ ├── LCA5 │ │ ├── LCA5.gh5 │ │ ├── LCA5.inp │ │ └── LCA5.out │ │ └── Mplus Run Models.log └── monte_carlo │ ├── GenData_MixSim.R │ ├── Mplus_Monte_Carlo.Rproj │ ├── PlotFMMResults.R │ ├── RunCFA_MCReps.R │ ├── RunFMM_MCReps.R │ ├── helper_functions.R │ └── mixsim_generation_functions.R ├── inst ├── CITATION └── extdata │ ├── ex3.1.out │ ├── ex3.11.out │ ├── ex3.16.out │ ├── ex3.18.out │ ├── ex3.4.out │ ├── ex3.5.out │ ├── ex3.6.out │ ├── ex3.7.out │ ├── ex5.1.out │ ├── ex5.12.out │ ├── ex5.2.out │ ├── ex5.33.out │ ├── ex5.5part4.out │ ├── ex6.1.out │ ├── ex6.23.out │ ├── ex6.4.out │ ├── ex8.13.csv │ ├── ex8.2.csv │ ├── ex9.2c.out │ └── ex9.31.out ├── man-roxygen └── mplusmodeler_args.R ├── man ├── HTMLSummaryTable.Rd ├── LatexSummaryTable.Rd ├── MplusAutomation.Rd ├── MplusAutomationUtils.Rd ├── OS.Rd ├── SummaryTable.Rd ├── addNode.Rd ├── cd.Rd ├── checkSubmission.Rd ├── classifyTags.Rd ├── clipString.Rd ├── coef.mplus.model.Rd ├── compareModels.Rd ├── confint.mplus.model.Rd ├── connectNodes.Rd ├── convert_to_filelist.Rd ├── createMixtures.Rd ├── createModels.Rd ├── createSyntax.Rd ├── createVarSyntax.Rd ├── detectColumnNames.Rd ├── detectMplus.Rd ├── detectVariables.Rd ├── dhms_to_hours.Rd ├── divideIntoFields.Rd ├── dot-convertData.Rd ├── dot-mplusMultinomial.Rd ├── evaluateConditional.Rd ├── extract.Rd ├── extractAux.Rd ├── extractClassCounts.Rd ├── extractDataSummary.Rd ├── extractEFAparameters.Rd ├── extractFacScoreStats.Rd ├── extractFreeFile.Rd ├── extractIndirect.Rd ├── extractIndirect_section.Rd ├── extractInput_1file.Rd ├── extractModIndices.Rd ├── extractModIndices_1chunk.Rd ├── extractModIndices_1file.Rd ├── extractModelParameters.Rd ├── extractModelSummaries.Rd ├── extractParameters_1chunk.Rd ├── extractParameters_1file.Rd ├── extractParameters_1section.Rd ├── extractR3step.Rd ├── extractResiduals.Rd ├── extractResiduals_1section.Rd ├── extractSampstat.Rd ├── extractSummaries_1file.Rd ├── extractSummaries_1plan.Rd ├── extractSummaries_1section.Rd ├── extractTech1.Rd ├── extractTech10.Rd ├── extractTech12.Rd ├── extractTech15.Rd ├── extractTech3.Rd ├── extractTech4.Rd ├── extractTech7.Rd ├── extractTech8.Rd ├── extractTech9.Rd ├── extractValue.Rd ├── extractWarningsErrors_1file.Rd ├── filter_inp_filelist.Rd ├── finalizeInitCollection.Rd ├── friendlyGregexpr.Rd ├── getInitTags.Rd ├── getMultilineSection.Rd ├── getOutFileList.Rd ├── getSavedata_Bparams.Rd ├── getSavedata_Data.Rd ├── getSavedata_Fileinfo.Rd ├── getSavedata_readRawFile.Rd ├── getSection.Rd ├── get_efa_nfactors.Rd ├── get_job_status.Rd ├── get_results.Rd ├── graphModel.Rd ├── htmlout.Rd ├── isEmpty.Rd ├── l_getSavedata_Bparams.Rd ├── l_getSavedata_Fileinfo.Rd ├── lcademo.Rd ├── local_job_status.Rd ├── long2LGMM.Rd ├── lookupSimpleTags.Rd ├── lookupTech1Parameter.Rd ├── lookupValue.Rd ├── matrixExtract.Rd ├── minutes_to_dhms.Rd ├── mixtureSummaryTable.Rd ├── mplus.traceplot.Rd ├── mplusAvailable.Rd ├── mplusGLM.Rd ├── mplusModel.Rd ├── mplusModel_r6.Rd ├── mplusModeler.Rd ├── mplusObject.Rd ├── mplusRcov.Rd ├── mplus_as.numeric.Rd ├── paramExtract.Rd ├── parseCatOutput.Rd ├── parseMplus.Rd ├── parseMplusSyntax.Rd ├── parseTags.Rd ├── plot.mplusObject.Rd ├── plotGrowthMixtures.Rd ├── plotLTA.Rd ├── plotMixtureDensities.Rd ├── plotMixtures.Rd ├── prepareMplusData.Rd ├── prepareMplusData_Mat.Rd ├── print.MplusRstructure.Rd ├── processConditionalTags.Rd ├── processInit.Rd ├── readModels.Rd ├── recurseReplace.Rd ├── replaceBodyTags.Rd ├── replaceInitTags.Rd ├── rmVarWarnings.Rd ├── runModels.Rd ├── runModels_Interactive.Rd ├── separateHyphens.Rd ├── showSummaryTable.Rd ├── slurm_job_status.Rd ├── splitDFByRow.Rd ├── splitFilePath.Rd ├── submitModels.Rd ├── subsetModelList.Rd ├── summary.mplusObject.Rd ├── summary.mplus_submission_df.Rd ├── testBParamCompoundConstraint.Rd ├── testBParamConstraint.Rd ├── torque_job_status.Rd ├── trainLGMM.Rd ├── trimSpace.Rd ├── unlabeledMatrixExtract.Rd ├── update.mplusObject.Rd ├── updateCurrentValues.Rd └── validate_dhms.Rd ├── tests ├── testthat.R └── testthat │ ├── ex3.1.out │ ├── ex3.11.out │ ├── ex3.16.out │ ├── ex3.18.out │ ├── ex3.4.out │ ├── ex3.5.out │ ├── ex3.6.out │ ├── ex3.7.out │ ├── ex5.1.out │ ├── ex5.12.out │ ├── ex5.2.out │ ├── ex5.33.out │ ├── ex5.5part4.out │ ├── ex6.1.out │ ├── ex6.23.out │ ├── ex6.4.out │ ├── ex7.3.out │ ├── ex7.3_error.out │ ├── ex7.3_old.out │ ├── ex9.2c.out │ ├── ex9.31.out │ ├── helper-out_files.R │ ├── lca_man_3step.out │ ├── mplus_ug │ ├── 8.11 │ │ └── ch3 │ │ │ ├── ex3.6.dat │ │ │ ├── ex3.6.h5 │ │ │ ├── ex3.6.inp │ │ │ └── ex3.6.out │ └── 8.9 │ │ └── ch3 │ │ ├── ex3.1.out │ │ ├── ex3.2.out │ │ ├── ex3.3.out │ │ ├── ex3.4.out │ │ └── ex3.5.out │ ├── submitModels │ ├── ex3.1.dat │ ├── ex3.1.inp │ ├── ex3.2.dat │ ├── ex3.2.inp │ ├── ex3.3.dat │ ├── ex3.3.inp │ ├── post_example.R │ └── pre_example.R │ ├── test-cfasem.R │ ├── test-issue158_createmixtures.R │ ├── test-lca.R │ ├── test-lgm.R │ ├── test-mlm.R │ ├── test-mplusModel.R │ ├── test-pathanalysis.R │ ├── test-submitModels.R │ ├── test-timeseriesN1.R │ ├── test-ug-ch3.R │ └── test_prepare_longpath.R └── vignettes ├── README.md ├── cfa-draft-acg.Rmd.orig ├── cfa_mplus ├── cfa_m1_uli.gh5 └── cfa_m2_uvi.gh5 ├── cfacont.Rmd.orig ├── mplusAutomationFMMPlot.png ├── precompile.R ├── runModels_Interactive-Screenshot.png └── vignette.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | .git 3 | 4 | products 5 | local 6 | examples 7 | pkg_build 8 | ^.*\.Rproj$ 9 | ^\.Rproj\.user$ 10 | ^_pkgdown\.yml$ 11 | ^docs$ 12 | ^pkgdown$ 13 | ^.*\.log$ 14 | ^.*\.dgm$ 15 | ^man-roxygen 16 | 17 | vignettes/README.md 18 | vignettes/precompile.R 19 | ^vignettes/.*\.orig$ 20 | ^vignettes/.*\.inp$ 21 | ^vignettes/.*\.out$ 22 | ^vignettes/.*\.dat$ 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History and RStudio files 2 | .Rhistory 3 | .Rapp.history 4 | .RData 5 | .Rproj.user 6 | .Rproj.user/ 7 | # emacs files 8 | *~ 9 | 10 | # README htmls in any folder 11 | README.html 12 | 13 | # The devtools zip is downloaded when the package is updating itself. If it's not deleted, there's no reason to commit it to the repository. 14 | devtools.zip 15 | 16 | pkg_build 17 | local 18 | products 19 | 20 | #from mac 21 | .DS_Store 22 | 23 | # Mplus files 24 | *.dat 25 | *.inp 26 | *.out 27 | *.log 28 | *.dgm 29 | !inst/extdata/*.out 30 | !inst/extdata/*.csv 31 | !tests/testthast/*.csv 32 | !tests/testthast/*.out 33 | !tests/testthat/*.out 34 | !tests/testthat/*.csv 35 | !tests/testthat/mplus_ug -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "R-Debugger", 9 | "name": "Launch R-Workspace", 10 | "request": "launch", 11 | "debugMode": "workspace", 12 | "workingDirectory": "${workspaceFolder}" 13 | }, 14 | { 15 | "type": "R-Debugger", 16 | "name": "Debug R-File", 17 | "request": "launch", 18 | "debugMode": "file", 19 | "workingDirectory": "${workspaceFolder}", 20 | "file": "${file}" 21 | }, 22 | { 23 | "type": "R-Debugger", 24 | "name": "Debug R-Function", 25 | "request": "launch", 26 | "debugMode": "function", 27 | "workingDirectory": "${workspaceFolder}", 28 | "file": "${file}", 29 | "mainFunction": "main", 30 | "allowGlobalDebugging": false 31 | }, 32 | { 33 | "type": "R-Debugger", 34 | "name": "Debug R-Package", 35 | "request": "launch", 36 | "debugMode": "workspace", 37 | "workingDirectory": "${workspaceFolder}", 38 | "includePackageScopes": true, 39 | "loadPackages": [ 40 | "." 41 | ] 42 | }, 43 | { 44 | "type": "R-Debugger", 45 | "request": "attach", 46 | "name": "Attach to R process", 47 | "splitOverwrittenOutput": true 48 | } 49 | ] 50 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "r.debugger.timeouts.startup": 4000 3 | } -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: MplusAutomation 2 | Type: Package 3 | Title: An R Package for Facilitating Large-Scale Latent Variable Analyses in Mplus 4 | Version: 1.2 5 | Date: 2024-04-30 6 | Authors@R: c(person("Michael", "Hallquist", role = c("aut", "cre"), 7 | email = "michael.hallquist@gmail.com"), 8 | person("Joshua", "Wiley", role = "aut", 9 | email = "jwiley.psych@gmail.com"), 10 | person(given = "Caspar", family ="van Lissa", role = "ctb", 11 | email = "c.j.vanlissa@uu.nl"), 12 | person("Daniel", "Morillo", role = "ctb", 13 | email = "danivorillo@gmail.com") 14 | ) 15 | Maintainer: Michael Hallquist 16 | Description: Leverages the R language to automate latent variable model estimation 17 | and interpretation using 'Mplus', a powerful latent variable modeling program 18 | developed by Muthen and Muthen (). Specifically, this package 19 | provides routines for creating related groups of models, running batches of 20 | models, and extracting and tabulating model parameters and fit statistics. 21 | License: LGPL-3 22 | URL: https://michaelhallquist.github.io/MplusAutomation/ 23 | BugReports: https://github.com/michaelhallquist/MplusAutomation/issues 24 | Depends: 25 | R (>= 3.5.0), 26 | methods 27 | biocViews: 28 | Imports: 29 | utils, 30 | boot, 31 | plyr, 32 | gsubfn, 33 | coda, 34 | xtable, 35 | lattice, 36 | texreg, 37 | pander, 38 | digest, 39 | parallel, 40 | ggplot2, 41 | data.table, 42 | fastDummies, 43 | checkmate 44 | Suggests: 45 | rhdf5, 46 | tcltk, 47 | relimp, 48 | knitr, 49 | testthat (>= 3.0.0), 50 | rmarkdown 51 | LazyLoad: yes 52 | LazyData: yes 53 | VignetteBuilder: knitr 54 | RoxygenNote: 7.3.2 55 | Encoding: UTF-8 56 | Config/testthat/edition: 3 57 | -------------------------------------------------------------------------------- /MplusAutomation.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: No 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | BuildType: Package 16 | PackageUseDevtools: Yes 17 | PackageInstallArgs: --no-multiarch --with-keep.source 18 | PackageCheckArgs: --as-cran 19 | PackageRoxygenize: rd,collate,namespace 20 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' Latent Class Analysis Demonstration 2 | #' 3 | #' A list containing the Mplus Data, Output Files, and GH5 Files for a 4 | #' demonstration of using MplusAutomation for latent class analysis. 5 | #' Generated by the vignette on latent class analysis. 6 | #' 7 | #' @format A list containing 11 elements. 8 | #' \describe{ 9 | #' \item{Data}{2 Class LCA data simulated using Mplus} 10 | #' \item{CFA}{Mplus output file for CFA} 11 | #' \item{LCA2}{Mplus output file for 2 class LCA} 12 | #' \item{LCA3}{Mplus output file for 3 class LCA} 13 | #' \item{LCA4}{Mplus output file for 4 class LCA} 14 | #' \item{LCA5}{Mplus output file for 5 class LCA} 15 | #' \item{CFAGH5}{GH5 file for CFA} 16 | #' \item{LCA2GH5}{GH5 file for 2 class LCA} 17 | #' \item{LCA3GH5}{GH5 file for 3 class LCA} 18 | #' \item{LCA4GH5}{GH5 file for 4 class LCA} 19 | #' \item{LCA5GH5}{GH5 file for 5 class LCA} 20 | #' } 21 | "lcademo" 22 | 23 | -------------------------------------------------------------------------------- /data/lcademo.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/data/lcademo.rda -------------------------------------------------------------------------------- /docs/articles/mplusAutomationFMMPlot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/docs/articles/mplusAutomationFMMPlot.png -------------------------------------------------------------------------------- /docs/articles/runModels_Interactive-Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/docs/articles/runModels_Interactive-Screenshot.png -------------------------------------------------------------------------------- /docs/articles/vignette_files/header-attrs-2.6/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/vignette_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent; 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.14.0.2 2 | pkgdown: 1.6.1 3 | pkgdown_sha: ~ 4 | articles: 5 | vignette: vignette.html 6 | last_built: 2021-07-01T04:14Z 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /examples/lca_cfa_example/analyze_lca.inp: -------------------------------------------------------------------------------- 1 | title: 2 | Analyze simulated dataset as LCA 3 | 4 | DATA: 5 | FILE=lca_cfa_example.dat; 6 | 7 | VARIABLE: 8 | NAMES = u1-u6; 9 | categorical = u1-u6; 10 | classes = c(2); 11 | analysis: 12 | type = mixture; 13 | estimator=mlr; 14 | starts=1000 100; 15 | 16 | model: 17 | 18 | %overall% 19 | 20 | %c#1% 21 | 22 | %c#2% 23 | 24 | output: 25 | tech8 tech14; 26 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/analyze_lca_3class.inp: -------------------------------------------------------------------------------- 1 | title: 2 | Analyze simulated dataset as LCA 3 | 4 | DATA: 5 | FILE=lca_cfa_example.dat; 6 | 7 | VARIABLE: 8 | NAMES = u1-u6; 9 | categorical = u1-u6; 10 | classes = c(3); 11 | analysis: 12 | type = mixture; 13 | estimator=mlr; 14 | starts=1000 100; 15 | 16 | model: 17 | 18 | %overall% 19 | 20 | %c#1% 21 | 22 | %c#2% 23 | 24 | %c#3% 25 | 26 | output: 27 | tech8 tech14; 28 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/sim_lca_cfa.inp: -------------------------------------------------------------------------------- 1 | title: 2 | Data generation of 2-class 6-indicator LCA dataset for use as example 3 | in Hallquist & Wiley MplusAutomation manuscript 4 | 5 | (extension of User's Guide example 7.4) 6 | 7 | montecarlo: 8 | NAMES = u1-u6; 9 | generate = u1-u6(1); 10 | categorical = u1-u6; 11 | genclasses = c(2); 12 | classes = c(2); 13 | nobs = 1000; 14 | seed = 3454367; 15 | nrep = 100; 16 | save = lca_cfa_example.dat; 17 | 18 | analysis: 19 | type = mixture; 20 | estimator=mlr; 21 | 22 | model population: 23 | 24 | %overall% 25 | 26 | [c#1*0]; 27 | 28 | %c#1% 29 | [u1$1*1 u2$1*1 u3$1*-1 u4$1*-1 u5$1*2 u6$1*2]; 30 | 31 | %c#2% 32 | [u1$1*-1 u2$1*-1 u3$1*1 u4$1*1 u5$1*-2 u6$1*-2]; 33 | 34 | model: 35 | 36 | %overall% 37 | 38 | [c#1*0]; 39 | 40 | %c#1% 41 | [u1$1*1 u2$1*1 u3$1*-1 u4$1*-1 u5$1*2 u6$1*2]; 42 | 43 | %c#2% 44 | [u1$1*-1 u2$1*-1 u3$1*1 u4$1*1 u5$1*-2 u6$1*-2]; 45 | 46 | output: 47 | tech8 tech9; 48 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample.txt: -------------------------------------------------------------------------------- 1 | [[init]] 2 | iterators = model; 3 | model=1:5; 4 | modelnames#model = CFA LCA2 LCA3 LCA4 LCA5; 5 | title#model = "Confirmatory Factor Analysis" 6 | "2-class LCA" 7 | "3-class LCA" 8 | "4-class LCA" 9 | "5-class LCA"; 10 | 11 | classes#model = 0 2 3 4 5; 12 | 13 | filename = "[[modelnames#model]].inp"; 14 | outputDirectory = templateExample/[[modelnames#model]]; 15 | [[/init]] 16 | 17 | TITLE: [[title#model]] 18 | DATA: FILE = "../../lca_cfa_example.dat"; 19 | VARIABLE: NAMES = u1-u6; MISSING=.; 20 | CATEGORICAL = u1-u6; 21 | 22 | [[model > 1]] CLASSES = c([[classes#model]]); [[/model > 1]] 23 | 24 | ANALYSIS: 25 | [[model == 1]] TYPE=GENERAL; ESTIMATOR=MLR; [[/model == 1]] 26 | [[model > 1]] TYPE = MIXTURE; STARTS = 250 25; [[/model > 1]] 27 | 28 | MODEL: 29 | [[model==1]] factor BY u1-u6; [[/model==1]] 30 | [[model > 1]] %OVERALL% [[/model > 1]] 31 | 32 | OUTPUT: TECH1 TECH8 [[model > 1]] TECH14 [[/model > 1]]; 33 | PLOT: TYPE=PLOT3; 34 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/CFA/CFA.gh5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/examples/lca_cfa_example/templateExample/CFA/CFA.gh5 -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/CFA/CFA.inp: -------------------------------------------------------------------------------- 1 | 2 | TITLE: Confirmatory Factor Analysis 3 | DATA: FILE = "../../lca_cfa_example.dat"; 4 | VARIABLE: NAMES = u1-u6; MISSING=.; 5 | CATEGORICAL = u1-u6; 6 | 7 | 8 | ANALYSIS: 9 | TYPE=GENERAL; ESTIMATOR=MLR; 10 | 11 | MODEL: 12 | factor BY u1-u6; 13 | 14 | OUTPUT: TECH1 TECH8 ; 15 | PLOT: TYPE=PLOT3; 16 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA2/LCA2.gh5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/examples/lca_cfa_example/templateExample/LCA2/LCA2.gh5 -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA2/LCA2.inp: -------------------------------------------------------------------------------- 1 | 2 | TITLE: 2-class LCA 3 | DATA: FILE = "../../lca_cfa_example.dat"; 4 | VARIABLE: NAMES = u1-u6; MISSING=.; 5 | CATEGORICAL = u1-u6; 6 | 7 | CLASSES = c(2); 8 | 9 | ANALYSIS: 10 | TYPE = MIXTURE; STARTS = 250 25; 11 | 12 | MODEL: 13 | %OVERALL% 14 | 15 | OUTPUT: TECH1 TECH8 TECH14 ; 16 | PLOT: TYPE=PLOT3; 17 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA3/LCA3.gh5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/examples/lca_cfa_example/templateExample/LCA3/LCA3.gh5 -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA3/LCA3.inp: -------------------------------------------------------------------------------- 1 | 2 | TITLE: 3-class LCA 3 | DATA: FILE = "../../lca_cfa_example.dat"; 4 | VARIABLE: NAMES = u1-u6; MISSING=.; 5 | CATEGORICAL = u1-u6; 6 | 7 | CLASSES = c(3); 8 | 9 | ANALYSIS: 10 | TYPE = MIXTURE; STARTS = 250 25; 11 | 12 | MODEL: 13 | %OVERALL% 14 | 15 | OUTPUT: TECH1 TECH8 TECH14 ; 16 | PLOT: TYPE=PLOT3; 17 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA4/LCA4.gh5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/examples/lca_cfa_example/templateExample/LCA4/LCA4.gh5 -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA4/LCA4.inp: -------------------------------------------------------------------------------- 1 | 2 | TITLE: 4-class LCA 3 | DATA: FILE = "../../lca_cfa_example.dat"; 4 | VARIABLE: NAMES = u1-u6; MISSING=.; 5 | CATEGORICAL = u1-u6; 6 | 7 | CLASSES = c(4); 8 | 9 | ANALYSIS: 10 | TYPE = MIXTURE; STARTS = 250 25; 11 | 12 | MODEL: 13 | %OVERALL% 14 | 15 | OUTPUT: TECH1 TECH8 TECH14 ; 16 | PLOT: TYPE=PLOT3; 17 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA5/LCA5.gh5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/examples/lca_cfa_example/templateExample/LCA5/LCA5.gh5 -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/LCA5/LCA5.inp: -------------------------------------------------------------------------------- 1 | 2 | TITLE: 5-class LCA 3 | DATA: FILE = "../../lca_cfa_example.dat"; 4 | VARIABLE: NAMES = u1-u6; MISSING=.; 5 | CATEGORICAL = u1-u6; 6 | 7 | CLASSES = c(5); 8 | 9 | ANALYSIS: 10 | TYPE = MIXTURE; STARTS = 250 25; 11 | 12 | MODEL: 13 | %OVERALL% 14 | 15 | OUTPUT: TECH1 TECH8 TECH14 ; 16 | PLOT: TYPE=PLOT3; 17 | -------------------------------------------------------------------------------- /examples/lca_cfa_example/templateExample/Mplus Run Models.log: -------------------------------------------------------------------------------- 1 | ------Begin Mplus Model Run: 12May2016 16:14:10------ 2 | Target directory: . 3 | Run options: 4 | Recursive (run models in subdirectories): TRUE 5 | Show output on console: FALSE 6 | Replace existing outfile: always 7 | ------ 8 | Currently running model: CFA.inp 9 | Currently running model: LCA2.inp 10 | Currently running model: LCA3.inp 11 | Currently running model: LCA4.inp 12 | Currently running model: LCA5.inp 13 | 14 | ------End Mplus Model Run: 12May2016 16:14:15------ 15 | -------------------------------------------------------------------------------- /examples/monte_carlo/Mplus_Monte_Carlo.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | -------------------------------------------------------------------------------- /examples/monte_carlo/helper_functions.R: -------------------------------------------------------------------------------- 1 | 2 | ## This worker function generates Mplus syntax to estimate a one-factor CFA for each replication. 3 | ## One could easily adapt it to use mplusObject and mplusModeler 4 | getCFASyntax <- function(nc, nv, ss, sep, np, dataSection, output=NULL, savedata=NULL, processors=1) { 5 | syntax <- paste0( 6 | "TITLE:\n", 7 | " CFA NClass = ", nc, ", NVar = ", nv, ", NCases = ", ss, ", LCSep = ", sep, ", NoiseProp = ", np, "\n", 8 | dataSection, 9 | "VARIABLE:\n", 10 | " NAMES ARE ", paste0("x", 1:nv, collapse=" "), " trueclas;\n", 11 | " USEVARIABLES ARE ", paste0("x", 1:nv, collapse=" "), ";\n", 12 | "ANALYSIS:\n", 13 | " TYPE = GENERAL;\n", 14 | " ESTIMATOR=MLR;\n", 15 | " PROCESSORS=", processors, " 1;\n", 16 | " ITERATIONS = 2000;\n", 17 | " SDITERATIONS = 50;\n", 18 | " MITERATIONS = 2000;\n", 19 | "MODEL:\n", 20 | " fac BY ", paste0("x1-x", nv, "*1"), ";\n", 21 | " fac@1; !fix var to 1 for identification\n", 22 | " [", paste0("x1-x", nv, "*0"), "];\n", #zero means by default 23 | "\n", 24 | output, 25 | savedata 26 | ) 27 | return(syntax) 28 | } 29 | 30 | ## This worker function generates Mplus syntax to estimate an LCA model for each replication. 31 | ## One could easily adapt it to use mplusObject and mplusModeler 32 | getFMMSyntax <- function(fc, nc, nv, ss, sep, np, dataSection, propMeans=NULL, means=NULL, output=NULL, savedata=NULL, processors=1) { 33 | syntax <- paste0( 34 | "TITLE:\n", 35 | " FitClass = ", fc, ", NClass = ", nc, ", NVar = ", nv, ", NCases = ", ss, ", LCSep = ", sep, ", NoisePct = ", np, "\n", 36 | dataSection, 37 | "VARIABLE:\n", 38 | " NAMES ARE ", paste0("x", 1:nv, collapse=" "), " trueclas;\n", 39 | " USEVARIABLES ARE ", paste0("x", 1:nv, collapse=" "), ";\n", 40 | " CLASSES=c(", fc, ");\n", 41 | "ANALYSIS:\n", 42 | " STARTS = 350 35;\n", 43 | " TYPE = MIXTURE;\n", 44 | " ESTIMATOR=MLR;\n", 45 | " PROCESSORS=", processors, " 1;\n", 46 | "MODEL:\n", 47 | " %OVERALL%\n", 48 | " ", paste0("x1-x", nv, "*1"), ";\n", 49 | propMeans, 50 | "\n", 51 | means, 52 | output, 53 | savedata 54 | ) 55 | return(syntax) 56 | } 57 | 58 | ##cleanup temporary files generated by Mplus 59 | cleanupTempFiles <- function(dir=tempdir()) { 60 | unlink(c( 61 | file.path(tempdir(), "external_montecarlo_rep*.dat"), 62 | file.path(tempdir(), "*.tst"), #sometimes left behind by Mplus 63 | file.path(tempdir(), "external_montecarlo_rep*.dat"), 64 | file.path(tempdir(), "external_montecarlo_list.dat"), 65 | file.path(tempdir(), "individual_rep.inp"), 66 | file.path(tempdir(), "individual_rep.out"), 67 | file.path(tempdir(), "cprobs.dat") 68 | )) 69 | } 70 | -------------------------------------------------------------------------------- /examples/monte_carlo/mixsim_generation_functions.R: -------------------------------------------------------------------------------- 1 | #these functions are slightly adapted (or largely just documented from the MixSim package 2 | #tweaked to let me separate the simulation and noising processes. 3 | #code largely attributable to Volodymyr Melnykov, Wei-Chen Chen, and Ranjan Maitra. 4 | simdata <- function (n, Pi, Mu, S, n.noise = 0, n.out = 0, alpha = 0.001, 5 | max.out = 1e+05, int = NULL, lambda = NULL) 6 | { 7 | if (n < 1) 8 | stop("Wrong sample size n...\n") 9 | if (sum((Pi <= 0) | (Pi >= 1)) != 0) 10 | stop("Wrong vector of mixing proportions Pi...\n") 11 | if (n.noise < 0) 12 | stop("Wrong value of n.noise...\n") 13 | if (n.out < 0) 14 | stop("Wrong value of n.out...\n") 15 | if ((alpha >= 1) | (alpha <= 0)) 16 | stop("Wrong value of alpha...\n") 17 | if (max.out < 1) 18 | stop("Wrong value of max.out...\n") 19 | K <- dim(Mu)[1] 20 | p <- dim(Mu)[2] 21 | X <- NULL 22 | if (n >= K) { 23 | Nk <- rep(1, K) + drop(rmultinom(1, n - K, Pi)) 24 | } 25 | else { 26 | stop("sample size (n) cannot be less than the number of clusters") 27 | } 28 | id <- NULL 29 | for (k in 1:K) { 30 | id <- c(id, rep(k, Nk[k])) 31 | X <- rbind(X, mvrnorm(n = Nk[k], mu = Mu[k, ], Sigma = S[, 32 | , k])) 33 | } 34 | if (n.out != 0) { 35 | O <- getOutliers(n.out, Pi, Mu, S, alpha, max.out, int) 36 | if (O$fail == 1) { 37 | stop("Cannot generate outliers in ", max.out, " trials...\n") 38 | } 39 | else { 40 | X <- rbind(X, O$X.out) 41 | id <- c(id, rep(0, n.out)) 42 | } 43 | } 44 | if (n.noise != 0) { 45 | if (is.null(int)) { 46 | L <- min(Mu) 47 | U <- max(Mu) 48 | } 49 | else { 50 | L <- int[1] 51 | U <- int[2] 52 | } 53 | X.noise <- matrix(runif(n.noise * (n + n.out), min = L, 54 | max = U), ncol = n.noise) 55 | X <- cbind(X, X.noise) 56 | } 57 | if (!is.null(lambda)) { 58 | if (length(lambda) == p + n.noise) { 59 | for (j in 1:(p + n.noise)) { 60 | X[, j] <- (lambda[j] * X[, j] + 1)^(1/lambda[j]) - 61 | 1 62 | if (sum(is.nan(X[, j])) != 0) 63 | warning("NaNs were produced during transformation\n") 64 | } 65 | } 66 | else { 67 | stop("The number of transformation coefficients lambda should be equal to n.dimensions + n.noise") 68 | } 69 | } 70 | return(list(X = X, id = id)) 71 | } 72 | 73 | 74 | genOutliers <- function (n.out, Pi, Mu, S, alpha = 0.001, max.out = 1e+05, int = NULL) 75 | { 76 | fail <- 0 77 | K <- dim(Mu)[1] 78 | p <- dim(Mu)[2] 79 | 80 | #generate outliers that fall outside of the 95% CI in each dimension. 81 | 82 | crit.val <- qchisq(1 - alpha, df = p) 83 | if (is.null(int)) { 84 | L <- min(Mu) 85 | U <- max(Mu) 86 | } 87 | else { 88 | L <- int[1] 89 | U <- int[2] 90 | } 91 | X.out <- matrix(rep(NA, n.out * p), ncol = p) 92 | Sinv <- S 93 | for (k in 1:K) { 94 | Sinv[, , k] <- solve(S[, , k]) 95 | } 96 | i <- 1 97 | s <- 1 98 | while (i <= n.out) { 99 | X.out[i, ] <- runif(p, min = L, max = U) 100 | Z <- sweep(Mu, 2, X.out[i, ]) 101 | k <- 1 102 | while (k <= K) { 103 | if (t(Z[k, ]) %*% Sinv[, , k] %*% Z[k, ] < crit.val) { 104 | break 105 | } 106 | else { 107 | k <- k + 1 108 | } 109 | } 110 | if (k == K + 1) 111 | i <- i + 1 112 | if (s == max.out) { 113 | fail <- 1 114 | break 115 | } 116 | s <- s + 1 117 | } 118 | return(list(X.out = X.out, fail = fail)) 119 | } 120 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite MplusAutomation in publications use:") 2 | 3 | bibentry( 4 | bibtype = "Article", 5 | title = "{MplusAutomation}: An {R} Package for Facilitating Large-Scale Latent Variable Analyses in {Mplus}", 6 | author = c(person(c("Michael", "N."), "Hallquist"), 7 | person(c("Joshua", "F."), "Wiley")), 8 | journal = "Structural Equation Modeling", 9 | year = "2018", 10 | pages = "621--638", 11 | doi = "10.1080/10705511.2017.1402334", 12 | url = "https://www.tandfonline.com/doi/full/10.1080/10705511.2017.1402334", 13 | textVersion = 14 | paste("Hallquist, M. N. & Wiley, J. F. (2018).", 15 | "MplusAutomation: An R Package for Facilitating Large-Scale Latent Variable Analyses in Mplus", 16 | "Structural Equation Modeling, 25, 621-638.", 17 | "doi: 10.1080/10705511.2017.1402334.") 18 | ) 19 | -------------------------------------------------------------------------------- /man-roxygen/mplusmodeler_args.R: -------------------------------------------------------------------------------- 1 | #' @param dataout the name of the file to output the data to for Mplus. 2 | #' If missing, defaults to \code{modelout} changing .inp to .dat. 3 | #' @param modelout the name of the output file for the model. 4 | #' This is the file all the syntax is written to, which becomes the 5 | #' Mplus input file. It should end in .inp. If missing, defaults to 6 | #' \code{dataout} changing the extension to .inp. 7 | #' @param run an integer indicating how many models should be run. Defaults to zero. 8 | #' If zero, the data and model input files are all created, but the model is not run. 9 | #' This can be useful for seeing how the function works and what setup is done. If one, a basic 10 | #' model is run. If greater than one, the model is bootstrapped with \code{run} replications as 11 | #' well as the basic model. 12 | #' @param check logical whether the body of the Mplus syntax should be checked for missing 13 | #' semicolons using the \code{\link{parseMplus}} function. Defaults to \code{FALSE}. 14 | #' @param varwarnings A logical whether warnings about variable length should be left, the 15 | #' default, or removed from the output file. 16 | #' @param Mplus_command optional. N.B.: No need to pass this parameter for most users (has intelligent 17 | #' defaults). Allows the user to specify the name/path of the Mplus executable to be used for 18 | #' running models. This covers situations where Mplus is not in the system's path, 19 | #' or where one wants to test different versions of the Mplus program. 20 | #' @param writeData A character vector, one of \sQuote{ifmissing}, 21 | #' \sQuote{always}, \sQuote{never} indicating whether the data files 22 | #' (*.dat) should be written to disk. This is passed on to \code{prepareMplusData}. 23 | #' Note that previously, \code{mplusModeler} always (re)wrote the data to disk. 24 | #' However, now the default is to write the data to disk only if it is missing 25 | #' (i.e., \sQuote{ifmissing}). See details for further information. 26 | #' @param hashfilename A logical whether or not to add a hash of the raw data to the 27 | #' data file name. Defaults to \code{TRUE} in \code{mplusModeler}. Note that this 28 | #' behavior is a change from previous versions and differs from \code{prepareMplusData} 29 | #' which maintains the old behavior by default of \code{FALSE}. 30 | #' @param killOnFail A logical whether or not to kill any mplus processes on failure. 31 | #' Passed on to control behavior of \code{\link{runModels}}. Defaults to \code{TRUE}. 32 | #' @param \ldots additional arguments passed to the 33 | #' \code{\link[MplusAutomation]{prepareMplusData}} function. 34 | #' @param quiet optional. If \code{TRUE}, show status messages in the console. 35 | #' @return An Mplus model object, with results. 36 | #' If \code{run = 1}, returns an invisible list of results from the run of 37 | #' the Mplus model (see \code{\link[MplusAutomation]{readModels}} from the 38 | #' MplusAutomation package). If \code{run = 0}, the function returns a list 39 | #' with two elements, \sQuote{model} and \sQuote{boot} that are both \code{NULL}. 40 | #' if \code{run >= 1},returns a list with two elements, \sQuote{model} and \sQuote{boot} 41 | #' containing the regular Mplus model output and the boot object, respectively. 42 | #' In all cases, the Mplus data file and input files are created. 43 | -------------------------------------------------------------------------------- /man/HTMLSummaryTable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/summary.R 3 | \name{HTMLSummaryTable} 4 | \alias{HTMLSummaryTable} 5 | \title{Create an HTML file containing a summary table of Mplus model statistics} 6 | \usage{ 7 | HTMLSummaryTable( 8 | modelList, 9 | filename = file.path(getwd(), "Model Comparison.html"), 10 | keepCols, 11 | dropCols, 12 | sortBy = NULL, 13 | display = FALSE 14 | ) 15 | } 16 | \arguments{ 17 | \item{modelList}{A list of models (as a \code{data.frame}) returned from the \code{extractModelSummaries} function.} 18 | 19 | \item{filename}{The name of the HTML file to be created. Can be an absolute or relative path. If \code{filename} 20 | is a relative path or just the filename, then it is assumed that the file resides in the working 21 | directory \code{getwd()}. Example: \code{"Mplus Summary.html"}} 22 | 23 | \item{keepCols}{A vector of character strings indicating which columns/variables to display in the summary. 24 | Only columns included in this list will be displayed (all others excluded). By default, \code{keepCols} 25 | is: \code{c("Title", "LL", "Parameters", "AIC", "AICC", "BIC", "RMSEA_Estimate")}. Example: \code{c("Title", "LL", "AIC", "CFI")}} 26 | 27 | \item{dropCols}{A vector of character strings indicating which columns/variables to omit from the summary. 28 | Any column not included in this list will be displayed. By default, \code{dropCols} is \code{NULL}. 29 | Example: \code{c("InputInstructions", "TLI")}} 30 | 31 | \item{sortBy}{optional. Field name (as character string) by which to sort the table. Typically an information criterion 32 | (e.g., "AIC" or "BIC") is used to sort the table. 33 | Defaults to \code{NULL}, which does not sort the table.} 34 | 35 | \item{display}{optional. This parameter specifies whether to display the table in a web 36 | browser upon creation (\code{TRUE} or \code{FALSE}).} 37 | } 38 | \value{ 39 | No value is returned by this function. It is solely used to create an HTML file containing summary statistics. 40 | } 41 | \description{ 42 | Creates an HTML file containing a summary table of model fit statistics extracted using the \code{extractModelSummaries} function. 43 | By default, the following summary statistics are included: \code{Title, LL, Parameters, AIC, AICC, BIC, RMSEA_Estimate}, 44 | but these are customizable using the \code{keepCols} and \code{dropCols} parameters. 45 | } 46 | \note{ 47 | You must choose between \code{keepCols} and \code{dropCols} because it is not sensible to use these 48 | together to include and exclude columns. The function will error if you include both parameters. 49 | } 50 | \examples{ 51 | # make me!!! 52 | } 53 | \seealso{ 54 | \code{\link{extractModelSummaries}}, \code{\link{showSummaryTable}}, \code{\link{LatexSummaryTable}} 55 | } 56 | \author{ 57 | Michael Hallquist 58 | } 59 | \keyword{interface} 60 | -------------------------------------------------------------------------------- /man/LatexSummaryTable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/summary.R 3 | \name{LatexSummaryTable} 4 | \alias{LatexSummaryTable} 5 | \title{Display summary table of Mplus model statistics in separate window} 6 | \usage{ 7 | LatexSummaryTable( 8 | modelList, 9 | keepCols, 10 | dropCols, 11 | sortBy = NULL, 12 | label = NULL, 13 | caption = NULL 14 | ) 15 | } 16 | \arguments{ 17 | \item{modelList}{A list of models (as a \code{data.frame}) returned from the \code{extractModelSummaries} function.} 18 | 19 | \item{keepCols}{A vector of character strings indicating which columns/variables to display in the summary. Only columns 20 | included in this list will be displayed (all others excluded). By default, \code{keepCols} 21 | is: \code{c("Title", "LL", "Parameters", "AIC", "AICC", "BIC", "RMSEA_Estimate")}. 22 | Example: \code{c("Title", "LL", "AIC", "CFI")}} 23 | 24 | \item{dropCols}{A vector of character strings indicating which columns/variables to omit from the summary. 25 | Any column not included in this list will be displayed. By default, \code{dropCols} is \code{NULL}. 26 | Example: \code{c("InputInstructions", "TLI")}} 27 | 28 | \item{sortBy}{optional. Field name (as character string) by which to sort the table. 29 | Typically an information criterion (e.g., "AIC" or "BIC") is used to sort the table. 30 | Defaults to \code{NULL}, which does not sort the table.} 31 | 32 | \item{label}{optional. A character string specifying the label for the LaTex table, which can be 33 | used for referencing the table.} 34 | 35 | \item{caption}{optional. A character string specifying the caption for the LaTex table.} 36 | } 37 | \value{ 38 | A LaTex-formatted table summarizing the \code{modelList} is returned (created by \code{xtable}). 39 | } 40 | \description{ 41 | Creates a LaTex-formatted summary table of model fit statistics extracted using the \code{extractModelSummaries} function. 42 | The table syntax is returned by the function, which is useful for embedding LaTex tables using Sweave. 43 | By default, the following summary statistics are included: \code{Title, LL, Parameters, AIC, AICC, BIC, RMSEA_Estimate}, 44 | but these are customizable using the \code{keepCols} and \code{dropCols} parameters. 45 | } 46 | \note{ 47 | You must choose between \code{keepCols} and \code{dropCols} because it is not sensible to use these together 48 | to include and exclude columns. The function will error if you include both parameters. 49 | } 50 | \examples{ 51 | # make me!!! 52 | } 53 | \seealso{ 54 | \code{\link{extractModelSummaries}}, \code{\link{HTMLSummaryTable}}, \code{\link{showSummaryTable}}, \code{\link{Sweave}} 55 | } 56 | \author{ 57 | Michael Hallquist 58 | } 59 | \keyword{interface} 60 | -------------------------------------------------------------------------------- /man/MplusAutomationUtils.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/prepareMplusData.R 3 | \name{.cleanHashData} 4 | \alias{.cleanHashData} 5 | \alias{.hashifyFile} 6 | \title{Clean data and calculate the md5 hash} 7 | \usage{ 8 | .cleanHashData(df, keepCols = NULL, dropCols = NULL, imputed = FALSE) 9 | 10 | .hashifyFile(filename, hash, useexisting = FALSE) 11 | } 12 | \arguments{ 13 | \item{df}{The R data.frame to be prepared for Mplus} 14 | 15 | \item{keepCols}{A character vector specifying the variable names 16 | within \code{df} to be output to \code{filename} or a numeric 17 | vector of the column indices to be output or a logical vector 18 | corresponding to the same.} 19 | 20 | \item{dropCols}{A character vector specifying the variable names 21 | within \code{df} to be omitted from the data output to \code{filename} 22 | or a numeric vector of the column indices not to be output 23 | or a logical vector corresponding to the same.} 24 | 25 | \item{imputed}{A logical whether data are multiply imputed. Defaults 26 | to \code{FALSE}. If \code{TRUE}, the data should be a list, 27 | where each element of the list is a multiply imputed dataset.} 28 | 29 | \item{filename}{A character vector containing the filename} 30 | 31 | \item{hash}{A character vector with the hash to use} 32 | 33 | \item{useexisting}{A logical whether to use an existing file name 34 | if one is found containing the hash. Defaults to \code{FALSE} 35 | in which case the hash is added to the user specified filename} 36 | } 37 | \value{ 38 | A list of the data and the md5 hash. 39 | 40 | A list of the filename (plus hash) and a logical value 41 | whether a filename with the hash already existed or not. 42 | } 43 | \description{ 44 | Internal utility function, primarily for \code{prepareMplusData}. 45 | 46 | Internal utility function, primarily for \code{prepareMplusData}. 47 | } 48 | \examples{ 49 | \dontrun{ 50 | 51 | ## basic example 52 | MplusAutomation:::.cleanHashData(mtcars) 53 | 54 | ## has changes when data changes 55 | MplusAutomation:::.cleanHashData(mtcars[-15,]) 56 | 57 | ## example on a list (e.g., for multiply imputed data) 58 | 59 | MplusAutomation:::.cleanHashData( 60 | list( 61 | data.frame(a = 1:4), 62 | data.frame(a = c(2, 2, 3, 4))), 63 | imputed = TRUE) 64 | 65 | } 66 | MplusAutomation:::.hashifyFile("testit.dat", "abc") 67 | } 68 | \keyword{internal} 69 | -------------------------------------------------------------------------------- /man/OS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{OS} 4 | \alias{OS} 5 | \alias{is.windows} 6 | \alias{is.macos} 7 | \alias{is.linux} 8 | \alias{os} 9 | \title{Functions to identify the operating system} 10 | \usage{ 11 | is.windows() 12 | 13 | is.macos() 14 | 15 | is.linux() 16 | 17 | os() 18 | } 19 | \value{ 20 | A logical value for the is.* functions and a character string for os() 21 | } 22 | \description{ 23 | Functions to identify the operating system 24 | } 25 | \examples{ 26 | 27 | MplusAutomation:::is.windows() 28 | 29 | MplusAutomation:::is.macos() 30 | 31 | MplusAutomation:::is.linux() 32 | 33 | MplusAutomation:::os() 34 | } 35 | \author{ 36 | Joshua F. Wiley 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/addNode.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/graphModels.R 3 | \name{addNode} 4 | \alias{addNode} 5 | \title{Add a node to a GRAPHVIZ model} 6 | \usage{ 7 | addNode(dotModel, name, role, type) 8 | } 9 | \arguments{ 10 | \item{dotModel}{Basic model} 11 | 12 | \item{name}{name of model} 13 | 14 | \item{role}{The role of a variable (can be multiple)} 15 | 16 | \item{type}{The type of variable} 17 | } 18 | \value{ 19 | the dotModel with added node 20 | } 21 | \description{ 22 | To do: add details 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/cd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{cd} 4 | \alias{cd} 5 | \title{Change directory} 6 | \usage{ 7 | cd(base, pre, num) 8 | } 9 | \arguments{ 10 | \item{base}{a character string with the base path to the directory. This is required.} 11 | 12 | \item{pre}{an optional character string with the prefix to add to 13 | the base path. Non character strings will be coerced to character class.} 14 | 15 | \item{num}{an optional character string, prefixed by \code{pre}. 16 | Non character strings will be coerced to character class.} 17 | } 18 | \value{ 19 | NULL, changes the current working directory 20 | } 21 | \description{ 22 | The function takes a path and changes the current working directory 23 | to the path. If the directory specified in the path does not 24 | currently exist, it will be created. 25 | } 26 | \details{ 27 | The function has been designed to be platform independent, 28 | although it has had limited testing. Path creation is done using 29 | \code{file.path}, the existence of the directory is checked using 30 | \code{file.exists} and the directory created with \code{dir.create}. 31 | Only the first argument, is required. The other optional arguments 32 | are handy when one wants to create many similar directories with a common base. 33 | } 34 | \examples{ 35 | \dontrun{ 36 | # an example just using the base 37 | cd("~/testdir") 38 | 39 | # an example using the optional arguments 40 | base <- "~/testdir" 41 | pre <- "test_" 42 | 43 | cd(base, pre, 1) 44 | cd(base, pre, 2) 45 | } 46 | } 47 | \author{ 48 | Joshua F. Wiley 49 | } 50 | \keyword{utilities} 51 | -------------------------------------------------------------------------------- /man/checkSubmission.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{checkSubmission} 4 | \alias{checkSubmission} 5 | \title{check on the status of submitted Mplus jobs on the cluster} 6 | \usage{ 7 | checkSubmission(mplus_submission_df = NULL, quiet = FALSE) 8 | } 9 | \arguments{ 10 | \item{mplus_submission_df}{The data.frame returned by \code{submitModels} containing 11 | jobs to check on} 12 | 13 | \item{quiet}{If \code{TRUE}, do not print out the submission data.frame with current status} 14 | } 15 | \value{ 16 | invisibly, the \code{mplus_submission_df} with `$status` amd `$status_time` updated 17 | } 18 | \description{ 19 | check on the status of submitted Mplus jobs on the cluster 20 | } 21 | -------------------------------------------------------------------------------- /man/classifyTags.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{classifyTags} 4 | \alias{classifyTags} 5 | \title{Classifies Tags} 6 | \usage{ 7 | classifyTags(tagVector, iteratorsVector) 8 | } 9 | \arguments{ 10 | \item{tagVector}{A vector of tags to be classified} 11 | 12 | \item{iteratorsVector}{a vector of the iterators to correctly classify tags} 13 | } 14 | \value{ 15 | A character vector the same length as the vectors to be tagged 16 | } 17 | \description{ 18 | Accepts a vector of tags to be classified as well as the iterators. 19 | Tags are classified as \sQuote{iterator}, \sQuote{array}, \sQuote{conditional}, or 20 | \sQuote{simple}. This is an internal function. 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/clipString.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{clipString} 4 | \alias{clipString} 5 | \title{Clip String} 6 | \usage{ 7 | clipString(string, start, end) 8 | } 9 | \arguments{ 10 | \item{string}{A string to be clipped} 11 | 12 | \item{start}{The character position to start at} 13 | 14 | \item{end}{The character position to end at} 15 | } 16 | \value{ 17 | A string from start to end 18 | } 19 | \description{ 20 | To do: add any details. 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/coef.mplus.model.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods.R 3 | \name{coef.mplus.model} 4 | \alias{coef.mplus.model} 5 | \alias{coef.mplusObject} 6 | \title{Return coefficients for an mplus.model object} 7 | \usage{ 8 | \method{coef}{mplus.model}( 9 | object, 10 | type = c("un", "std", "stdy", "stdyx"), 11 | params = c("regression", "loading", "undirected", "expectation", "variability", "new"), 12 | ..., 13 | raw = FALSE 14 | ) 15 | 16 | \method{coef}{mplusObject}(object, ...) 17 | } 18 | \arguments{ 19 | \item{object}{An object of class mplusObject} 20 | 21 | \item{type}{A character vector indicating the type of coefficients to return. 22 | One of \dQuote{un}, \dQuote{std}, \dQuote{stdy}, or \dQuote{stdyx}.} 23 | 24 | \item{params}{A character vector indicating what type of parameters to 25 | extract. Any combination of \dQuote{regression}, \dQuote{loading}, 26 | \dQuote{undirected}, \dQuote{expectation}, \dQuote{variability}, and 27 | \dQuote{new}. A 28 | single one can be passed or multiple. By default, all are used and 29 | all parameters are returned.} 30 | 31 | \item{\dots}{Additional arguments to pass on (not currently used)} 32 | 33 | \item{raw}{A logical defaulting to \code{FALSE} indicating whether to 34 | parse and return coefficients based on the type (regression, etc.) and 35 | relabel using an arrow notation, or to return the raw coefficients in a named 36 | vector.} 37 | } 38 | \value{ 39 | Either a data frame of class \sQuote{mplus.model.coefs}, or in 40 | the case of multiple group models, a list of class \sQuote{mplus.model.coefs}, 41 | where each element of the list is a data frame of class \sQuote{mplus.model.coefs}, 42 | or a named vector of coefficients, if \code{raw=TRUE}. 43 | } 44 | \description{ 45 | This is a method for returning the coefficients of an mplus.model object. 46 | It works directly on an object stored from \code{readModels} such as: 47 | \code{object <- readModels("/path/to/model/model.out")}. 48 | 49 | Method that calls \code{coef.mplus.model}. 50 | See further documentation there. 51 | } 52 | \examples{ 53 | \dontrun{ 54 | # simple example of a model using builtin data 55 | # demonstrates use 56 | test <- mplusObject( 57 | TITLE = "test the MplusAutomation Package;", 58 | MODEL = " 59 | mpg ON wt hp; 60 | wt WITH hp;", 61 | OUTPUT = "STANDARDIZED;", 62 | usevariables = c("mpg", "wt", "hp"), 63 | rdata = mtcars) 64 | 65 | res <- mplusModeler(test, "mtcars.dat", modelout = "model1.inp", run = 1L) 66 | 67 | # example of the coef method on an mplud.model object 68 | # note that res$results holds the results of readModels() 69 | coef(res$results) 70 | coef(res$results, type = "std") 71 | coef(res$results, type = "stdy") 72 | coef(res$results, type = "stdyx") 73 | 74 | # there is also a method for mplusObject class 75 | coef(res) 76 | 77 | # remove files 78 | unlink("mtcars.dat") 79 | unlink("model1.inp") 80 | unlink("model1.out") 81 | unlink("Mplus Run Models.log") 82 | } 83 | } 84 | \seealso{ 85 | \code{\link{readModels}} 86 | 87 | Other Mplus-Formatting: 88 | \code{\link{confint.mplus.model}()}, 89 | \code{\link{extract}()}, 90 | \code{\link{print.MplusRstructure}()}, 91 | \code{\link{summary.mplusObject}()} 92 | } 93 | \author{ 94 | Joshua F. Wiley 95 | } 96 | \concept{Mplus-Formatting} 97 | \keyword{interface} 98 | -------------------------------------------------------------------------------- /man/confint.mplus.model.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods.R 3 | \name{confint.mplus.model} 4 | \alias{confint.mplus.model} 5 | \alias{confint.mplusObject} 6 | \title{Return confidence intervals for an mplus.model object} 7 | \usage{ 8 | \method{confint}{mplus.model}( 9 | object, 10 | parm, 11 | level = 0.95, 12 | type = c("un", "std", "stdy", "stdyx"), 13 | params = c("regression", "loading", "undirected", "expectation", "variability", "new"), 14 | ... 15 | ) 16 | 17 | \method{confint}{mplusObject}(object, ...) 18 | } 19 | \arguments{ 20 | \item{object}{An object of class mplusObject} 21 | 22 | \item{parm}{Included as all \code{confint()} methods must include it. Not used 23 | currently for Mplus.} 24 | 25 | \item{level}{A numeric vector indicating the level of confidence interval to extract. 26 | Options are .95, .90, or .99 as those are all Mplus provides.} 27 | 28 | \item{type}{A character vector indicating the type of confidence intervals 29 | to return. One of \dQuote{un}, \dQuote{std}, \dQuote{stdy}, or \dQuote{stdyx}.} 30 | 31 | \item{params}{A character vector indicating what type of parameters to 32 | extract. Any combination of \dQuote{regression}, \dQuote{loading}, 33 | \dQuote{undirected}, \dQuote{expectation}, \dQuote{variability}, and 34 | \dQuote{new}. A single one can be passed or multiple. By default, all 35 | are used and all parameters are returned.} 36 | 37 | \item{\dots}{Additional arguments to pass on (not currently used)} 38 | } 39 | \value{ 40 | A data frame of class \sQuote{mplus.model.cis}, or in 41 | the case of multiple group models, a list of class \sQuote{mplus.model.cis}, 42 | where each element of the list is a data frame of class \sQuote{mplus.model.cis}. 43 | } 44 | \description{ 45 | This is a method for returning the confidence of an mplus.model object. 46 | It works directly on an object stored from \code{readModels} such as: 47 | \code{object <- readModels("/path/to/model/model.out")}. 48 | 49 | Method that calls \code{confint.mplus.model}. 50 | See further documentation there. 51 | } 52 | \examples{ 53 | \dontrun{ 54 | # simple example of a model using builtin data 55 | # demonstrates use 56 | test <- mplusObject( 57 | TITLE = "test the MplusAutomation Package;", 58 | MODEL = " 59 | mpg ON wt hp; 60 | wt WITH hp;", 61 | OUTPUT = "STANDARDIZED; CINTERVAL;", 62 | usevariables = c("mpg", "wt", "hp"), 63 | rdata = mtcars) 64 | 65 | res <- mplusModeler(test, "mtcars.dat", modelout = "model1.inp", run = 1L) 66 | 67 | # example of the confint method on an mplus.model object 68 | # note that res$results holds the results of readModels() 69 | confint(res$results) 70 | confint(res$results, type = "std") 71 | confint(res$results, type = "stdy") 72 | confint(res$results, type = "stdyx", level = .99) 73 | 74 | # there is also a method for mplusObject class 75 | confint(res) 76 | screenreg(res, cis = TRUE, single.row = TRUE) 77 | 78 | # remove files 79 | unlink("mtcars.dat") 80 | unlink("model1.inp") 81 | unlink("model1.out") 82 | unlink("Mplus Run Models.log") 83 | } 84 | } 85 | \seealso{ 86 | \code{\link{readModels}} 87 | 88 | Other Mplus-Formatting: 89 | \code{\link{coef.mplus.model}()}, 90 | \code{\link{extract}()}, 91 | \code{\link{print.MplusRstructure}()}, 92 | \code{\link{summary.mplusObject}()} 93 | } 94 | \author{ 95 | Joshua F. Wiley 96 | } 97 | \concept{Mplus-Formatting} 98 | \keyword{interface} 99 | -------------------------------------------------------------------------------- /man/connectNodes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/graphModels.R 3 | \name{connectNodes} 4 | \alias{connectNodes} 5 | \title{Connect two nodes} 6 | \usage{ 7 | connectNodes(dotModel, node1, node2, connectionType) 8 | } 9 | \arguments{ 10 | \item{dotModel}{The basic model} 11 | 12 | \item{node1}{The starting node} 13 | 14 | \item{node2}{The ending node} 15 | 16 | \item{connectionType}{The type of connection to add between nodes 1 and 2} 17 | } 18 | \description{ 19 | To do: add details 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/convert_to_filelist.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{convert_to_filelist} 4 | \alias{convert_to_filelist} 5 | \title{helper function to crawl over the target location, determine if it is a file or folder, 6 | then locate all .inp files, and convert them to absolute paths} 7 | \usage{ 8 | convert_to_filelist(target, filefilter = NULL, recursive = FALSE) 9 | } 10 | \arguments{ 11 | \item{target}{a character vector where each element is a directory containing Mplus input files 12 | (.inp) to run OR a single .inp file to be run. Elements may be a full path, relative path, 13 | or a filename within the working directory.} 14 | 15 | \item{filefilter}{An optional PCRE expression for filtering input files of interest} 16 | 17 | \item{recursive}{if TRUE, search for .inp files in subfolders of all elements of \code{target}} 18 | } 19 | \value{ 20 | A vector of .inp file locaitons 21 | } 22 | \description{ 23 | helper function to crawl over the target location, determine if it is a file or folder, 24 | then locate all .inp files, and convert them to absolute paths 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/createModels.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{createModels} 4 | \alias{createModels} 5 | \title{Create Mplus Input Files from Template} 6 | \usage{ 7 | createModels(templatefile) 8 | } 9 | \arguments{ 10 | \item{templatefile}{The filename (absolute or relative path) of an Mplus template file to be processed. Example \dQuote{C:/MplusTemplate.txt}} 11 | } 12 | \value{ 13 | No value is returned by this function. It is solely used to process an Mplus template file. 14 | } 15 | \description{ 16 | The \code{createModels} function processes a single Mplus template file and creates a group of related 17 | model input files. Definitions and examples for the template language are provided in the MplusAutomation 18 | vignette and are not duplicated here at the moment. See this documentation: \code{vignette("Vignette", package="MplusAutomation")} 19 | } 20 | \examples{ 21 | \dontrun{ 22 | createModels("L2 Multimodel Template No iter.txt") 23 | } 24 | } 25 | \author{ 26 | Michael Hallquist 27 | } 28 | \keyword{interface} 29 | -------------------------------------------------------------------------------- /man/createSyntax.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplus.R 3 | \name{createSyntax} 4 | \alias{createSyntax} 5 | \title{Create the Mplus input text for an mplusObject} 6 | \usage{ 7 | createSyntax(object, filename, check = TRUE, add = FALSE, imputed = FALSE) 8 | } 9 | \arguments{ 10 | \item{object}{An object of class mplusObject} 11 | 12 | \item{filename}{The name of the data file as a character vector} 13 | 14 | \item{check}{A logical indicating whether or not to run \code{parseMplus} 15 | on the created input file. Checks for errors like lines that are too long, 16 | or for missing semi-colons and gives notes.} 17 | 18 | \item{add}{A logical passed on to \code{parseMplus} whether to add semi 19 | colons to line ends. Defaults to \code{FALSE}.} 20 | 21 | \item{imputed}{A logical whether the data are multiply imputed. 22 | Defaults to \code{FALSE}.} 23 | } 24 | \value{ 25 | A character string containing all the text for the Mplus 26 | input file. 27 | } 28 | \description{ 29 | This function takes an object of class \code{mplusObject} and creates 30 | the Mplus input text corresponding to it, including data link and 31 | variable names. 32 | } 33 | \examples{ 34 | # example mplusObject 35 | example1 <- mplusObject(MODEL = "mpg ON wt;", 36 | usevariables = c("mpg", "hp"), rdata = mtcars) 37 | 38 | # create the Mplus input text 39 | cat(createSyntax(example1, "example1.dat"), file=stdout(), fill=TRUE) 40 | 41 | # update the object, then create input text 42 | cat(createSyntax(update(example1, 43 | TITLE = ~ "This is my title;", 44 | MODEL = ~ . + "\nmpg ON hp;", 45 | usevariables = c("mpg", "hp", "wt")), "example1.dat"), 46 | file=stdout(), 47 | fill=TRUE) 48 | rm(example1) 49 | } 50 | \seealso{ 51 | \code{\link{prepareMplusData}}, \code{\link{mplusModeler}} 52 | } 53 | \author{ 54 | Joshua F. Wiley 55 | } 56 | \keyword{interface} 57 | -------------------------------------------------------------------------------- /man/createVarSyntax.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/prepareMplusData.R 3 | \name{createVarSyntax} 4 | \alias{createVarSyntax} 5 | \title{Create Mplus syntax for variable names} 6 | \usage{ 7 | createVarSyntax(data) 8 | } 9 | \arguments{ 10 | \item{data}{An \code{R} dataset.} 11 | } 12 | \value{ 13 | A character vector of the variable names for Mplus 14 | } 15 | \description{ 16 | This is a simple function designed to take a dataset in \code{R} 17 | and translate it into a set of variable names for Mplus. 18 | } 19 | \examples{ 20 | MplusAutomation:::createVarSyntax(mtcars) 21 | } 22 | \seealso{ 23 | \code{\link{prepareMplusData}} 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/detectColumnNames.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{detectColumnNames} 4 | \alias{detectColumnNames} 5 | \title{Detect Column Names} 6 | \usage{ 7 | detectColumnNames(filename, modelSection, sectionType = "model_results") 8 | } 9 | \arguments{ 10 | \item{filename}{The file name} 11 | 12 | \item{modelSection}{The model section} 13 | 14 | \item{sectionType}{A character string. Defaults to \dQuote{model_results}.} 15 | } 16 | \value{ 17 | A list with elements for the directory, filename, 18 | and absolute path. 19 | } 20 | \description{ 21 | Helper function to detect model results columns. 22 | } 23 | \examples{ 24 | # make me!!! 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/detectMplus.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{detectMplus} 4 | \alias{detectMplus} 5 | \title{Detect the location/name of the Mplus command} 6 | \usage{ 7 | detectMplus() 8 | } 9 | \value{ 10 | A character string that is the Mplus command possibly the path to the mplus command or an error if it cannot be found. 11 | } 12 | \description{ 13 | This is an utility function to help detect the correct name/path to Mplus. 14 | It tries hard across operating systems to find Mplus and if it cannot find 15 | the full version of Mplus to find a demo version of Mplus. 16 | } 17 | \details{ 18 | It does not require any arguments. 19 | } 20 | \examples{ 21 | 22 | ## if you have Mplus installed, uncomment and run 23 | ## this will give an error if it cannot find Mplus. 24 | ## detectMplus() 25 | } 26 | \author{ 27 | Joshua F. Wiley 28 | } 29 | -------------------------------------------------------------------------------- /man/detectVariables.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplus.R 3 | \name{detectVariables} 4 | \alias{detectVariables} 5 | \title{Automatically detect variables from an Mplus model object} 6 | \usage{ 7 | detectVariables(object, quiet = TRUE) 8 | } 9 | \arguments{ 10 | \item{object}{An Mplus model object from \code{mplusObject}.#'} 11 | 12 | \item{quiet}{optional. If \code{TRUE}, show status messages in the console.} 13 | } 14 | \value{ 15 | A vector of variables from the R dataset to use. 16 | } 17 | \description{ 18 | This is a function to automatically detect the variables used in an 19 | Mplus model object. 20 | } 21 | \examples{ 22 | 23 | example1 <- mplusObject(MODEL = "mpg ON wt;", 24 | rdata = mtcars, autov = FALSE) 25 | example1$usevariables 26 | MplusAutomation:::detectVariables(example1) 27 | 28 | example2 <- mplusObject(MODEL = "mpg ON wt;", 29 | rdata = mtcars, autov = TRUE) 30 | example2$usevariables 31 | example3 <- update(example2, 32 | MODEL = ~ . + "mpg ON qsec; wt WITH qsec;", 33 | autov = TRUE) 34 | example3$usevariables 35 | rm(example1, example2, example3) 36 | } 37 | \seealso{ 38 | \code{\link{mplusModeler}}, \code{\link{mplusObject}} 39 | } 40 | \author{ 41 | Joshua F. Wiley 42 | } 43 | \keyword{internal} 44 | -------------------------------------------------------------------------------- /man/dhms_to_hours.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{dhms_to_hours} 4 | \alias{dhms_to_hours} 5 | \title{helper function to convert a dhms string to the number of hours for combining similar job times} 6 | \usage{ 7 | dhms_to_hours(str) 8 | } 9 | \arguments{ 10 | \item{str}{string in dhms format} 11 | } 12 | \value{ 13 | the number of hours represented by the dhms string 14 | } 15 | \description{ 16 | helper function to convert a dhms string to the number of hours for combining similar job times 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/divideIntoFields.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{divideIntoFields} 4 | \alias{divideIntoFields} 5 | \title{Divide text into fields} 6 | \usage{ 7 | divideIntoFields(section.text, required) 8 | } 9 | \arguments{ 10 | \item{section.text}{The section text} 11 | 12 | \item{required}{Required sections} 13 | } 14 | \value{ 15 | Divided sections 16 | } 17 | \description{ 18 | Helper function to divide an input section into key-value pair list taken from mplus2lavaan 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/dot-convertData.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/prepareMplusData.R 3 | \name{.convertData} 4 | \alias{.convertData} 5 | \title{Convert a matrix or data frame to numeric or integer for Mplus} 6 | \usage{ 7 | .convertData(df, dummyCode = NULL) 8 | } 9 | \arguments{ 10 | \item{df}{A matrix or data frame} 11 | } 12 | \value{ 13 | An error if it cannot be converted or 14 | a matrix or data frame with all variables converted to 15 | numeric or integer classes 16 | } 17 | \description{ 18 | Primarily an internal utility function, for \code{prepareMplusData}. 19 | } 20 | \examples{ 21 | 22 | \dontrun{ 23 | df1 <- df2 <- df3 <- df4 <- mtcars 24 | 25 | df2$cyl <- factor(df2$cyl) 26 | df2$am <- as.logical(df2$am) 27 | 28 | df3$mpg <- as.character(df3$mpg) 29 | 30 | df4$vs <- as.Date(df4$vs, origin = "1989-01-01") 31 | 32 | df5 <- as.matrix(cars) 33 | 34 | df6 <- matrix(c(TRUE, TRUE, FALSE, FALSE), ncol = 2) 35 | 36 | df7 <- as.list(mtcars) 37 | 38 | 39 | MplusAutomation:::.convertData(df1) 40 | 41 | MplusAutomation:::.convertData(df2) 42 | 43 | MplusAutomation:::.convertData(df3) 44 | 45 | MplusAutomation:::.convertData(df4) 46 | 47 | MplusAutomation:::.convertData(df5) 48 | 49 | MplusAutomation:::.convertData(df6) 50 | 51 | MplusAutomation:::.convertData(df7) 52 | 53 | rm(df1, df2, df3, df4, df5, df6, df7) 54 | } 55 | } 56 | \keyword{internal} 57 | -------------------------------------------------------------------------------- /man/dot-mplusMultinomial.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplusglm.R 3 | \name{.mplusMultinomial} 4 | \alias{.mplusMultinomial} 5 | \title{Internal Function for Multinomial Regression in Mplus} 6 | \usage{ 7 | .mplusMultinomial( 8 | dv, 9 | iv, 10 | data, 11 | idvar = "", 12 | integration = 1000, 13 | processors = 2, 14 | OR = TRUE, 15 | pairwise = TRUE, 16 | ... 17 | ) 18 | } 19 | \arguments{ 20 | \item{dv}{A character string with the variable name for the 21 | dependent (outcome) variable.} 22 | 23 | \item{iv}{A character vector with the variable name(s) for the 24 | independent (predictor/explanatory) variable(s).} 25 | 26 | \item{data}{A dataset.} 27 | 28 | \item{idvar}{Optional. A character string indicating the name 29 | of the ID variable. Not currently used but may be used in future.} 30 | 31 | \item{integration}{An integer indicating the number of Monte Carlo 32 | integration points to use. Defaults to 1000.} 33 | 34 | \item{processors}{An integer indicating the number of processors to 35 | use. Passed to Mplus. Defaults to 2.} 36 | 37 | \item{OR}{A logical value whether odds ratios should be returned. 38 | Defaults to \code{TRUE}.} 39 | 40 | \item{pairwise}{A logical value indicating whether all pairwise 41 | tests should be computed. Defaults to \code{TRUE}.} 42 | 43 | \item{...}{Additional arguments passed to \code{mplusModeler()}.} 44 | } 45 | \value{ 46 | A list of results and Mplus model object. 47 | } 48 | \description{ 49 | Internal Function for Multinomial Regression in Mplus 50 | } 51 | \examples{ 52 | \dontrun{ 53 | 54 | set.seed(1234) 55 | tmpd <- data.frame( 56 | x1 = rnorm(200), 57 | x2 = rnorm(200), 58 | x3 = cut(rnorm(200), 59 | breaks = c(-Inf, -.7, .7, Inf), 60 | labels = c("a", "b", "c"))) 61 | tmpd$y <- cut(rnorm(200, sd = 2) + tmpd$x1 + tmpd$x2 + I(tmpd$x3 == "b"), 62 | breaks = c(-Inf, -.5, 1, Inf), 63 | labels = c("L", "M", "H")) 64 | 65 | tmpres <- MplusAutomation:::.mplusMultinomial( 66 | dv = "y", 67 | iv = c("x1", "x2"), 68 | data = tmpd, 69 | pairwise = TRUE) 70 | tmpres2 <- MplusAutomation:::.mplusMultinomial( 71 | dv = "y", 72 | iv = c("x1", "x2"), 73 | data = tmpd, 74 | pairwise = FALSE) 75 | tmpres3 <- MplusAutomation:::.mplusMultinomial( 76 | dv = "y", 77 | iv = c("x1@0", "x2@0"), 78 | data = tmpd, 79 | pairwise = FALSE) 80 | 81 | } 82 | } 83 | \author{ 84 | Joshua F. Wiley 85 | } 86 | -------------------------------------------------------------------------------- /man/evaluateConditional.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{evaluateConditional} 4 | \alias{evaluateConditional} 5 | \title{Evaluate Conditional} 6 | \usage{ 7 | evaluateConditional(tag, initCollection) 8 | } 9 | \arguments{ 10 | \item{tag}{A tag} 11 | 12 | \item{initCollection}{The list of all arguments parsed from the init section} 13 | } 14 | \value{ 15 | A boolean value indicating whether the conditional is true 16 | } 17 | \description{ 18 | Note that at thie point the comparator must be a number (not another variable). 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/extract.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods.R 3 | \name{extract} 4 | \alias{extract} 5 | \alias{extract.mplus.model} 6 | \alias{extract.mplusObject} 7 | \alias{extract,mplus.model-method} 8 | \alias{extract,mplusObject-method} 9 | \title{Extract function to make Mplus output work with the \pkg{texreg} package} 10 | \usage{ 11 | extract.mplus.model( 12 | model, 13 | summaries = "none", 14 | cis = FALSE, 15 | escape.latex = FALSE, 16 | ... 17 | ) 18 | 19 | extract.mplusObject(model, summaries = "none", cis = FALSE, ...) 20 | 21 | \S4method{extract}{mplus.model}(model, summaries = "none", cis = FALSE, escape.latex = FALSE, ...) 22 | 23 | \S4method{extract}{mplusObject}(model, summaries = "none", cis = FALSE, ...) 24 | } 25 | \arguments{ 26 | \item{model}{An Mplus model object. This typically comes either from 27 | \code{\link{readModels}} directly, or indirectly via 28 | \code{\link{mplusModeler}}. The results will have different classes, 29 | but extract methods are defined for both.} 30 | 31 | \item{summaries}{A character vector which summaries to include. 32 | Defaults to \dQuote{none}.} 33 | 34 | \item{cis}{A logical whether to extract confidence intervals.} 35 | 36 | \item{escape.latex}{A logical value whether to escape dollar signs in 37 | coefficient names for LaTeX. Defaults to \code{FALSE}.} 38 | 39 | \item{...}{Additional arguments passed to \code{\link{coef.mplus.model}}.} 40 | } 41 | \value{ 42 | A \code{texreg} object, or for multiple group models, 43 | a list of \code{texreg} objects. 44 | } 45 | \description{ 46 | This is a method for extracting output in a format 47 | suitable for the \pkg{texreg} package. Uses \code{coef} for most the work. 48 | } 49 | \examples{ 50 | \dontrun{ 51 | # simple example of a model using builtin data 52 | # demonstrates use 53 | test <- mplusObject( 54 | TITLE = "test the MplusAutomation Package;", 55 | MODEL = " 56 | mpg ON wt hp; 57 | wt WITH hp;", 58 | OUTPUT = "STANDARDIZED;", 59 | usevariables = c("mpg", "wt", "hp"), 60 | rdata = mtcars) 61 | 62 | res <- mplusModeler(test, "mtcars.dat", modelout = "model1.inp", run = 1L) 63 | 64 | extract(res$results) 65 | # there is also a method for mplusObject class 66 | extract(res) 67 | 68 | # load the texreg package 69 | # to use pretty printing via screenreg 70 | # uncomment to run these examples 71 | # library(texreg) 72 | # screenreg(res) 73 | # screenreg(res, type = 'stdyx') 74 | 75 | # screenreg(res, type = 'un', params = 'regression', 76 | # single.row=TRUE) 77 | # screenreg(res, type = 'un', params = 'regression', summaries = 'CFI', 78 | # single.row=TRUE) 79 | 80 | # remove files 81 | unlink("mtcars.dat") 82 | unlink("model1.inp") 83 | unlink("model1.out") 84 | unlink("Mplus Run Models.log") 85 | } 86 | } 87 | \seealso{ 88 | \code{\link{readModels}} 89 | 90 | Other Mplus-Formatting: 91 | \code{\link{coef.mplus.model}()}, 92 | \code{\link{confint.mplus.model}()}, 93 | \code{\link{print.MplusRstructure}()}, 94 | \code{\link{summary.mplusObject}()} 95 | } 96 | \author{ 97 | Joshua F. Wiley 98 | } 99 | \concept{Mplus-Formatting} 100 | \keyword{interface} 101 | -------------------------------------------------------------------------------- /man/extractAux.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractAuxDis.R 3 | \name{extractAux} 4 | \alias{extractAux} 5 | \title{Extract Auxiliary condition means and comparisons.} 6 | \usage{ 7 | extractAux(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{character vector of Mplus output file from which to extract the AUX section} 11 | 12 | \item{filename}{filename of the Mplus output file being processed} 13 | } 14 | \value{ 15 | A data frame 16 | } 17 | \description{ 18 | To do: add details. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/extractClassCounts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractClassCounts} 4 | \alias{extractClassCounts} 5 | \title{Extract Latent Class Counts} 6 | \usage{ 7 | extractClassCounts(outfiletext, filename, summaries) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{The text of the output file} 11 | 12 | \item{filename}{The name of the output file} 13 | } 14 | \value{ 15 | a list 16 | } 17 | \description{ 18 | Function for extracting counts of latent classes 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/extractDataSummary.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractDataSummary} 4 | \alias{extractDataSummary} 5 | \title{Function to extract the SUMMARY OF DATA section from Mplus outputs} 6 | \usage{ 7 | extractDataSummary(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{The text of the output file} 11 | 12 | \item{filename}{the name of the file containing textToScan. Used to make more intelligible warning messages.} 13 | } 14 | \description{ 15 | Function to extract the SUMMARY OF DATA section from Mplus outputs 16 | } 17 | \keyword{internal} 18 | -------------------------------------------------------------------------------- /man/extractEFAparameters.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractEFAparameters.R 3 | \name{extractEFAparameters} 4 | \alias{extractEFAparameters} 5 | \title{Extract the model parameters from an EFA Mplus model output} 6 | \usage{ 7 | extractEFAparameters(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{character vector of Mplus output file being processed} 11 | 12 | \item{filename}{name of the output file} 13 | } 14 | \value{ 15 | list of parsed EFA parameters 16 | } 17 | \description{ 18 | Extract the model parameters from an EFA Mplus model output 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/extractFacScoreStats.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractFacScoreStats} 4 | \alias{extractFacScoreStats} 5 | \title{Extract Factor Score Statistics} 6 | \usage{ 7 | extractFacScoreStats(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{The text of the output file} 11 | 12 | \item{filename}{The name of the output file} 13 | } 14 | \value{ 15 | A list 16 | } 17 | \description{ 18 | Function for extracting matrices for factor scores 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \seealso{ 24 | \code{\link{matrixExtract}} 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/extractFreeFile.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractFreeFile} 4 | \alias{extractFreeFile} 5 | \title{Extract free file output} 6 | \usage{ 7 | extractFreeFile(filename, outfile, make_symmetric = TRUE) 8 | } 9 | \arguments{ 10 | \item{filename}{The name of the output file} 11 | 12 | \item{outfile}{The output file} 13 | 14 | \item{make_symmetric}{A logical indicating whether or not to make the matrix symmetric, defaults to \code{TRUE}} 15 | } 16 | \value{ 17 | a matrix 18 | } 19 | \description{ 20 | Function for reading "free" output where a sequence of values populates a matrix 21 | } 22 | \examples{ 23 | # make me!!! 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/extractIndirect.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractIndirect.R 3 | \name{extractIndirect} 4 | \alias{extractIndirect} 5 | \title{Extract Indirect Effects output} 6 | \usage{ 7 | extractIndirect(outfiletext, curfile) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{a character vector containing the indirect effects output section returned by getSection} 11 | 12 | \item{curfile}{the name of the current output file being parsed} 13 | } 14 | \value{ 15 | An mplus.indirect object (inherits list) containing $overall and $specific 16 | } 17 | \description{ 18 | This function parses both unstandardized and standardized indirect effects 19 | It returns a list composed of $unstandardized and $standardized. 20 | The base structure of each is a list containing $overall and $specific effects (as data.frames) 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/extractIndirect_section.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractIndirect.R 3 | \name{extractIndirect_section} 4 | \alias{extractIndirect_section} 5 | \title{Extract Indirect Effects output} 6 | \usage{ 7 | extractIndirect_section(indirectSection, curfile, sectionType) 8 | } 9 | \arguments{ 10 | \item{indirectSection}{a character vector containing the indirect effects for a specific section (e.g., stdyx)} 11 | 12 | \item{curfile}{the name of the current output file being parsed} 13 | } 14 | \value{ 15 | An mplus.indirect object (inherits list) containing $overall and $specific 16 | } 17 | \description{ 18 | This function parses a given indirect section 19 | It returns a list composed of $overall and $specific effects 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/extractInput_1file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractInput_1file} 4 | \alias{extractInput_1file} 5 | \title{Extract and parse Mplus input file} 6 | \usage{ 7 | extractInput_1file(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{The text of the output file} 11 | 12 | \item{filename}{The filename} 13 | } 14 | \value{ 15 | The parsed input file 16 | } 17 | \description{ 18 | Function to extract and parse mplus input syntax from the output file 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/extractModIndices.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractModIndices.R 3 | \name{extractModIndices} 4 | \alias{extractModIndices} 5 | \title{(DEPRECATED) Extract model modification indices.} 6 | \usage{ 7 | extractModIndices(target = getwd(), recursive = FALSE, filefilter) 8 | } 9 | \arguments{ 10 | \item{target}{the directory containing Mplus output files (.out) to parse OR 11 | the single output file to be parsed. May be a full path, relative path, or 12 | a filename within the working directory. Defaults to the current working 13 | directory. Example: \dQuote{C:/Users/Michael/Mplus Runs}} 14 | 15 | \item{recursive}{optional. If \code{TRUE}, parse all models 16 | nested in subdirectories within \code{target}. Defaults to 17 | \code{FALSE}.} 18 | 19 | \item{filefilter}{a Perl regular expression (PCRE-compatible) 20 | specifying particular output files to be parsed within \code{directory}. 21 | See \code{regex} or \url{http://www.pcre.org/pcre.txt} for 22 | details about regular expression syntax.} 23 | } 24 | \value{ 25 | If \code{target} is a single file, a data.frame 26 | containing modification results for the target output file will be 27 | returned. If \code{target} is a directory, a list will be returned, 28 | where each element contains a data.frame of the modification indices 29 | for a single file, and the top-level elements are named after the 30 | corresponding output file name. The basic \code{data.frame} containing 31 | the MODEL MODIFICATION INDICES section of \code{outfile}. Variables include 32 | \item{modV1}{The first variable in the pair to be freed according to the M.I.} 33 | \item{operator}{The suggested relationship between \code{modV1} and \code{modV2} 34 | (e.g., WITH for freeing the covariance between \code{modV1} and \code{modV2})} 35 | \item{modV2}{The first variable in the pair to be freed according to the M.I.} 36 | \item{MI}{The decrease in model chi-square if the specified relationship is freely estimated} 37 | \item{EPC}{The expected parameter estimate between \code{modV1} and \code{modV2} if freed.} 38 | \item{Std_EPC}{The EPC value standardized using the variances of the continuous latent variables.} 39 | \item{StdYX_EPC}{The EPC value standardized using the variances of the continuous latent 40 | variables as well as the variances of the background and/or outcome variables.} 41 | } 42 | \description{ 43 | Extracts the model modification indices from the MODEL MODIFICATION INDICES section of one 44 | or more Mplus output files. If the \code{target} is a directory, all .out files therein will be parsed 45 | and a single list will be returned, where the list elements are named by the output file name. 46 | Returned parameters typically include the pairwise relationships between variables to be freed, 47 | the change in model chi-square (M.I.), and the expected parameter change (E.P.C.). 48 | } 49 | \examples{ 50 | \dontrun{ 51 | ex3.14 <- extractModIndices( 52 | "C:/Program Files/Mplus/Mplus Examples/User's Guide Examples/ex3.14.out") 53 | } 54 | } 55 | \seealso{ 56 | \code{\link{readModels}}, \code{\link{extractModelSummaries}}, \code{\link{extractModelParameters}} 57 | } 58 | \author{ 59 | Michael Hallquist 60 | } 61 | \keyword{internal} 62 | -------------------------------------------------------------------------------- /man/extractModIndices_1chunk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractModIndices.R 3 | \name{extractModIndices_1chunk} 4 | \alias{extractModIndices_1chunk} 5 | \title{Extract Modification Indices for One Chunk (Section)} 6 | \usage{ 7 | extractModIndices_1chunk(chunk, columnNames, filename) 8 | } 9 | \arguments{ 10 | \item{chunk}{character vector of current subsection from which to extract mod indices} 11 | 12 | \item{columnNames}{character vector of expected column (variable) names for section} 13 | 14 | \item{filename}{name of Mplus output file being parsed} 15 | } 16 | \value{ 17 | A data frame 18 | } 19 | \description{ 20 | To do: add details. 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/extractModIndices_1file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractModIndices.R 3 | \name{extractModIndices_1file} 4 | \alias{extractModIndices_1file} 5 | \title{Extract Modification Indices for One File} 6 | \usage{ 7 | extractModIndices_1file(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{character vector of Mplus output file being processed} 11 | 12 | \item{filename}{name of Mplus output file being processed} 13 | } 14 | \value{ 15 | A data frame 16 | } 17 | \description{ 18 | To do: add details. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/extractParameters_1chunk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractParameters.R 3 | \name{extractParameters_1chunk} 4 | \alias{extractParameters_1chunk} 5 | \title{Extract Parameters for One Chunk} 6 | \usage{ 7 | extractParameters_1chunk(filename, thisChunk, columnNames, sectionName) 8 | } 9 | \arguments{ 10 | \item{filename}{name of Mplus output file being processed} 11 | 12 | \item{thisChunk}{character vector of output chunk from which to extract parameter values} 13 | 14 | \item{columnNames}{character vector of expected column names for output chunk} 15 | } 16 | \value{ 17 | A data frame (or matrix?) 18 | } 19 | \description{ 20 | Helper function for extractModelParameters. Used to parse each subsection of 21 | output within a given file and given results section (e.g., stdyx section) There 22 | will be many chunks if latent classes, multiple groups, multilevel features are used. 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/extractParameters_1file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractParameters.R 3 | \name{extractParameters_1file} 4 | \alias{extractParameters_1file} 5 | \title{Extract Parameters for One File} 6 | \usage{ 7 | extractParameters_1file(outfiletext, filename, resultType, efa = FALSE) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{character vector of Mplus output file being processed} 11 | 12 | \item{filename}{name of Mplus output file being processed} 13 | 14 | \item{resultType}{(deprecated)} 15 | 16 | \item{efa}{indicates whether the output is from an EFA model (requires some additional processing)} 17 | } 18 | \value{ 19 | A list of parameters 20 | } 21 | \description{ 22 | To do: add details 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/extractParameters_1section.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractParameters.R 3 | \name{extractParameters_1section} 4 | \alias{extractParameters_1section} 5 | \title{Extract Parameters for One Section} 6 | \usage{ 7 | extractParameters_1section(filename, modelSection, sectionName) 8 | } 9 | \arguments{ 10 | \item{filename}{name of Mplus output file being processed} 11 | 12 | \item{modelSection}{name of model output section being processed} 13 | 14 | \item{sectionName}{name of output type to search for (e.g., "model_results")} 15 | } 16 | \value{ 17 | A list of parameters 18 | } 19 | \description{ 20 | To do: add details 21 | } 22 | \examples{ 23 | \dontrun{ 24 | #a few examples of files to parse 25 | #mg + lc. Results in latent class pattern, not really different from 26 | # regular latent class matching. See Example 7.21 27 | #mg + twolevel. Group is top, bw/wi is 2nd. See Example 9.11 28 | #lc + twolevel. Bw/wi is top, lc is 2nd. See Example 10.1. 29 | # But categorical latent variables is even higher 30 | #test cases for more complex output: 7.21, 9.7, 9.11, 10.1 31 | } 32 | } 33 | \keyword{internal} 34 | -------------------------------------------------------------------------------- /man/extractR3step.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractAuxDis.R 3 | \name{extractR3step} 4 | \alias{extractR3step} 5 | \title{Extract output of R3STEP procedure} 6 | \usage{ 7 | extractR3step(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{character vector of Mplus output file from which to extract the AUX section} 11 | 12 | \item{filename}{filename of the Mplus output file being processed} 13 | } 14 | \value{ 15 | A list containing the parsed R3STEP sections 16 | } 17 | \description{ 18 | Extract output of R3STEP procedure 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/extractResiduals.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractResiduals} 4 | \alias{extractResiduals} 5 | \title{Extract residual matrices} 6 | \usage{ 7 | extractResiduals(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of the residual matrices 16 | } 17 | \description{ 18 | Function that extracts the residual matrices including standardized ones 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \seealso{ 24 | \code{\link{matrixExtract}} 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/extractResiduals_1section.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractResiduals_1section} 4 | \alias{extractResiduals_1section} 5 | \title{Helper subfunction to extract one section of OUTPUT: RESIDUALS 6 | Can be called multiple times, as in the case of invariance testing} 7 | \usage{ 8 | extractResiduals_1section(residSection, filename) 9 | } 10 | \arguments{ 11 | \item{residSection}{The character vector containing strings for the residual section to be parsed} 12 | 13 | \item{filename}{Character string containing the current output filename being parsed} 14 | } 15 | \description{ 16 | Helper subfunction to extract one section of OUTPUT: RESIDUALS 17 | Can be called multiple times, as in the case of invariance testing 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /man/extractSampstat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractSampstat} 4 | \alias{extractSampstat} 5 | \title{Helper function to extract the sample statistics from Mplus output 6 | Depends on OUTPUT: SAMPSTAT} 7 | \usage{ 8 | extractSampstat(outfiletext, filename) 9 | } 10 | \arguments{ 11 | \item{outfiletext}{The character vector containing all strings from output file} 12 | 13 | \item{filename}{The current out file being parsed} 14 | } 15 | \description{ 16 | Helper function to extract the sample statistics from Mplus output 17 | Depends on OUTPUT: SAMPSTAT 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /man/extractSummaries_1file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractSummaries_1file} 4 | \alias{extractSummaries_1file} 5 | \title{Extract the summaries from one file} 6 | \usage{ 7 | extractSummaries_1file(outfiletext, filename, input) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{This is the output file in string form to be parsed. Passed in from extractModelSummaries.} 11 | 12 | \item{filename}{Name of the file being parsed. Used in case of bad model, prints a warning.} 13 | } 14 | \value{ 15 | A list of the summaries 16 | } 17 | \description{ 18 | Description: This function parses an output file for specific model details. It returns a list of model details for a single output file. 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/extractSummaries_1plan.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractSummaries_1plan} 4 | \alias{extractSummaries_1plan} 5 | \title{Worker function used in extractSummaries_1section} 6 | \usage{ 7 | extractSummaries_1plan( 8 | arglist, 9 | sectionHeaders, 10 | sectionFields, 11 | textToParse, 12 | filename 13 | ) 14 | } 15 | \arguments{ 16 | \item{arglist}{The argument list} 17 | 18 | \item{sectionHeaders}{A character vector with headers for each section of interest} 19 | 20 | \item{sectionFields}{is a list of data.frames where each data.frame specifies the fields to be extracted for that section} 21 | 22 | \item{textToParse}{The text to parse} 23 | 24 | \item{filename}{The filename} 25 | } 26 | \value{ 27 | A list 28 | } 29 | \description{ 30 | Worker function used in extractSummaries_1section 31 | } 32 | \examples{ 33 | # make me!!! 34 | } 35 | \keyword{internal} 36 | -------------------------------------------------------------------------------- /man/extractSummaries_1section.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractSummaries_1section} 4 | \alias{extractSummaries_1section} 5 | \title{Extract summary information for one section from Mplus output} 6 | \usage{ 7 | extractSummaries_1section(modelFitSection, arglist, filename, input = list()) 8 | } 9 | \arguments{ 10 | \item{modelFitSection}{The fit information section} 11 | 12 | \item{arglist}{The argument list} 13 | 14 | \item{filename}{The file name} 15 | } 16 | \value{ 17 | The argument list 18 | } 19 | \description{ 20 | Function to extract model fit statistics from a section, wrapped to allow for multiple fit sections, as in EFA files. 21 | Calls \code{extractSummaries_1plan} 22 | } 23 | \examples{ 24 | # make me!!! 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/extractTech1.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech1} 4 | \alias{extractTech1} 5 | \title{Extract Technical 1 matrix from Mplus} 6 | \usage{ 7 | extractTech1(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of class \dQuote{mplus.tech1} 16 | } 17 | \description{ 18 | Function that extracts the Tech1 matrix 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \seealso{ 24 | \code{\link{matrixExtract}} 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/extractTech10.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech10} 4 | \alias{extractTech10} 5 | \title{Extract Technical 10 matrix from Mplus} 6 | \usage{ 7 | extractTech10(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | An empty list 16 | } 17 | \description{ 18 | Function that extracts the Tech10 matrix 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \seealso{ 24 | \code{\link{matrixExtract}} 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/extractTech12.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech12} 4 | \alias{extractTech12} 5 | \title{Extract Technical 12 from Mplus} 6 | \usage{ 7 | extractTech12(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of class \dQuote{mplus.tech12} 16 | } 17 | \description{ 18 | The TECH12 option is used in conjunction with TYPE=MIXTURE to request residuals for observed 19 | versus model estimated means, variances, covariances, univariate skewness, and univariate 20 | kurtosis. The observed values come from the total sample. The estimated values are computed as 21 | a mixture across the latent classes. 22 | } 23 | \examples{ 24 | # make me!!! 25 | } 26 | \seealso{ 27 | \code{\link{matrixExtract}} 28 | } 29 | \keyword{internal} 30 | -------------------------------------------------------------------------------- /man/extractTech15.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech15} 4 | \alias{extractTech15} 5 | \title{Extract Technical 15 from Mplus} 6 | \usage{ 7 | extractTech15(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of class \dQuote{mplus.tech15} 16 | } 17 | \description{ 18 | The TECH15 option is used in conjunction with TYPE=MIXTURE to request conditional probabilities 19 | for the latent class variables. 20 | } 21 | \examples{ 22 | # make me!!! 23 | } 24 | \seealso{ 25 | \code{\link{matrixExtract}} 26 | } 27 | \keyword{internal} 28 | -------------------------------------------------------------------------------- /man/extractTech3.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech3} 4 | \alias{extractTech3} 5 | \title{Extract Technical 3 matrix from Mplus} 6 | \usage{ 7 | extractTech3(outfiletext, savedata_info, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{savedata_info}{Information on saved data} 13 | 14 | \item{filename}{The name of the file} 15 | } 16 | \value{ 17 | A list of class \dQuote{mplus.tech3} 18 | } 19 | \description{ 20 | Function that extracts the Tech3 matrix 21 | } 22 | \examples{ 23 | # make me!!! 24 | } 25 | \seealso{ 26 | \code{\link{matrixExtract}} 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/extractTech4.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech4} 4 | \alias{extractTech4} 5 | \title{Extract Technical 4 matrix from Mplus} 6 | \usage{ 7 | extractTech4(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of class \dQuote{mplus.tech4} 16 | } 17 | \description{ 18 | Function that extracts the Tech4 matrix 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \seealso{ 24 | \code{\link{matrixExtract}} 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/extractTech7.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech7} 4 | \alias{extractTech7} 5 | \title{Extract Technical 7 from Mplus} 6 | \usage{ 7 | extractTech7(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of class \dQuote{mplus.tech7} 16 | } 17 | \description{ 18 | The TECH7 option is used in conjunction with TYPE=MIXTURE to request sample statistics 19 | for each class using raw data weighted by the estimated posterior probabilities for each class. 20 | } 21 | \examples{ 22 | # make me!!! 23 | } 24 | \seealso{ 25 | \code{\link{matrixExtract}} 26 | } 27 | \keyword{internal} 28 | -------------------------------------------------------------------------------- /man/extractTech8.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech8} 4 | \alias{extractTech8} 5 | \title{Extract Technical 8 from Mplus} 6 | \usage{ 7 | extractTech8(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of class \dQuote{mplus.tech8} 16 | } 17 | \description{ 18 | The TECH8 option is used to print the optimization history of a model. 19 | It also prints the potential scale reduction in Bayesian models. 20 | } 21 | \examples{ 22 | # make me!!! 23 | } 24 | \seealso{ 25 | \code{\link{matrixExtract}} 26 | } 27 | \keyword{internal} 28 | -------------------------------------------------------------------------------- /man/extractTech9.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractTech9} 4 | \alias{extractTech9} 5 | \title{Extract Technical 9 matrix from Mplus} 6 | \usage{ 7 | extractTech9(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{the text of the output file} 11 | 12 | \item{filename}{The name of the file} 13 | } 14 | \value{ 15 | A list of class \dQuote{mplus.tech9} 16 | } 17 | \description{ 18 | Function that extracts the Tech9 matrix 19 | } 20 | \examples{ 21 | # make me!!! 22 | } 23 | \seealso{ 24 | \code{\link{matrixExtract}} 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/extractValue.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractValue} 4 | \alias{extractValue} 5 | \title{Extract values from Mplus output 6 | An internal function used by extractSummaries_1file to extract 7 | parameters from the output file using regular expressions.} 8 | \usage{ 9 | extractValue(pattern, textToScan, filename, type = "int") 10 | } 11 | \arguments{ 12 | \item{pattern}{the exact text to be matched in the outfile that identifies the parameter of interest} 13 | 14 | \item{textToScan}{the chunk of Mplus output to be parsed, passed as a vector of character strings (from the scan command).} 15 | 16 | \item{filename}{the name of the file containing textToScan. Used to make more intelligible warning messages.} 17 | 18 | \item{type}{the data type of the parameter, which determines the regexp used. Currently can be \dQuote{int}, \dQuote{dec}, \dQuote{str}, or \dQuote{calc}. Defaults to \dQuote{int}.} 19 | } 20 | \value{ 21 | A string or numeric vector 22 | } 23 | \description{ 24 | Extract values from Mplus output 25 | An internal function used by extractSummaries_1file to extract 26 | parameters from the output file using regular expressions. 27 | } 28 | \examples{ 29 | #make me!!! 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/extractWarningsErrors_1file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{extractWarningsErrors_1file} 4 | \alias{extractWarningsErrors_1file} 5 | \title{Extract warnings and errors from 1 mplus file} 6 | \usage{ 7 | extractWarningsErrors_1file(outfiletext, filename, input) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{The text of the output file} 11 | 12 | \item{filename}{The filename} 13 | 14 | \item{input}{The input} 15 | } 16 | \value{ 17 | A list with two elements 18 | \item{errors}{Mplus Errors} 19 | \item{warnings}{Mplus Warnings} 20 | } 21 | \description{ 22 | Helper function 23 | } 24 | \examples{ 25 | # make me!!! 26 | } 27 | \keyword{internal} 28 | -------------------------------------------------------------------------------- /man/filter_inp_filelist.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{filter_inp_filelist} 4 | \alias{filter_inp_filelist} 5 | \title{helper function to filter a set of Mplus input files based on whether the corresponding .out file already exists} 6 | \usage{ 7 | filter_inp_filelist(inp_files, replaceOutfile = "always", quiet = TRUE) 8 | } 9 | \arguments{ 10 | \item{inp_files}{a vector of input file locations to check for corresponding .out files} 11 | 12 | \item{replaceOutfile}{optional. Currently supports three settings: \dQuote{always}, which 13 | runs all models, regardless of whether an output file for the model exists; \dQuote{never}, 14 | which does not run any model that has an existing output file; and \dQuote{modifiedDate}, which 15 | only runs a model if the modified date for the input file is more recent than 16 | the output file modified date (implying there have been updates to the model).} 17 | 18 | \item{quiet}{whether to print out text indicating what files were skipped} 19 | } 20 | \description{ 21 | helper function to filter a set of Mplus input files based on whether the corresponding .out file already exists 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/finalizeInitCollection.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{finalizeInitCollection} 4 | \alias{finalizeInitCollection} 5 | \title{Finalize Init Collection} 6 | \usage{ 7 | finalizeInitCollection(initCollection) 8 | } 9 | \arguments{ 10 | \item{initCollection}{The list of all arguments parsed from the init section} 11 | } 12 | \value{ 13 | Finalized initCollection 14 | } 15 | \description{ 16 | this function should handle initTags that still contain tags 17 | once the initCollection is finalized, then process the deferred body tags 18 | the notion is that the substitutions will be handled in an inefficient manner -- using lots 19 | of regular expression parsing, not using the matched tags data.frame 20 | } 21 | \details{ 22 | we only need to handle simple and array tags 23 | iterators should always be integers 24 | foreach and conditional are not relevant 25 | 26 | iterate over init tags until no tags are left 27 | here, the init collection should already have had most of its tags substituted by 28 | replaceInitTags above. 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /man/friendlyGregexpr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{friendlyGregexpr} 4 | \alias{friendlyGregexpr} 5 | \title{Friendly Regular Expression} 6 | \usage{ 7 | friendlyGregexpr(pattern, charvector, perl = TRUE, include_tag = TRUE) 8 | } 9 | \arguments{ 10 | \item{pattern}{The pattern to search for} 11 | 12 | \item{charvector}{Character vector} 13 | 14 | \item{perl}{A logical whether or not to use perl based 15 | regular expressions. Defaults to \code{TRUE}.} 16 | 17 | \item{include_tag}{if TRUE, return the match as a character string. This is the default, but 18 | setting to `FALSE` is a bit faster} 19 | } 20 | \value{ 21 | A \code{data.frame} 22 | } 23 | \description{ 24 | Creates data frame documenting the start and end of all tags. 25 | } 26 | \examples{ 27 | friendlyGregexpr("(BY|WITH|ON)", 28 | c("POS_WI BY", "X WITH Y WITH Z") 29 | ) 30 | } 31 | \author{ 32 | Michael Hallquist 33 | } 34 | \keyword{internal} 35 | -------------------------------------------------------------------------------- /man/getInitTags.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{getInitTags} 4 | \alias{getInitTags} 5 | \title{Get Initial Tags} 6 | \usage{ 7 | getInitTags(initCollection) 8 | } 9 | \arguments{ 10 | \item{initCollection}{A list?} 11 | } 12 | \value{ 13 | The initMatches 14 | } 15 | \description{ 16 | An internal function 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/getMultilineSection.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{getMultilineSection} 4 | \alias{getMultilineSection} 5 | \title{Extract a multiline section from Mplus output} 6 | \usage{ 7 | getMultilineSection( 8 | header, 9 | outfiletext, 10 | filename, 11 | allowMultiple = FALSE, 12 | allowSpace = TRUE, 13 | ignore.case = FALSE 14 | ) 15 | } 16 | \arguments{ 17 | \item{header}{Header section} 18 | 19 | \item{outfiletext}{Output file text} 20 | 21 | \item{filename}{The name of the file} 22 | 23 | \item{allowMultiple}{Logical indicating whether to allow multiple sections. Defaults to \code{FALSE}.} 24 | 25 | \item{allowSpace}{Logical indicating whether to allow spaces. Defaults to \code{TRUE}.} 26 | 27 | \item{ignore.case}{Logical whether or not to ignore the case. Defaults to \code{FALSE}.} 28 | } 29 | \value{ 30 | A list of sections 31 | } 32 | \description{ 33 | New approach to multiline section: retain spaces and look for next line that has identical indentation. 34 | } 35 | \examples{ 36 | # make me!!! 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/getOutFileList.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{getOutFileList} 4 | \alias{getOutFileList} 5 | \title{Get Output File List} 6 | \usage{ 7 | getOutFileList(target, recursive = FALSE, filefilter, pathfilter) 8 | } 9 | \arguments{ 10 | \item{target}{The target file or directory} 11 | 12 | \item{recursive}{A logical value whether to search recursively. 13 | Defaults to \code{FALSE}.} 14 | 15 | \item{filefilter}{A PCRE regular expression passed to \code{grep} 16 | used to filter the output files based on their file names} 17 | 18 | \item{pathfilter}{A PCRE regular expression passed to \code{grep} 19 | used to filter the output files based on their absolute paths} 20 | } 21 | \value{ 22 | A character vector of the output files 23 | } 24 | \description{ 25 | This is a helper function used by extractModelSummaries and extractModelParameters. 26 | It determines whether the target is a single file or a directory. 27 | If it is a directory, all .out files are returned (perhaps recursively) 28 | It also permits the files to be filtered using a certain regular expression. 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /man/getSavedata_Bparams.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractSaveData.R 3 | \name{getSavedata_Bparams} 4 | \alias{getSavedata_Bparams} 5 | \title{Load the draws from the Bayesian model posterior distribution (SAVEDATA BPARAMETERS) command into an R data.frame} 6 | \usage{ 7 | getSavedata_Bparams(outfile, discardBurnin = TRUE) 8 | } 9 | \arguments{ 10 | \item{outfile}{Required. The name of the Mplus output file to read. Can be an absolute or relative path. 11 | If \code{outfile} is a relative path or just the filename, then it is assumed that the file resides in 12 | the working directory \code{getwd()}.} 13 | 14 | \item{discardBurnin}{Optional. Whether to discard the burn-in phase of each MCMC chain (i.e., the first half).} 15 | } 16 | \value{ 17 | A \code{list} containing the draws from the MCMC chains for a Bayesian model that uses the 18 | SAVEDATA BPARAMETERS command. Each list element corresponds to a single MCMC chain, as specified by 19 | the ANALYSIS: CHAINS syntax in \code{Mplus}. If discardBurnin is \code{FALSE}, then a superordinate list is 20 | provided that divides output in terms of burn-in versus valid draw halves of the MCMC chains. For documentation 21 | of how \code{Mplus} implements chain convergence checks and MCMC draws, see here: \url{http://www.statmodel.com/download/Bayes3.pdf}. 22 | } 23 | \description{ 24 | This function reads a the BPARAMETERS output file from the Mplus SAVEDATA BPARAMETERS command 25 | and returns an R \code{data.frame} object. 26 | } 27 | \note{ 28 | Note that the \code{outfile} parameter should refer to the Mplus output file (.out extension), not the 29 | actual dataset generated by SAVEDATA. This function reads information about the dataset from the .out file 30 | and loads the dataset accordingly. 31 | } 32 | \examples{ 33 | \dontrun{ 34 | fileInfo <- getSavedata_Data("C:/Program Files/Mplus/Test Output.out") 35 | } 36 | } 37 | \references{ 38 | \url{http://www.statmodel.com/download/Bayes3.pdf} 39 | } 40 | \seealso{ 41 | \code{\link{getSavedata_Fileinfo}}, \code{\link{getSavedata_Data}} 42 | } 43 | \author{ 44 | Michael Hallquist, Florian Boeing-Messing 45 | } 46 | \keyword{internal} 47 | -------------------------------------------------------------------------------- /man/getSavedata_Data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractSaveData.R 3 | \name{getSavedata_Data} 4 | \alias{getSavedata_Data} 5 | \title{Load an analysis dataset from the SAVEDATA command into an R data.frame} 6 | \usage{ 7 | getSavedata_Data(outfile) 8 | } 9 | \arguments{ 10 | \item{outfile}{Required. The name of the Mplus output file to read. Can be an absolute or relative path. 11 | If \code{outfile} is a relative path or just the filename, then it is assumed that the file resides in 12 | the working directory \code{getwd()}.} 13 | } 14 | \value{ 15 | A \code{data.frame} containing the analysis dataset generated by the SAVEDATA command. 16 | } 17 | \description{ 18 | This function reads an analysis dataset generated by the Mplus SAVEDATA command 19 | and returns an R \code{data.frame} object. 20 | } 21 | \note{ 22 | Note that the \code{outfile} parameter should refer to the Mplus output file (.out extension), not the 23 | actual dataset generated by SAVEDATA. This function reads information about the dataset from the .out file 24 | and loads the dataset accordingly. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | savedat <- getSavedata_Data("C:/Program Files/Mplus/Test Output.out") 29 | } 30 | } 31 | \seealso{ 32 | \code{\link{getSavedata_Fileinfo}} 33 | } 34 | \author{ 35 | Michael Hallquist 36 | } 37 | \keyword{internal} 38 | -------------------------------------------------------------------------------- /man/getSavedata_Fileinfo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractSaveData.R 3 | \name{getSavedata_Fileinfo} 4 | \alias{getSavedata_Fileinfo} 5 | \title{Read Variable Names, Formats, and Widths from data generated by the SAVEDATA Command} 6 | \usage{ 7 | getSavedata_Fileinfo(outfile) 8 | } 9 | \arguments{ 10 | \item{outfile}{required. The name of the Mplus output file to read. Can be an absolute or relative path. 11 | If \code{outfile} is a relative path or just the filename, then it is assumed that the file resides in 12 | the working directory \code{getwd()}.} 13 | } 14 | \value{ 15 | Returns a list of SAVEDATA file information that includes: 16 | \item{fileName}{The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.} 17 | \item{fileVarNames}{A character vector containing the names of variables in the dataset.} 18 | \item{fileVarFormats}{A character vector containing the Fortran-style formats of variables in the dataset.} 19 | \item{fileVarWidths}{A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).} 20 | \item{bayesFile}{The name of the BPARAMETERS file containing draws from the posterior distribution created by 21 | the Mplus SAVEDATA BPARAMETERS command.} 22 | \item{bayesVarNames}{A character vector containing the names of variables in the BPARAMETERS dataset.} 23 | \item{tech3File}{A character vector of the tech 3 output.} 24 | \item{tech4File}{A character vector of the tech 4 output.} 25 | } 26 | \description{ 27 | This function reads the SAVEDATA INFORMATION section from an Mplus output file that used 28 | the SAVEDATA command, and it returns a list with the filename, variable names, variable formats, 29 | and variable widths of the SAVEDATA file. If present, the function also parses information about the 30 | Bayesian Parameters (BPARAMETERS) file. 31 | } 32 | \examples{ 33 | \dontrun{ 34 | fileInfo <- getSavedata_Fileinfo("C:/Program Files/Mplus/Test Output.out") 35 | } 36 | } 37 | \seealso{ 38 | \code{\link{getSavedata_Data}} 39 | } 40 | \author{ 41 | Michael Hallquist 42 | } 43 | \keyword{internal} 44 | -------------------------------------------------------------------------------- /man/getSavedata_readRawFile.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractSaveData.R 3 | \name{getSavedata_readRawFile} 4 | \alias{getSavedata_readRawFile} 5 | \title{Internal function to load the draws from the Bayesian model posterior distribution} 6 | \usage{ 7 | getSavedata_readRawFile( 8 | outfile, 9 | outfiletext, 10 | format = "fixed", 11 | fileName, 12 | varNames, 13 | varWidths, 14 | input 15 | ) 16 | } 17 | \arguments{ 18 | \item{outfile}{The Mplus output file to be used.} 19 | 20 | \item{outfiletext}{The contents of the Mplus output file} 21 | 22 | \item{format}{A character string indicating the format. Defaults to \dQuote{fixed}.} 23 | 24 | \item{fileName}{The name of the file} 25 | 26 | \item{varNames}{The names of the variables to extract, comes from the fileInfo} 27 | 28 | \item{varWidths}{The widths of the variables to extract, comes from the fileInfo} 29 | 30 | \item{input}{list of parsed Mplus input section extracted upstream in readModels} 31 | } 32 | \value{ 33 | A data frame of the extracted data. 34 | } 35 | \description{ 36 | This function is used by other extractor functions that read particular types of 37 | saved data such as factor scores or iterations from an MCMC chain. 38 | } 39 | \keyword{internal} 40 | -------------------------------------------------------------------------------- /man/getSection.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{getSection} 4 | \alias{getSection} 5 | \title{Get an Output Section} 6 | \usage{ 7 | getSection(sectionHeader, outfiletext, headers = "standard") 8 | } 9 | \arguments{ 10 | \item{sectionHeader}{Header section} 11 | 12 | \item{outfiletext}{Output file text} 13 | 14 | \item{headers}{Can pass custom headers but defaults to a standard set.} 15 | } 16 | \value{ 17 | Section 18 | } 19 | \description{ 20 | Get an Output Section 21 | } 22 | \examples{ 23 | # make me!!! 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/get_efa_nfactors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{get_efa_nfactors} 4 | \alias{get_efa_nfactors} 5 | \title{Small helper function to obtain number of factors for an EFA output section} 6 | \usage{ 7 | get_efa_nfactors(headers) 8 | } 9 | \arguments{ 10 | \item{headers}{a vector of EFA section headers from which to parse number of factors} 11 | } 12 | \value{ 13 | A vector of the number of factors in each heading, or a matrix if multilevel output 14 | } 15 | \description{ 16 | Small helper function to obtain number of factors for an EFA output section 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/get_job_status.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{get_job_status} 4 | \alias{get_job_status} 5 | \title{This function checks the status of one or more compute jobs} 6 | \usage{ 7 | get_job_status(job_ids, scheduler = "slurm", quiet = TRUE) 8 | } 9 | \arguments{ 10 | \item{job_ids}{One or more job ids of existing PBS or slurm jobs, or process ids of a local process for 11 | \code{scheduler="sh"}.} 12 | 13 | \item{scheduler}{What scheduler is used for job execution. 14 | Options: c("torque", "qsub", "slurm", "sbatch", "sh", "local")} 15 | 16 | \item{quiet}{If \code{TRUE}, \code{wait_for_job} will not print out any status updates on jobs. If \code{FALSE}, 17 | the function prints out status updates for each tracked job so that the user knows what's holding up progress.} 18 | } 19 | \value{ 20 | A vector of job statuses corresponding to each job id 21 | } 22 | \description{ 23 | This function checks the status of one or more compute jobs 24 | } 25 | \details{ 26 | Note that for the \code{scheduler} argument, "torque" and "qsub" are the same; 27 | "slurm" and "sbatch" are the same, and "sh" and "local" are the same. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | # example on qsub/torque cluster 32 | get_job_status("7968857.torque01.util.production.int.aci.ics.psu.edu", scheduler = "torque") 33 | 34 | # example of checking two jobs on slurm cluster 35 | get_job_status(c("24147864", "24147876"), scheduler = "slurm") 36 | 37 | # example of checking two jobs on local machine 38 | get_job_status(c("9843", "9844"), scheduler = "local") 39 | } 40 | 41 | } 42 | \author{ 43 | Michael Hallquist 44 | } 45 | \keyword{internal} 46 | -------------------------------------------------------------------------------- /man/graphModel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/graphModels.R 3 | \name{graphModel} 4 | \alias{graphModel} 5 | \title{Create a graphic model from Mplus} 6 | \usage{ 7 | graphModel(model) 8 | } 9 | \arguments{ 10 | \item{model}{The model} 11 | } 12 | \value{ 13 | a dot model 14 | } 15 | \description{ 16 | To do: add details 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/htmlout.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{htmlout} 4 | \alias{htmlout} 5 | \title{Read in Mplus Output File from HTML on the Mplus Website} 6 | \usage{ 7 | htmlout(url) 8 | } 9 | \arguments{ 10 | \item{url}{The url giving an Mplus output file in HTML format.} 11 | } 12 | \value{ 13 | A character string that is the filename where the output file was written. 14 | Always a temp file in a temp directory. 15 | } 16 | \description{ 17 | This is an internal utility function to help with testing MplusAutomation. 18 | On the Mplus website, many output files are included, which are good tests. 19 | However, they are stored in HTML files. This function reads them in, 20 | strips the HTML parts leaving just the output file, and then writes it to 21 | disk and returns the file name, which can be used with \code{readModels()} 22 | for testing. 23 | } 24 | \examples{ 25 | 26 | MplusAutomation:::htmlout("https://statmodel.com/usersguide/chap3/ex3.1.html") 27 | } 28 | \author{ 29 | Joshua F. Wiley 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/isEmpty.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{isEmpty} 4 | \alias{isEmpty} 5 | \title{Check whether a useable function argument was provided} 6 | \usage{ 7 | isEmpty(arg) 8 | } 9 | \arguments{ 10 | \item{arg}{A function argument} 11 | } 12 | \value{ 13 | Logical vector of length 1. 14 | } 15 | \description{ 16 | This is a simple utility to check whether a function argument is missing, 17 | \code{NULL}, or has only \code{NA}s. 18 | } 19 | \examples{ 20 | \dontrun{ 21 | f1 <- function(x) { 22 | if (!isEmpty(x)) return(mean(x, na.rm = TRUE)) 23 | return(NULL) 24 | } 25 | 26 | f1() #> NULL 27 | f1(x = NA) #> NULL 28 | f1(x = NULL) #> NULL 29 | f1(x = c(NA, 1:2)) #> 1.5 30 | } 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/l_getSavedata_Bparams.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractSaveData.R 3 | \name{l_getSavedata_Bparams} 4 | \alias{l_getSavedata_Bparams} 5 | \title{Internal function to load the draws from the Bayesian model posterior distribution} 6 | \usage{ 7 | l_getSavedata_Bparams(outfile, outfiletext, fileInfo, discardBurnin = TRUE) 8 | } 9 | \arguments{ 10 | \item{outfile}{The Mplus output file to be used.} 11 | 12 | \item{outfiletext}{The contents of the Mplus output file} 13 | 14 | \item{fileInfo}{The file info} 15 | 16 | \item{discardBurnin}{Logical value whether to discard the burnin iterations or not. Defaults to \code{TRUE}.} 17 | } 18 | \value{ 19 | A list of class \code{mcmc} and \code{mplus.bparameters} 20 | } 21 | \description{ 22 | To do: add details. 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/l_getSavedata_Fileinfo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractSaveData.R 3 | \name{l_getSavedata_Fileinfo} 4 | \alias{l_getSavedata_Fileinfo} 5 | \title{local function that does the work of getSaveData_Fileinfo} 6 | \usage{ 7 | l_getSavedata_Fileinfo(outfile, outfiletext, summaries) 8 | } 9 | \arguments{ 10 | \item{outfile}{A character string giving the name of the Mplus 11 | output file.} 12 | 13 | \item{outfiletext}{The contents of the output file, for example as read by \code{scan}} 14 | } 15 | \value{ 16 | A list that includes: 17 | \item{fileName}{The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.} 18 | \item{fileVarNames}{A character vector containing the names of variables in the dataset.} 19 | \item{fileVarFormats}{A character vector containing the Fortran-style formats of variables in the dataset.} 20 | \item{fileVarWidths}{A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).} 21 | \item{bayesFile}{The name of the BPARAMETERS file containing draws from the posterior distribution created by 22 | the Mplus SAVEDATA BPARAMETERS command.} 23 | \item{bayesVarNames}{A character vector containing the names of variables in the BPARAMETERS dataset.} 24 | \item{tech3File}{A character vector of the tech 3 output.} 25 | \item{tech4File}{A character vector of the tech 4 output.} 26 | } 27 | \description{ 28 | This function is split out so that \code{getSaveData_Fileinfo} is 29 | exposed to the user, but the parsing function can be used by 30 | \code{readModels} 31 | } 32 | \examples{ 33 | # make me! 34 | } 35 | \seealso{ 36 | \code{\link{getSavedata_Data}} 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/lcademo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{lcademo} 5 | \alias{lcademo} 6 | \title{Latent Class Analysis Demonstration} 7 | \format{ 8 | A list containing 11 elements. 9 | \describe{ 10 | \item{Data}{2 Class LCA data simulated using Mplus} 11 | \item{CFA}{Mplus output file for CFA} 12 | \item{LCA2}{Mplus output file for 2 class LCA} 13 | \item{LCA3}{Mplus output file for 3 class LCA} 14 | \item{LCA4}{Mplus output file for 4 class LCA} 15 | \item{LCA5}{Mplus output file for 5 class LCA} 16 | \item{CFAGH5}{GH5 file for CFA} 17 | \item{LCA2GH5}{GH5 file for 2 class LCA} 18 | \item{LCA3GH5}{GH5 file for 3 class LCA} 19 | \item{LCA4GH5}{GH5 file for 4 class LCA} 20 | \item{LCA5GH5}{GH5 file for 5 class LCA} 21 | } 22 | } 23 | \usage{ 24 | lcademo 25 | } 26 | \description{ 27 | A list containing the Mplus Data, Output Files, and GH5 Files for a 28 | demonstration of using MplusAutomation for latent class analysis. 29 | Generated by the vignette on latent class analysis. 30 | } 31 | \keyword{datasets} 32 | -------------------------------------------------------------------------------- /man/local_job_status.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{local_job_status} 4 | \alias{local_job_status} 5 | \title{helper function to get job status on local *nix-based machine} 6 | \usage{ 7 | local_job_status( 8 | job_ids = NULL, 9 | user = NULL, 10 | ps_format = "user,pid,state,time,etime,\%cpu,\%mem,comm,xstat" 11 | ) 12 | } 13 | \arguments{ 14 | \item{job_ids}{a vector of job ids (process IDs) to check} 15 | 16 | \item{user}{the user who owns the processes (defaults to current user)} 17 | 18 | \item{ps_format}{the format string passed to ps} 19 | } 20 | \value{ 21 | a data.table with job information for each job id 22 | } 23 | \description{ 24 | helper function to get job status on local *nix-based machine 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/lookupSimpleTags.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{lookupSimpleTags} 4 | \alias{lookupSimpleTags} 5 | \title{Simple tag lookup} 6 | \usage{ 7 | lookupSimpleTags(templateTags, initCollection) 8 | } 9 | \arguments{ 10 | \item{templateTags}{The template tags} 11 | 12 | \item{initCollection}{The initial collection} 13 | } 14 | \value{ 15 | A tag. 16 | } 17 | \description{ 18 | The purpose of this function is to set the currentValue column 19 | for the bodyTags and initTags data.frames for simple tags only. 20 | Most values will be replaced at the bottom level of recursion, 21 | but simple tags do not change over iterations, so can be set one time. 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/lookupTech1Parameter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{lookupTech1Parameter} 4 | \alias{lookupTech1Parameter} 5 | \title{Lookup the matrix element for a give parameter number} 6 | \usage{ 7 | lookupTech1Parameter(tech1Output, paramNumber) 8 | } 9 | \arguments{ 10 | \item{tech1Output}{The object corresponding to the TECH1 parameter specification from readModels.} 11 | 12 | \item{paramNumber}{The parameter number to lookup} 13 | } 14 | \value{ 15 | A \code{data.frame} containing the row(s) and column(s) of TECH1 parameter specification matching 16 | the requested \code{paramNumber}. 17 | } 18 | \description{ 19 | The \code{lookupTech1Parameter} function identifies the position in the Mplus model 20 | matrices corresponding to a given parameter defined in the TECHNICAL 1 PARAMETER 21 | SPECIFICATION OUTPUT. The goal of this function is to aid in identifying problematic parameters 22 | often printed in the warnings and errors section of Mplus output. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | models <- readModels("test1.out") 27 | param <- lookupTech1Parameter(models$tech1, 16) 28 | } 29 | } 30 | \seealso{ 31 | \code{\link{readModels}} 32 | } 33 | \author{ 34 | Michael Hallquist 35 | } 36 | \keyword{interface} 37 | -------------------------------------------------------------------------------- /man/lookupValue.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{lookupValue} 4 | \alias{lookupValue} 5 | \title{Lookup values} 6 | \usage{ 7 | lookupValue(tag, tagType, initCollection) 8 | } 9 | \arguments{ 10 | \item{tag}{name of tag for which we want to know the current value} 11 | 12 | \item{tagType}{type of tag (simple, array, etc.) for the tag to lookup} 13 | 14 | \item{initCollection}{The list of all arguments parsed from the init section} 15 | } 16 | \value{ 17 | Current value 18 | } 19 | \description{ 20 | To do: fill in some details 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/matrixExtract.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{matrixExtract} 4 | \alias{matrixExtract} 5 | \title{Reconstruct matrix from multi-line text output} 6 | \usage{ 7 | matrixExtract( 8 | outfiletext, 9 | headerLine, 10 | filename, 11 | ignore.case = FALSE, 12 | expect_sig = FALSE 13 | ) 14 | } 15 | \arguments{ 16 | \item{outfiletext}{The text of the output file} 17 | 18 | \item{headerLine}{The header line} 19 | 20 | \item{filename}{The name of the output file} 21 | 22 | \item{ignore.case}{Whether to ignore case of header line} 23 | 24 | \item{expect_sig}{Whether to track value significance TRUE/FALSE (* in Mplus) as an attribute} 25 | } 26 | \value{ 27 | a matrix 28 | } 29 | \description{ 30 | main worker function for extracting Mplus matrix output 31 | where matrices are spread across blocks to keep within width constraints 32 | example: tech1 matrix output. 33 | } 34 | \examples{ 35 | # make me!!! 36 | } 37 | \keyword{internal} 38 | -------------------------------------------------------------------------------- /man/minutes_to_dhms.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{minutes_to_dhms} 4 | \alias{minutes_to_dhms} 5 | \title{helper function to convert a number of minutes into a dhms-formatted string for submission} 6 | \usage{ 7 | minutes_to_dhms(x) 8 | } 9 | \arguments{ 10 | \item{x}{string or charcater number of minutes} 11 | } 12 | \value{ 13 | the dhms string representing this number of minutes in days, hours, minutes, and seconds 14 | } 15 | \description{ 16 | helper function to convert a number of minutes into a dhms-formatted string for submission 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/mixtureSummaryTable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mixtures.R 3 | \name{mixtureSummaryTable} 4 | \alias{mixtureSummaryTable} 5 | \title{Create a summary table of Mplus mixture models} 6 | \usage{ 7 | mixtureSummaryTable( 8 | modelList, 9 | keepCols = c("Title", "Classes", "Warnings", "AIC", "BIC", "aBIC", "Entropy", 10 | "T11_VLMR_PValue", "T11_LMR_PValue", "BLRT_PValue", "min_N", "max_N", "min_prob", 11 | "max_prob"), 12 | sortBy = NULL, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{modelList}{A list of models returned from the 18 | \code{extractModelSummaries} function.} 19 | 20 | \item{keepCols}{A vector of character strings indicating which 21 | columns/variables to display in the summary. Only columns included in this 22 | list will be displayed (all others excluded). By default, \code{keepCols} is: 23 | \code{c("Title", "Classes", "Warnings", "AIC", "BIC", "aBIC","Entropy", 24 | "T11_VLMR_PValue", "T11_LMR_PValue", "BLRT_PValue", "min_N", "max_N", 25 | "min_prob", "max_prob")}.} 26 | 27 | \item{sortBy}{Field name (as character string) by which to sort the 28 | table. Typically an information criterion (e.g., "AIC" or "BIC") is used to 29 | sort the table. Defaults to "AICC". Set to NULL by default, so the table is 30 | ordered by increasing number of classes.} 31 | 32 | \item{...}{Arguments passed to \code{\link{SummaryTable}}.} 33 | } 34 | \value{ 35 | An object of class data.frame. 36 | } 37 | \description{ 38 | Creates a summary table of model fit statistics and relevant diagnostic 39 | information for a list of mixture models. Default statistics reported are in 40 | line with published guidelines (see Jung & Wickrama, 2008; Nylund et al., 41 | 2007): \code{c("Title", "Classes", "Warnings", "AIC", "BIC", "aBIC", 42 | "Entropy", "T11_VLMR_PValue", "T11_LMR_PValue", "BLRT_PValue", "min_N", 43 | "max_N", "min_prob", "max_prob")}. The table is customizable using the 44 | \code{keepCols} parameter, which is passed through to \link{SummaryTable}. 45 | } 46 | \note{ 47 | This function is partially a wrapper around SummaryTable, with 48 | enhancements for summarizing mixture models. 49 | } 50 | \examples{ 51 | \dontrun{ 52 | res <- createMixtures(classes = 1:2, filename_stem = "iris", rdata = iris, 53 | OUTPUT = "tech11 tech14;", 54 | run = 1L) 55 | mixtureSummaryTable(res) 56 | } 57 | } 58 | \seealso{ 59 | \code{\link{SummaryTable}} 60 | } 61 | \author{ 62 | Caspar J. van Lissa 63 | } 64 | \keyword{mixture} 65 | \keyword{mplus} 66 | -------------------------------------------------------------------------------- /man/mplus.traceplot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/graphModels.R 3 | \name{mplus.traceplot} 4 | \alias{mplus.traceplot} 5 | \title{Plot the samples for each MCMC chain as a function of iterations} 6 | \usage{ 7 | mplus.traceplot(mplus.model, rows = 4, cols = 4, parameters_only = TRUE) 8 | } 9 | \arguments{ 10 | \item{mplus.model}{An Mplus model extracted by the \code{readModels} function.} 11 | 12 | \item{rows}{Number of rows to display per plot.} 13 | 14 | \item{cols}{Optional. Number of columns to display per plot.} 15 | 16 | \item{parameters_only}{Optional. If TRUE, only the unstandardized parameter estimates from the MCMC 17 | draws will be displayed (as opposed to standardized estimates, r-square estimates, etc.). 18 | The unstandardized estimates all begin with "Parameter" in the Mplus gh5 output.} 19 | } 20 | \value{ 21 | No value is returned by this function. 22 | Called for the side effect of displaying an MCMC chains traceplot. 23 | } 24 | \description{ 25 | Displays a traceplot of the MCMC draws from the poster distribution of each parameter estimate for a Bayesian Mplus model. 26 | This function requires that 1) PLOT: TYPE=PLOT2; be included in the Mplus input file, 2) a gh5 file be present corresponding 27 | to the Mplus output file (and containing a bayesian_data section), and 3) that the rhdf5 package be installed to allow 28 | the gh5 file to be imported. 29 | } 30 | \details{ 31 | A multi-panel plot is drawn to the screen and the user is prompted to display the next plot if more than rows x columns estimates are 32 | in the model. 33 | } 34 | \note{ 35 | Trace and density plots can also be obtained using the coda package and the bparameters 36 | element of the mplus.model object. This requires that the posterior draws 37 | be saved using SAVEDATA: BPARAMETERS syntax. See example below. 38 | } 39 | \examples{ 40 | \dontrun{ 41 | myModel <- readModels("BayesModel_WithGH5MCMC.out") 42 | mplus.traceplot(myModel, rows=2, cols=3) 43 | 44 | #alternative using the coda package 45 | library(coda) 46 | plot(myModel$bparameters$valid_draw) 47 | } 48 | } 49 | \seealso{ 50 | \code{\link{plot.mcmc}} 51 | } 52 | \author{ 53 | Joseph Glass, Michael Hallquist 54 | } 55 | \keyword{interface} 56 | -------------------------------------------------------------------------------- /man/mplusAvailable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{mplusAvailable} 4 | \alias{mplusAvailable} 5 | \title{Check whether Mplus can be found} 6 | \usage{ 7 | mplusAvailable(silent = TRUE) 8 | } 9 | \arguments{ 10 | \item{silent}{A logical whether to print a message or not. 11 | Defaults to \code{TRUE} for silent operation.} 12 | } 13 | \value{ 14 | The status of finding Mplus. Per unix conventions, 15 | status 0 indicates Mplus was found (0 problems) and 16 | status 1 indicates that Mplus was not found. 17 | } 18 | \description{ 19 | This is a simple utility to check whether Mplus can be found. 20 | Returns 0 if Mplus command can be found by the system. 21 | If \code{silent = FALSE}, prints a message to the user 22 | to help suggest what to do. 23 | } 24 | \examples{ 25 | 26 | mplusAvailable(silent = TRUE) 27 | mplusAvailable(silent = FALSE) 28 | } 29 | \author{ 30 | Joshua Wiley 31 | } 32 | \keyword{interface} 33 | -------------------------------------------------------------------------------- /man/mplusGLM.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplusglm.R 3 | \name{mplusGLM} 4 | \alias{mplusGLM} 5 | \title{Function to fit GLMs in Mplus} 6 | \usage{ 7 | mplusGLM(formula, data, idvar = "", ...) 8 | } 9 | \arguments{ 10 | \item{formula}{An R formula class object as used in \code{glm()}. 11 | Note that currently, only basic formula are accepted. On the fly 12 | recoding, arthimetic, and on the fly interactions do not currently 13 | work.} 14 | 15 | \item{data}{A dataset.} 16 | 17 | \item{idvar}{Optional. A character string indicating the name 18 | of the ID variable. Not currently used but may be used in future.} 19 | 20 | \item{...}{Additional arguments passed to helper functions. 21 | For example \code{.mplusMultinomial()}.} 22 | } 23 | \value{ 24 | A list of results and Mplus model object. 25 | } 26 | \description{ 27 | The purpose of this function is to make it (relatively) easy to fit 28 | (most) generalized linear models in Mplus. Fitting GLMs in Mplus 29 | offers advantages such as using full information maximum likelihood 30 | for missing data, robust estimators (default used is MLR), 31 | and standard errors adjusted for clustering (planned; not currently 32 | available via \code{mplusGLM()}. The overarching aim of this function 33 | is to make most GLMs as easy to fit in Mplus as they are in R. 34 | } 35 | \details{ 36 | Note that although there are benefits to fitting GLMs in Mplus. 37 | Caution also is warranted. Using full information maximum likelihood 38 | for missing data requires a number of assumptions. These may be (badly) 39 | violated. \code{mplusGLM()} requires the analyst to check these as 40 | appropriate. 41 | 42 | Currently, \code{mplusGLM()} only supports multinomial outcomes. 43 | More outcomes are planned in the future including binary, 44 | continuous/normal, and count outcomes. 45 | } 46 | \examples{ 47 | \dontrun{ 48 | set.seed(1234) 49 | tmpd <- data.frame( 50 | x1 = rnorm(200), 51 | x2 = rnorm(200), 52 | x3 = cut(rnorm(200), 53 | breaks = c(-Inf, -.7, .7, Inf), 54 | labels = c("a", "b", "c"))) 55 | tmpd$y <- cut(rnorm(200, sd = 2) + tmpd$x1 + tmpd$x2 + I(tmpd$x3 == "b"), 56 | breaks = c(-Inf, -.5, 1, Inf), 57 | labels = c("L", "M", "H")) 58 | test <- mplusGLM(y ~ x1 + x2 + x3, data = tmpd) 59 | } 60 | } 61 | \author{ 62 | Joshua F. Wiley 63 | } 64 | -------------------------------------------------------------------------------- /man/mplusModel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplusModel.R 3 | \name{mplusModel} 4 | \alias{mplusModel} 5 | \title{Create an mplusModel object for a given model} 6 | \usage{ 7 | mplusModel(syntax = NULL, data = NULL, inp_file = NULL, read = TRUE) 8 | } 9 | \arguments{ 10 | \item{syntax}{a character vector of Mplus input syntax for this model} 11 | 12 | \item{data}{a data.frame to be used for estimating the model} 13 | 14 | \item{inp_file}{the location of .inp file for this model} 15 | 16 | \item{read}{If TRUE and the .out file already exists, read the contents of the .out file using `readModels`} 17 | } 18 | \value{ 19 | a `mplusModel_r6` object containing information about the model 20 | } 21 | \description{ 22 | Create an mplusModel object for a given model 23 | } 24 | -------------------------------------------------------------------------------- /man/mplus_as.numeric.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{mplus_as.numeric} 4 | \alias{mplus_as.numeric} 5 | \title{Convert Mplus Number to Numeric} 6 | \usage{ 7 | mplus_as.numeric(vec, expect_sig = FALSE) 8 | } 9 | \arguments{ 10 | \item{vec}{A character vector of Mplus numbers 11 | to convert to numeric} 12 | 13 | \item{expect_sig}{Whether to expect significance values denoted by asterisk; 14 | yields a 'sig' attribute that will be TRUE/FALSE} 15 | } 16 | \value{ 17 | A numeric vector 18 | } 19 | \description{ 20 | Helper function to convert strings formatted in Mplus 21 | Fortran-style scientific notation using D to indicate double. 22 | } 23 | \examples{ 24 | MplusAutomation:::mplus_as.numeric("3.1D2") 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/paramExtract.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplus.R 3 | \name{paramExtract} 4 | \alias{paramExtract} 5 | \title{Extract parameters from a data frame of Mplus estimates} 6 | \usage{ 7 | paramExtract( 8 | x, 9 | params = c("regression", "loading", "undirected", "expectation", "variability", "new") 10 | ) 11 | } 12 | \arguments{ 13 | \item{x}{A data frame (specifically the type returned by \code{readModels}) containing 14 | parameters. Should be specific such as unstandardized and the data frame must have a 15 | column called \sQuote{paramHeader}.} 16 | 17 | \item{params}{A character string indicating the types of parameters to be returned. 18 | Options currently include \sQuote{regression}, \sQuote{loading}, \sQuote{undirected}, 19 | \sQuote{expectation}, \sQuote{variability}, and \sQuote{new} for new/additional parameters. 20 | Regressions include regression of one variable 21 | \code{ON} another. \sQuote{loading} include indicator variables (which are assumed caused by the 22 | underlying latent variable) and variables in latent growth models (\code{BY} or \code{|}). 23 | Undirected paths currently only include covariances, indicated by the \code{WITH} 24 | syntax in Mplus. Expectation paths are the unconditional or conditional expectations of 25 | variables. In other words those parameters related to the first moments. For independent 26 | variables, these are the means, \eqn{E(X)} and the conditional means or intercepts, 27 | \eqn{E(X | f(\theta))}{E(X | f(theta))} where \eqn{f(\theta)}{f(theta)} is the model, 28 | some function of the parameters, \eqn{\theta}{theta}. Finally \sQuote{variability} 29 | refers to both variances and residual variances, corresponding to the second moments. 30 | As with the expectations, variances are unconditional for variables that are not 31 | predicted or conditioned on any other variable in the model whereas residual variances 32 | are conditional on the model. Note that \R uses fuzzy matching so that each of these 33 | can be called via shorthand, \sQuote{r}, \sQuote{l}, \sQuote{u}, \sQuote{e}, and \sQuote{v}.} 34 | } 35 | \value{ 36 | A subset data frame with the parameters of interest. 37 | } 38 | \description{ 39 | This is a simple convenience function designed to facilitate 40 | looking at specific parameter types by easily return a subset 41 | of a data frame with those types only. It is designed to follow up 42 | the results returned from the \code{\link{readModels}} function. 43 | } 44 | \examples{ 45 | \dontrun{ 46 | test <- mplusObject( 47 | TITLE = "test the MplusAutomation Package and my Wrapper;", 48 | MODEL = " 49 | mpg ON wt hp; 50 | wt WITH hp;", 51 | usevariables = c("mpg", "wt", "hp"), 52 | rdata = mtcars) 53 | 54 | res <- mplusModeler(test, "mtcars.dat", modelout = "model1.inp", run = 1L) 55 | 56 | # store just the unstandardized parameters in 'd' 57 | d <- res$results$parameters$unstandardized 58 | # extract just regression parameters 59 | paramExtract(d, "regression") 60 | # extract other types of parameters using shorthand 61 | paramExtract(d, "u") 62 | paramExtract(d, "e") 63 | paramExtract(d, "v") 64 | } 65 | } 66 | \seealso{ 67 | \code{\link{readModels}} 68 | } 69 | \author{ 70 | Joshua F. Wiley 71 | } 72 | \keyword{utils} 73 | -------------------------------------------------------------------------------- /man/parseCatOutput.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{parseCatOutput} 4 | \alias{parseCatOutput} 5 | \title{Parse Categorical Output} 6 | \usage{ 7 | parseCatOutput(text) 8 | } 9 | \arguments{ 10 | \item{text}{The output to parse.} 11 | } 12 | \value{ 13 | The parsed output 14 | } 15 | \description{ 16 | Helper function for parsing output with variables and categories. 17 | } 18 | \examples{ 19 | " 20 | Example: 21 | UNIVARIATE PROPORTIONS AND COUNTS FOR CATEGORICAL VARIABLES 22 | 23 | SOP2A 24 | Category 1 0.254 631.000 25 | Category 2 0.425 1056.000 26 | Category 3 0.174 432.000 27 | Category 4 0.147 365.000 28 | 29 | Or Item Categories in IRT Parameterization 30 | 31 | Item Categories 32 | U1 33 | Category 1 0.000 0.000 0.000 1.000 34 | Category 2 -0.247 0.045 -5.534 0.000 35 | Category 3 0.699 0.052 13.325 0.000 36 | Category 4 -0.743 0.057 -12.938 0.000 37 | Category 5 0.291 0.052 5.551 0.000 38 | " 39 | } 40 | \author{ 41 | Michael Hallquist 42 | } 43 | \keyword{interface} 44 | -------------------------------------------------------------------------------- /man/parseMplus.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplus.R 3 | \name{parseMplus} 4 | \alias{parseMplus} 5 | \title{Check Mplus code for missing semicolons or too long lines.} 6 | \usage{ 7 | parseMplus(x, add = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{a character string containing Mplus code.} 11 | 12 | \item{add}{logical indicating whether or not to add semicolons to 13 | lines that do not have them. Defaults to \code{FALSE}.} 14 | } 15 | \value{ 16 | a character vector containing the input text and 17 | optionally added semicolons. 18 | } 19 | \description{ 20 | The function parses a character string containing Mplus code 21 | and checks that every non blank line ends in either a colon or 22 | a semicolon. In addition, it checks that every line is less than 90 23 | characters, because Mplus ignores everything after 90 characters on a line 24 | which can be a source of enigmatic errors. 25 | } 26 | \details{ 27 | The function is fairly basic at the moment. It works by simply 28 | removing blank space (spaces, tabs, etc.) and then if a line does not 29 | terminate in a colon or semicolon, it returns a note and the line 30 | number. Optionally, it can add semicolons to any lines missing them 31 | and return the input with added semicolons. To check for lines that are too long, 32 | all trailing (but not before) white space is removed, and then the number of 33 | characters is checked. 34 | } 35 | \examples{ 36 | 37 | # sample input 38 | test <- " 39 | MODEL: 40 | mpg ON wt hp; 41 | wt WITH hp 42 | " 43 | # check and return 44 | cat(parseMplus(test), file=stdout(), fill=TRUE) 45 | # add missing semicolons and return 46 | cat(parseMplus(test, TRUE), file=stdout(), fill=TRUE) 47 | # line that is too long for Mplus 48 | test <- " 49 | MODEL: 50 | mpg cyl disp hp drat wt qsec vs am gear PWITH cyl disp hp drat wt qsec vs am gear carb; 51 | " 52 | cat(parseMplus(test), file=stdout()) 53 | } 54 | \seealso{ 55 | \code{\link{mplusModeler}} 56 | } 57 | \author{ 58 | Joshua F. Wiley 59 | } 60 | \keyword{utils} 61 | -------------------------------------------------------------------------------- /man/parseMplusSyntax.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{parseMplusSyntax} 4 | \alias{parseMplusSyntax} 5 | \title{Convert an Mplus syntax string into a parsed list} 6 | \usage{ 7 | parseMplusSyntax(syntax, dropSectionNames = TRUE) 8 | } 9 | \description{ 10 | Convert an Mplus syntax string into a parsed list 11 | } 12 | -------------------------------------------------------------------------------- /man/parseTags.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{parseTags} 4 | \alias{parseTags} 5 | \title{Parses tags in the body section} 6 | \usage{ 7 | parseTags(bodySection, initCollection) 8 | } 9 | \arguments{ 10 | \item{bodySection}{The body} 11 | 12 | \item{initCollection}{The initial collection} 13 | } 14 | \value{ 15 | A list with three elements, where each list represents the location, 16 | start character, end character, tag type, etc. of each tag. 17 | \describe{ 18 | \item{initTags}{initMatches} 19 | \item{bodyTags}{bodyMatches} 20 | \item{bodyText}{bodySection} 21 | } 22 | } 23 | \description{ 24 | Parses tags in the body section (character vector) and 25 | init collection (list of vars defined in the init section). 26 | This is an internal function. 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/plot.mplusObject.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods.R 3 | \name{plot.mplusObject} 4 | \alias{plot.mplusObject} 5 | \title{Plot coefficients for an mplusObject} 6 | \usage{ 7 | \method{plot}{mplusObject}(x, y, type = c("stdyx", "un", "std", "stdy"), ...) 8 | } 9 | \arguments{ 10 | \item{x}{An object of class mplusObject} 11 | 12 | \item{y}{Not currently used} 13 | 14 | \item{type}{A character vector indicating the type of coefficients to return. 15 | One of \dQuote{un}, \dQuote{std}, \dQuote{stdy}, or \dQuote{stdyx}. Defaults to \dQuote{stdyx}.} 16 | 17 | \item{\dots}{Additional arguments to pass on (not currently used)} 18 | } 19 | \value{ 20 | Nothing. Called for its side effect of plotting the coefficients. 21 | } 22 | \description{ 23 | This is a method for plotting the coefficients of an mplusObject. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | # simple example of a model using builtin data 28 | # demonstrates use 29 | test <- mplusObject( 30 | TITLE = "test the MplusAutomation Package;", 31 | MODEL = " 32 | mpg ON wt hp; 33 | wt WITH hp;", 34 | OUTPUT = "STANDARDIZED;", 35 | usevariables = c("mpg", "wt", "hp"), 36 | rdata = mtcars) 37 | 38 | res <- mplusModeler(test, "mtcars.dat", modelout = "model1.inp", run = 1L) 39 | 40 | # example of the coef method 41 | plot(res) 42 | 43 | # remove files 44 | unlink("mtcars.dat") 45 | unlink("model1.inp") 46 | unlink("model1.out") 47 | unlink("Mplus Run Models.log") 48 | } 49 | } 50 | \author{ 51 | Joshua F. Wiley 52 | } 53 | \keyword{interface} 54 | -------------------------------------------------------------------------------- /man/plotLTA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mixtures.R 3 | \name{plotLTA} 4 | \alias{plotLTA} 5 | \title{Plot latent transition model} 6 | \usage{ 7 | plotLTA( 8 | mplusModel, 9 | node_stroke = 2, 10 | max_edge_width = 2, 11 | node_labels = "variable.class", 12 | x_labels = "variable" 13 | ) 14 | } 15 | \arguments{ 16 | \item{mplusModel}{A single Mplus model object, returned by . This 17 | function additionally requires the model to be a mixture model with multiple 18 | categorical latent variables.} 19 | 20 | \item{node_stroke}{Integer. Base stroke thickness for nodes. Set to 21 | \code{NULL} to give each node the same stroke thickness.} 22 | 23 | \item{max_edge_width}{Integer. Maximum width of edges.} 24 | 25 | \item{node_labels}{Character vector, defaults to \code{"variable.class"}, 26 | which labels each node by the name of the variable, and the number of the 27 | class it represents. Set to \code{"class"} to display only class numbers, or 28 | provide a named character vector where the names correspond to original class 29 | labels, and the values correspond to their substitute values.} 30 | 31 | \item{x_labels}{Character vector, defaults to \code{"variable"}, which labels 32 | the x-axis with the names of the categorical latent variables. Set to 33 | \code{NULL} to remove axis labels, or provide a named character vector where 34 | the names correspond to original x-axis labels, and the values correspond to 35 | their substitute values.} 36 | } 37 | \value{ 38 | An object of class 'ggplot'. 39 | } 40 | \description{ 41 | Plots latent transition probabilities and classification probabilities for 42 | a single latent transition model (a model with multiple categorical latent 43 | variables, regressed on one another). Stroke thickness of nodes represents 44 | the proportion of cases most likely assigned to that class, with wider 45 | strokes representing greater probability. Edge thickness and transparency 46 | represent the probability of making a particular transition (left to right), 47 | with thicker/darker edges representing greater probability. 48 | } 49 | \examples{ 50 | \dontrun{ 51 | mydat <- read.csv( 52 | system.file("extdata", "ex8.13.csv", package = "MplusAutomation")) 53 | createMixtures( 54 | classes = 2, 55 | filename_stem = "dating", 56 | model_overall = "c2 ON c1;", 57 | model_class_specific = c( 58 | "[u11$1] (a{C}); [u12$1] (b{C}); [u13$1] (c{C}); [u14$1] (d{C}); [u15$1] (e{C});", 59 | "[u21$1] (a{C}); [u22$1] (b{C}); [u23$1] (c{C}); [u24$1] (d{C}); [u25$1] (e{C});" 60 | ), 61 | rdata = mydat, 62 | ANALYSIS = "PROCESSORS IS 2; LRTSTARTS (0 0 40 20); PARAMETERIZATION = PROBABILITY;", 63 | VARIABLE = "CATEGORICAL = u11-u15 u21-u25;" 64 | ) 65 | runModels(filefilter = "dating") 66 | results <- readModels(filefilter = "dating") 67 | plotLTA(results) 68 | } 69 | } 70 | \author{ 71 | Caspar J. van Lissa 72 | } 73 | \keyword{internal} 74 | -------------------------------------------------------------------------------- /man/plotMixtureDensities.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mixtures.R 3 | \name{plotMixtureDensities} 4 | \alias{plotMixtureDensities} 5 | \title{Create density plots for mixture models} 6 | \usage{ 7 | plotMixtureDensities( 8 | modelList, 9 | variables = NULL, 10 | bw = FALSE, 11 | conditional = FALSE, 12 | alpha = 0.2, 13 | facet_labels = NULL 14 | ) 15 | } 16 | \arguments{ 17 | \item{modelList}{A list object of Mplus models, or a single Mplus model} 18 | 19 | \item{variables}{Which variables to plot. If NULL, plots all variables that 20 | are present in all Mplus models.} 21 | 22 | \item{bw}{Logical. Whether to make a black and white plot (for print) or a 23 | color plot. Defaults to FALSE, because these density plots are hard to read 24 | in black and white.} 25 | 26 | \item{conditional}{Logical. Whether to show a conditional density plot 27 | (surface area is divided amongst the latent classes), or a classic density 28 | plot (surface area of the total density plot is equal to one, and is 29 | subdivided amongst the classes).} 30 | 31 | \item{alpha}{Numeric (0-1). Only used when bw and conditional are FALSE. Sets 32 | the transparency of geom_density, so that classes with a small number of 33 | cases remain visible.} 34 | 35 | \item{facet_labels}{Named character vector, the names of which should 36 | correspond to the facet labels one wishes to rename, and the values of which 37 | provide new names for these facets. For example, to rename variables, in the 38 | example with the 'iris' data below, one could specify: 39 | \code{facet_labels = c("Pet_leng" = "Petal length")}.} 40 | } 41 | \value{ 42 | An object of class 'ggplot'. 43 | } 44 | \description{ 45 | Creates a density plot for a single object of class 'mplus.model', or a 46 | faceted plot of density plots for an object of class 'mplus.model.list'. For 47 | each variable, a Total density plot will be shown, along with separate 48 | density plots for each latent class, where cases are weighted by the 49 | posterior probability of being assigned to that class. 50 | } 51 | \note{ 52 | This function returns warnings, indicating that sum(weights) != 1. 53 | These can be ignored. The sum of the "Total" density per variable per model 54 | is equal to 1, and the sum of all of the posterior probabilities is equal to 55 | 1. This results in a normal density plot for the "Total", which is subdivided 56 | by the latent classes, in proportion to the posterior probabilities of 57 | participants being assigned to those clases. 58 | } 59 | \examples{ 60 | \dontrun{ 61 | results <- createMixtures(classes = 1:3, filename_stem = "iris", 62 | rdata = iris, run = 1L) 63 | plotMixtureDensities(results) 64 | } 65 | \dontrun{ 66 | plotMixtureDensities(results, variables = "PETAL_LE") 67 | } 68 | \dontrun{ 69 | plotMixtureDensities(results, bw = TRUE) 70 | } 71 | \dontrun{ 72 | plotMixtureDensities(results, bw = FALSE, conditional = TRUE) 73 | } 74 | \dontrun{ 75 | plotMixtureDensities(results[[2]], variables = "PETAL_LE") 76 | } 77 | } 78 | \author{ 79 | Caspar J. van Lissa 80 | } 81 | \keyword{mixture} 82 | \keyword{models} 83 | \keyword{mplus} 84 | -------------------------------------------------------------------------------- /man/plotMixtures.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mixtures.R 3 | \name{plotMixtures} 4 | \alias{plotMixtures} 5 | \title{Create latent profile plots} 6 | \usage{ 7 | plotMixtures( 8 | modelList, 9 | variables = NULL, 10 | coefficients = c("unstandardized", "stdyx.standardized", "stdy.standardized", 11 | "stdy.standardized"), 12 | parameter = c("Means", "Intercepts"), 13 | ci = 0.95, 14 | bw = FALSE, 15 | rawdata = FALSE, 16 | alpha_range = c(0, 0.1) 17 | ) 18 | } 19 | \arguments{ 20 | \item{modelList}{A list of Mplus mixture models, or a single mixture model} 21 | 22 | \item{variables}{A character vectors with the names of the variables 23 | (included in the Mplus output) to be plotted.} 24 | 25 | \item{coefficients}{Which type of coefficients to plot on the y-axis; default 26 | is 'unstandardized'. Options include: c('stdyx.standardized', 27 | 'stdy.standardized', 'std.standardized')} 28 | 29 | \item{parameter}{Which parameter to plot (from Mplus parameter estimate 30 | headings included in the output). 31 | Defaults to c('Means', 'Intercepts').} 32 | 33 | \item{ci}{What confidence interval should the errorbars span? Defaults to 34 | a 95\% confidence interval. Set to NULL to remove errorbars.} 35 | 36 | \item{bw}{Logical. Should the plot be black and white (for print), or color?} 37 | 38 | \item{rawdata}{Should raw data be plotted in the background? Setting this to 39 | TRUE might result in long plotting times. Requires including the Mplus syntax 40 | 'SAVEDATA: FILE IS "filename"; SAVE = cprobabilities' in the Mplus input.} 41 | 42 | \item{alpha_range}{The minimum and maximum values of alpha (transparancy) for 43 | the raw data. Minimum should be 0; lower maximum values of alpha can help 44 | reduce overplotting.} 45 | } 46 | \value{ 47 | An object of class 'ggplot'. 48 | } 49 | \description{ 50 | Creates a profile plot for a single object of class 'mplus.model', or a 51 | faceted plot of profile plots for an object of class 'mplus.model.list'. 52 | } 53 | \examples{ 54 | \dontrun{ 55 | res <- createMixtures(classes = 1:2, filename_stem = "cars", 56 | model_overall = "wt ON drat;", 57 | model_class_specific = "wt; qsec;", 58 | rdata = mtcars, 59 | usevariables = c("wt", "qsec", "drat"), 60 | OUTPUT = "standardized", 61 | run = 1L) 62 | plotMixtures(res, rawdata = TRUE) 63 | } 64 | \dontrun{ 65 | plotMixtures(res, variables = "wt") 66 | } 67 | \dontrun{ 68 | plotMixtures(res, coefficients = "stdyx.standardized") 69 | } 70 | } 71 | \author{ 72 | Caspar J. van Lissa 73 | } 74 | \keyword{mixture} 75 | \keyword{mplus} 76 | \keyword{plot} 77 | -------------------------------------------------------------------------------- /man/prepareMplusData_Mat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/prepareMplusData.R 3 | \name{prepareMplusData_Mat} 4 | \alias{prepareMplusData_Mat} 5 | \title{Prepare Mplus Data Matrix} 6 | \usage{ 7 | prepareMplusData_Mat(covMatrix, meansMatrix, nobs) 8 | } 9 | \arguments{ 10 | \item{covMatrix}{The covariance matrix} 11 | 12 | \item{meansMatrix}{The means matrix} 13 | 14 | \item{nobs}{Number of observations for the data} 15 | } 16 | \value{ 17 | A dataset 18 | } 19 | \description{ 20 | support writing of covariance or means + covariance matrix (future) 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/print.MplusRstructure.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods.R 3 | \name{print.MplusRstructure} 4 | \alias{print.MplusRstructure} 5 | \title{Print an Mplus Residual Structure object} 6 | \usage{ 7 | \method{print}{MplusRstructure}(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{An object of class MplusRstructure} 11 | 12 | \item{\dots}{Additional arguments to pass on (not currently used)} 13 | } 14 | \value{ 15 | \code{NULL} Called for its side effect of printing the object to the console 16 | } 17 | \description{ 18 | This is a method for printing an Mplus Residual Structure object. 19 | } 20 | \examples{ 21 | # default 'show' uses printing 22 | mplusRcov(c("a", "b", "c"), type = "ar") 23 | 24 | # also if calling print explicitly 25 | print(mplusRcov(c("a", "b", "c"), type = "ar")) 26 | 27 | # to see all aspects of the raw/original object 28 | str(mplusRcov(c("a", "b", "c"), type = "ar")) 29 | } 30 | \seealso{ 31 | Other Mplus-Formatting: 32 | \code{\link{coef.mplus.model}()}, 33 | \code{\link{confint.mplus.model}()}, 34 | \code{\link{extract}()}, 35 | \code{\link{summary.mplusObject}()} 36 | } 37 | \author{ 38 | Joshua F. Wiley 39 | } 40 | \concept{Mplus-Formatting} 41 | \keyword{interface} 42 | -------------------------------------------------------------------------------- /man/processConditionalTags.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{processConditionalTags} 4 | \alias{processConditionalTags} 5 | \title{Process Conditional Tags} 6 | \usage{ 7 | processConditionalTags(templateTags, initCollection) 8 | } 9 | \arguments{ 10 | \item{templateTags}{A template tag} 11 | 12 | \item{initCollection}{The list of all arguments parsed from the init section} 13 | } 14 | \value{ 15 | Processed templateTags 16 | } 17 | \description{ 18 | To do: add details. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/processInit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{processInit} 4 | \alias{processInit} 5 | \title{Process the Init Section} 6 | \usage{ 7 | processInit(initsection) 8 | } 9 | \arguments{ 10 | \item{initsection}{The list of all arguments parsed from the init section} 11 | } 12 | \value{ 13 | arglist 14 | } 15 | \description{ 16 | To do: add details. 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/recurseReplace.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{recurseReplace} 4 | \alias{recurseReplace} 5 | \title{Recursive replace} 6 | \usage{ 7 | recurseReplace(templateTags, initCollection, curiterator = 1L) 8 | } 9 | \arguments{ 10 | \item{templateTags}{The template tags} 11 | 12 | \item{initCollection}{The list of all arguments parsed from the init section} 13 | 14 | \item{curiterator}{An integer that tracks of the depth of recursion through the iterators. Defaults to 1.} 15 | } 16 | \value{ 17 | Does not look like it returns anything 18 | } 19 | \description{ 20 | To do: fill in some details 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/replaceBodyTags.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{replaceBodyTags} 4 | \alias{replaceBodyTags} 5 | \title{Replace Body Tags} 6 | \usage{ 7 | replaceBodyTags(bodySection, bodyTags, initCollection) 8 | } 9 | \arguments{ 10 | \item{bodySection}{character vector of body section of Mplus syntax} 11 | 12 | \item{bodyTags}{collection of tags used inside of the template body} 13 | 14 | \item{initCollection}{The list of all arguments parsed from the init section} 15 | } 16 | \value{ 17 | Returns updated bodySection 18 | } 19 | \description{ 20 | To do: fill in some details 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/replaceInitTags.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{replaceInitTags} 4 | \alias{replaceInitTags} 5 | \title{Replace Init Tags} 6 | \usage{ 7 | replaceInitTags(initTags, initCollection) 8 | } 9 | \arguments{ 10 | \item{initTags}{Init tags} 11 | 12 | \item{initCollection}{The list of all arguments parsed from the init section} 13 | } 14 | \value{ 15 | Returns updated initCollection 16 | } 17 | \description{ 18 | To do: fill in some details 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/rmVarWarnings.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplus.R 3 | \name{rmVarWarnings} 4 | \alias{rmVarWarnings} 5 | \title{Remove variable name length warnings from Mplus output file} 6 | \usage{ 7 | rmVarWarnings(file) 8 | } 9 | \arguments{ 10 | \item{file}{A file name (including path if necessary) to an Mplus output 11 | file. Note that you must have read and write privileges on the file 12 | for this function to work properly.} 13 | } 14 | \value{ 15 | Usually NULL. Called for the side effect of removing warnings in 16 | Mplus output files. If \code{\link{file.access}} testing for write permissions 17 | returns \code{FALSE}, a character string note that \code{rmVarWarnings} 18 | could not run. 19 | } 20 | \description{ 21 | This function is designed to remove warnings in Mplus output files 22 | about variable names being greater than 8 characters. It replaces them 23 | with a note that the warnings were removed and a count of how many warnings 24 | were removed. 25 | } 26 | \details{ 27 | This is an internal function and not meant to be directly called by the 28 | user under most circumstances. It is called by \code{\link{mplusModeler}} 29 | when the \code{varwarnings = FALSE} argument is used. 30 | } 31 | \examples{ 32 | # to do 33 | } 34 | \seealso{ 35 | \code{\link{mplusModeler}} 36 | } 37 | \author{ 38 | Joshua F. Wiley 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/runModels_Interactive.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/runModels.R 3 | \name{runModels_Interactive} 4 | \alias{runModels_Interactive} 5 | \title{Run Mplus Models Using Graphical Interface} 6 | \usage{ 7 | runModels_Interactive( 8 | directory = getwd(), 9 | recursive = "0", 10 | showOutput = "1", 11 | replaceOutfile = "1", 12 | checkDate = "0", 13 | logFile = "1" 14 | ) 15 | } 16 | \arguments{ 17 | \item{directory}{optional. The starting directory that will display in the dialog window. Defaults to the 18 | current working directory.} 19 | 20 | \item{recursive}{optional. Whether the recursive checkbox should be checked when the window opens. 21 | \dQuote{0} for \code{FALSE}, \dQuote{1} for \code{TRUE}.} 22 | 23 | \item{showOutput}{optional. Whether the show output checkbox should be checked when the window opens. 24 | \dQuote{0} for \code{FALSE}, \dQuote{1} for \code{TRUE}.} 25 | 26 | \item{replaceOutfile}{optional. Whether the replace outfile checkbox should be checked when the window opens. 27 | \dQuote{0} for \code{FALSE}, \dQuote{1} for \code{TRUE}.} 28 | 29 | \item{checkDate}{optional. Whether the check modified date checkbox should be checked when the window opens. 30 | \dQuote{0} for \code{FALSE}, \dQuote{1} for \code{TRUE}.} 31 | 32 | \item{logFile}{optional. Whether the log file checkbox should be checked when the window opens. 33 | \dQuote{0} for \code{FALSE}, \dQuote{1} for \code{TRUE}.} 34 | } 35 | \value{ 36 | None. Function is used to display user interface for running models. 37 | } 38 | \description{ 39 | This function is provides a graphical user interface to the \code{runModels} function. 40 | It uses Tcl/Tk to display a window in which the user can specify parameters for \code{runModels}, 41 | including the directory for runs, recursing through subdirectories, displaying output on the console, 42 | and replacing existing outfiles. 43 | } 44 | \details{ 45 | This function exists as a GUI wrapper for \code{runModels} and does not provide any distinct functionality. 46 | } 47 | \examples{ 48 | # interactive, none 49 | } 50 | \seealso{ 51 | \code{\link{runModels}} 52 | } 53 | \author{ 54 | Michael Hallquist 55 | } 56 | \keyword{interface} 57 | -------------------------------------------------------------------------------- /man/separateHyphens.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{separateHyphens} 4 | \alias{separateHyphens} 5 | \title{Separate Hyphenated Variable Strings} 6 | \usage{ 7 | separateHyphens(cmd) 8 | } 9 | \arguments{ 10 | \item{cmd}{A character string} 11 | } 12 | \value{ 13 | The character string if no hyphens, or a list of vectors if there are hyphens. 14 | } 15 | \description{ 16 | This code is a simplified form of \code{expandCmd} from the \pkg{lavaan} package. 17 | It separates hyphenated variable strings into a list of vectors, while ignoring 18 | hyphens that may be used in numbers. 19 | } 20 | \details{ 21 | Note that this is an internal function only. 22 | } 23 | \examples{ 24 | 25 | MplusAutomation:::separateHyphens("x1x4") 26 | MplusAutomation:::separateHyphens("x1-x4") 27 | MplusAutomation:::separateHyphens("x1-x4; x1*-1; v1-v3;") 28 | } 29 | \author{ 30 | Michael Hallquist revised by Joshua Wiley 31 | } 32 | \keyword{interface} 33 | -------------------------------------------------------------------------------- /man/showSummaryTable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/summary.R 3 | \name{showSummaryTable} 4 | \alias{showSummaryTable} 5 | \title{Display summary table of Mplus model statistics in separate window} 6 | \usage{ 7 | showSummaryTable( 8 | modelList, 9 | keepCols, 10 | dropCols, 11 | sortBy = NULL, 12 | font = "Courier 9" 13 | ) 14 | } 15 | \arguments{ 16 | \item{modelList}{A list of models (as a \code{data.frame}) returned from the \code{extractModelSummaries} function.} 17 | 18 | \item{keepCols}{A vector of character strings indicating which columns/variables to display in the summary. Only 19 | columns included in this list will be displayed (all others excluded). By default, \code{keepCols} is: 20 | \code{c("Title", "LL", "Parameters", "AIC", "AICC", "BIC", "RMSEA_Estimate")}. 21 | Example: \code{c("Title", "LL", "AIC", "CFI")}} 22 | 23 | \item{dropCols}{A vector of character strings indicating which columns/variables to omit from the summary. 24 | Any column not included in this list will be displayed. By default, \code{dropCols} is \code{NULL}. 25 | Example: \code{c("InputInstructions", "TLI")}} 26 | 27 | \item{sortBy}{Optional. Field name (as character string) by which to sort the table. 28 | Typically an information criterion (e.g., \dQuote{AIC} or \dQuote{BIC}) is used to sort the table. 29 | Defaults to \code{NULL}, which does not sort the table.} 30 | 31 | \item{font}{Optional. The font to be used to display the summary table. Defaults to Courier 9.} 32 | } 33 | \value{ 34 | No value is returned by this function. It is solely used to display the summary table in a separate window. 35 | } 36 | \description{ 37 | Displays a summary table of model fit statistics extracted using the \code{extractModelSummaries} function. 38 | This function relies on the \code{showData} function from the relimp package, which displays data in a Tk-based window. 39 | By default, the following summary statistics are included: \code{Title, LL, Parameters, AIC, AICC, BIC, RMSEA_Estimate}, 40 | but these are customizable using the \code{keepCols} and \code{dropCols} parameters. 41 | } 42 | \note{ 43 | You must choose between \code{keepCols} and \code{dropCols} because 44 | it is not sensible to use these together to include and exclude columns. 45 | The function will error if you include both parameters. 46 | } 47 | \examples{ 48 | # make me!!! 49 | } 50 | \seealso{ 51 | \code{\link{extractModelSummaries}} \code{\link{HTMLSummaryTable}} \code{\link{LatexSummaryTable}} 52 | } 53 | \author{ 54 | Michael Hallquist 55 | } 56 | \keyword{interface} 57 | -------------------------------------------------------------------------------- /man/slurm_job_status.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{slurm_job_status} 4 | \alias{slurm_job_status} 5 | \title{check the status of jobs submitted on a SLURM cluster} 6 | \usage{ 7 | slurm_job_status( 8 | job_ids = NULL, 9 | user = NULL, 10 | sacct_format = "jobid,submit,timelimit,start,end,state" 11 | ) 12 | } 13 | \arguments{ 14 | \item{job_ids}{a vector of job ids to check} 15 | 16 | \item{user}{the user who submitted the jobs} 17 | 18 | \item{sacct_format}{the format string passed to sacct for job status} 19 | } 20 | \value{ 21 | a data.frame containing the status of each job id 22 | } 23 | \description{ 24 | check the status of jobs submitted on a SLURM cluster 25 | } 26 | \details{ 27 | This function calls \code{sacct -j} to check the status of jobs on a slurm cluster 28 | } 29 | \keyword{internal} 30 | -------------------------------------------------------------------------------- /man/splitDFByRow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{splitDFByRow} 4 | \alias{splitDFByRow} 5 | \title{Split a data frame into a list by rows} 6 | \usage{ 7 | splitDFByRow(df) 8 | } 9 | \arguments{ 10 | \item{df}{An object inheriting from class \code{data.frame}} 11 | } 12 | \value{ 13 | A list where each element is a one row data frame 14 | } 15 | \description{ 16 | Takes a data frame and returns a list with an element for each row of the data frame. 17 | This is an internal function. 18 | } 19 | \examples{ 20 | # small example using built in data 21 | MplusAutomation:::splitDFByRow(mtcars) 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/splitFilePath.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{splitFilePath} 4 | \alias{splitFilePath} 5 | \title{Split File and Path into Separate Parts} 6 | \usage{ 7 | splitFilePath(filepath, normalize = FALSE) 8 | } 9 | \arguments{ 10 | \item{filepath}{A character string of the file path} 11 | } 12 | \value{ 13 | A list with elements for the directory, filename, 14 | and absolute path. 15 | } 16 | \description{ 17 | This is a helper function to split path into path and filename. 18 | Code adapted from R.utils filePath command. 19 | } 20 | \examples{ 21 | \dontrun{ 22 | splitFilePath("dir1/subdir1/mplus1.inp") 23 | } 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/subsetModelList.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/summary.R 3 | \name{subsetModelList} 4 | \alias{subsetModelList} 5 | \title{Subset a list of Mplus model results} 6 | \usage{ 7 | subsetModelList(modelList, keepCols, dropCols, sortBy = NULL) 8 | } 9 | \arguments{ 10 | \item{modelList}{A list object of Mplus models} 11 | 12 | \item{keepCols}{Columns to keep} 13 | 14 | \item{dropCols}{Columns to drop (use only one of keep/dropCols)} 15 | 16 | \item{sortBy}{How to sort. Defaults to \code{NULL}, which does not sort the list.} 17 | } 18 | \value{ 19 | Extracted and sorted data 20 | } 21 | \description{ 22 | a helper function to be used by wrappers that generate HTML, LaTex, and on-screen displays of summary statistics 23 | } 24 | \examples{ 25 | # make me!!! 26 | } 27 | \keyword{internal} 28 | -------------------------------------------------------------------------------- /man/summary.mplusObject.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods.R 3 | \name{summary.mplusObject} 4 | \alias{summary.mplusObject} 5 | \title{Summarize an mplusObject} 6 | \usage{ 7 | \method{summary}{mplusObject}(object, verbose = FALSE, ...) 8 | } 9 | \arguments{ 10 | \item{object}{An object of class mplusObject} 11 | 12 | \item{verbose}{Logical whether to print verbose output. Defaults to \code{FALSE}.} 13 | 14 | \item{\dots}{Additional arguments to pass on (not currently used)} 15 | } 16 | \value{ 17 | \code{NULL} Called for its side effect of printing a model summary to the console 18 | } 19 | \description{ 20 | This is a method for summarizing an mplusObject. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | # simple example of a model using builtin data 25 | # demonstrates use 26 | test <- mplusObject( 27 | TITLE = "test the MplusAutomation Package;", 28 | MODEL = " 29 | mpg ON wt hp; 30 | wt WITH hp;", 31 | usevariables = c("mpg", "wt", "hp"), 32 | rdata = mtcars) 33 | 34 | res <- mplusModeler(test, "mtcars.dat", modelout = "model1.inp", run = 1L) 35 | 36 | # example of the summary method 37 | summary(res) 38 | 39 | # example of verbose output 40 | summary(res, verbose=TRUE) 41 | 42 | # remove files 43 | unlink("mtcars.dat") 44 | unlink("model1.inp") 45 | unlink("model1.out") 46 | unlink("Mplus Run Models.log") 47 | } 48 | } 49 | \seealso{ 50 | Other Mplus-Formatting: 51 | \code{\link{coef.mplus.model}()}, 52 | \code{\link{confint.mplus.model}()}, 53 | \code{\link{extract}()}, 54 | \code{\link{print.MplusRstructure}()} 55 | } 56 | \author{ 57 | Joshua F. Wiley 58 | } 59 | \concept{Mplus-Formatting} 60 | \keyword{interface} 61 | -------------------------------------------------------------------------------- /man/summary.mplus_submission_df.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{summary.mplus_submission_df} 4 | \alias{summary.mplus_submission_df} 5 | \title{summary function for submission from \code{submitModels}} 6 | \usage{ 7 | \method{summary}{mplus_submission_df}(x, refresh = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{x}{the \code{mplus_submission_df} object to summarize} 11 | 12 | \item{refresh}{if \code{TRUE}, check the status of jobs for this object before printing} 13 | } 14 | \description{ 15 | summary function for submission from \code{submitModels} 16 | } 17 | -------------------------------------------------------------------------------- /man/testBParamCompoundConstraint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{testBParamCompoundConstraint} 4 | \alias{testBParamCompoundConstraint} 5 | \title{Test inequality-constrained hypothesis for two or more parameters based on iterations of MCMC chains} 6 | \usage{ 7 | testBParamCompoundConstraint(bparams, test) 8 | } 9 | \arguments{ 10 | \item{bparams}{An object containing draws from the posterior distribution (class \code{mplus.model} or \code{mplus.bparameters}). 11 | Obtained by SAVEDATA:BPARAMETERS in Mplus and \code{\link{getSavedata_Bparams}} or \code{\link{readModels}} in \code{MplusAutomation}.} 12 | 13 | \item{test}{The \code{R} code defining the parameter test of three or more parameters. Example: 14 | \code{"(STAITOT.ON.CG > STAITOT.ON.UCG) & (BDIM.ON.CG > BDIM.ON.UCG)"}.} 15 | } 16 | \value{ 17 | No value is returned by this function. Instead, two summary tables are printed to the screen containing the number and proportion 18 | of draws consistent with the hypothesis. 19 | } 20 | \description{ 21 | Tests an inequality-constrained hypothesis (van de Schoot, Hoijtink, Hallquist, & Boelen, in press) based on 22 | draws from the posterior distribution of the model parameters, which provides information about the proportion 23 | of the distribution that is in agreement with a given hypothesis. This function is used for more complex hypotheses 24 | about three or more parameters, whereas testBParamConstraint tests a simple two-parameter hypothesis. 25 | } 26 | \details{ 27 | This function accepts a bparameters object containing iterations of the MCMC chains (rows) for each model parameter (columns) 28 | and prints out the number and proportion of draws that are consistent with the requested hypothesis test. 29 | 30 | The \code{test} argument is evaluated directly as \code{R} code, with the \code{bparams} object attached so that 31 | variable names are available directly in the environment. Because the goal is to evaluate the test for each 32 | draw from the posterior distribution, remember to use vector-based logic operators, not boolean operators. That is, 33 | stick to \code{&} or \code{|} for joining tests of parameters, rather than \code{&&} or \code{||} since the latter will 34 | return a single TRUE/FALSE, which is irrelevant. 35 | 36 | An example test in R logic would be \code{"(STAITOT.ON.CG > STAITOT.ON.UCG) & (BDIM.ON.CG > BDIM.ON.UCG)"}. 37 | } 38 | \examples{ 39 | \dontrun{ 40 | #using bparameters directly 41 | btest <- getSavedata_Bparams("model vb1_simpel_b.out") 42 | testBParametersCompoundConstraint(btest, 43 | "(STDYX_STAITOT.ON.CG > STDYX_STAITOT.ON.UCG) & (STDYX_BDIM.ON.CG > STDYX_BDIM.ON.UCG)") 44 | 45 | #or using readModels 46 | btest <- readModels("model vb1_simpel_b.out") 47 | testBParametersCompoundConstraint(btest, 48 | "(STDYX_STAITOT.ON.CG > STDYX_STAITOT.ON.UCG) & (STDYX_BDIM.ON.CG > STDYX_BDIM.ON.UCG)") 49 | } 50 | } 51 | \seealso{ 52 | \code{\link{testBParamConstraint}} 53 | } 54 | \author{ 55 | Michael Hallquist 56 | } 57 | \keyword{interface} 58 | -------------------------------------------------------------------------------- /man/testBParamConstraint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{testBParamConstraint} 4 | \alias{testBParamConstraint} 5 | \title{Test inequality-constrained hypothesis for two parameters based on iterations of MCMC chains} 6 | \usage{ 7 | testBParamConstraint(bparams, coef1, operator, coef2) 8 | } 9 | \arguments{ 10 | \item{bparams}{An object containing draws from the posterior distribution (class \code{mplus.model} or \code{mplus.bparameters}). 11 | Obtained by SAVEDATA:BPARAMETERS in Mplus and \code{\link{getSavedata_Bparams}} or \code{\link{readModels}} in \code{MplusAutomation}.} 12 | 13 | \item{coef1}{The name of the first parameter to be compared. Example: \code{"MGM.TRT1"}} 14 | 15 | \item{operator}{A logical operator to compare the two parameters. Should be one of \code{>=, >, <, or <=}. 16 | Example: \code{">="}} 17 | 18 | \item{coef2}{The name of the first parameter to be compared. Example: \code{"MGM.EX2"}} 19 | } 20 | \value{ 21 | No value is returned by this function. Instead, two summary tables are printed to the screen containing the number and proportion 22 | of draws consistent with the hypothesis. 23 | } 24 | \description{ 25 | Tests a simple inequality-constrained hypothesis (van de Schoot, Hoijtink, Hallquist, & Boelen, in press) based on 26 | draws from the posterior distribution of the model parameters, which provides information about the proportion 27 | of the distribution that is in agreement with a given hypothesis. This function is used for simple hypothesis 28 | for two parameters, whereas testBParamCompoundConstraint gives full access to multiple parameters and R's logic 29 | syntax. 30 | This function accepts a bparameters object containing iterations of the MCMC chains (rows) for each model parameter (columns) 31 | and prints out the number and proportion of draws that are consistent with the requested hypothesis test. 32 | The \code{coef1}, \code{operator}, and \code{coef2} arguments are appended in sequence, so that the hypothesis test is 33 | constructed from left-to-right. e.g., \code{testBParamConstraint(bparamsDF, "MGM.TRT1", ">", "MGM.EX2")}. 34 | } 35 | \examples{ 36 | \dontrun{ 37 | #using bparameters directly 38 | btest <- getSavedata_Bparams("model vb1_simpel_b.out")) 39 | testBParametersConstraint(btest, "STDYX_STAITOT.ON.CG", ">", "STDYX_STAITOT.ON.UCG") 40 | 41 | #or using readModels 42 | btest <- readModels("model vb1_simpel_b.out")) 43 | testBParametersConstraint(btest, "STDYX_STAITOT.ON.CG", ">", "STDYX_STAITOT.ON.UCG") 44 | } 45 | } 46 | \seealso{ 47 | \link{testBParamCompoundConstraint} 48 | } 49 | \author{ 50 | Michael Hallquist 51 | } 52 | \keyword{interface} 53 | -------------------------------------------------------------------------------- /man/torque_job_status.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{torque_job_status} 4 | \alias{torque_job_status} 5 | \title{helper function to get the status of jobs on a TORQUE cluster} 6 | \usage{ 7 | torque_job_status(job_ids, user = NULL) 8 | } 9 | \arguments{ 10 | \item{job_ids}{a vector of job ids to check} 11 | 12 | \item{user}{the user who submitted the jobs} 13 | } 14 | \value{ 15 | a data.frame with the job status for each id 16 | } 17 | \description{ 18 | helper function to get the status of jobs on a TORQUE cluster 19 | } 20 | \details{ 21 | Torque does not keep information about completed jobs available in qstat or qselect. 22 | Thus, we need to log when a job is listed as queued, so that it 'going missing' is evidence of it being completed. 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/trimSpace.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilityFunctions.R 3 | \name{trimSpace} 4 | \alias{trimSpace} 5 | \title{Trim White Space} 6 | \usage{ 7 | trimSpace(string) 8 | } 9 | \arguments{ 10 | \item{string}{The character vector to trim white space from.} 11 | } 12 | \value{ 13 | A character vector with the white space removed. 14 | } 15 | \description{ 16 | Helper function to remove white space from a character vector 17 | } 18 | \examples{ 19 | MplusAutomation:::trimSpace(c(" test", "another ")) 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/unlabeledMatrixExtract.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parseOutput.R 3 | \name{unlabeledMatrixExtract} 4 | \alias{unlabeledMatrixExtract} 5 | \title{Reconstruct matrix from unlabeled multi-line text output} 6 | \usage{ 7 | unlabeledMatrixExtract(outfiletext, filename) 8 | } 9 | \arguments{ 10 | \item{outfiletext}{The text of the output file} 11 | 12 | \item{filename}{The name of the output file} 13 | } 14 | \value{ 15 | a matrix 16 | } 17 | \description{ 18 | worker function for extracting Mplus matrix output from an unlabeled section 19 | where matrices are spread across blocks to keep within width constraints 20 | example: class counts output from latent class models. 21 | } 22 | \examples{ 23 | # make me!!! 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/update.mplusObject.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mplus.R 3 | \name{update.mplusObject} 4 | \alias{update.mplusObject} 5 | \title{Update an Mplus model object} 6 | \usage{ 7 | \method{update}{mplusObject}(object, quiet = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{object}{An object of class mplusObject} 11 | 12 | \item{quiet}{optional. If \code{TRUE}, show status messages in the console.} 13 | 14 | \item{\dots}{Additional arguments to pass on} 15 | } 16 | \value{ 17 | An (updated) Mplus model object 18 | } 19 | \description{ 20 | This is a method for updating an Mplus model object. 21 | It takes an Mplus model object as the first argument, and 22 | then optionally any sections to update. There are two ways 23 | to update a section using a formula interface. \code{~ "new stuff"} will 24 | replace a given section with the new text. Alternately, you can add 25 | additional text using \code{~ + "additional stuff"}. Combined these let you 26 | replace or add to a section. 27 | } 28 | \examples{ 29 | example1 <- mplusObject(MODEL = "mpg ON wt;", 30 | usevariables = c("mpg", "hp"), rdata = mtcars) 31 | x <- ~ "ESTIMATOR = ML;" 32 | str(update(example1, rdata = iris)) 33 | str(update(example1, ANALYSIS = x)) 34 | str(update(example1, MODEL = ~ "wt ON hp;")) 35 | str(update(example1, MODEL = ~ . + "wt ON hp;")) 36 | str(update(example1, ANALYSIS = x, MODEL = ~ . + "wt ON hp;")) 37 | 38 | ## check that use variables can be updated & overridden 39 | str(update(example1, usevariables = c("mpg", "hp", "cyl"))) 40 | 41 | # test to make sure . in Mplus code does not cause problems 42 | str(update(example1, ANALYSIS = x, MODEL = ~ . + "wt ON hp*.5;")) 43 | rm(example1, x) 44 | } 45 | \author{ 46 | Joshua F. Wiley 47 | } 48 | \keyword{interface} 49 | -------------------------------------------------------------------------------- /man/updateCurrentValues.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createModels.R 3 | \name{updateCurrentValues} 4 | \alias{updateCurrentValues} 5 | \title{Updates current values} 6 | \usage{ 7 | updateCurrentValues(templateTags, initCollection) 8 | } 9 | \arguments{ 10 | \item{templateTags}{The template tags} 11 | 12 | \item{initCollection}{Initial collection} 13 | } 14 | \value{ 15 | Updated current value or the original if no match. 16 | } 17 | \description{ 18 | Body tags currentValues are substituted at the bottom-most level 19 | after init collection is finalized (recursively process any nested tags) 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/validate_dhms.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/submitModels.R 3 | \name{validate_dhms} 4 | \alias{validate_dhms} 5 | \title{helper function to validate format of walltime inputs for HPC submission} 6 | \usage{ 7 | validate_dhms(str) 8 | } 9 | \arguments{ 10 | \item{str}{string containing a duration that may include a days specification} 11 | } 12 | \description{ 13 | helper function to validate format of walltime inputs for HPC submission 14 | } 15 | \details{ 16 | this always converts to an hms format, and if days are present, it 17 | converts to dhms. Supported date formats match slurm sbatch: 18 | https://slurm.schedmd.com/sbatch.html 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(MplusAutomation) 3 | 4 | test_check("MplusAutomation") 5 | -------------------------------------------------------------------------------- /tests/testthat/helper-out_files.R: -------------------------------------------------------------------------------- 1 | get_mplus_file <- function(fname, mplus_version="8.10") { 2 | d <- testthat::test_path("mplus_ug", mplus_version) 3 | stopifnot(dir.exists(d)) 4 | f <- file.path(d, fname) 5 | f_bz <- paste0(f, ".bz2") 6 | f_gz <- paste0(f, ".gz") 7 | f_xz <- paste0(f, ".xz") 8 | 9 | if (file.exists(f)) { 10 | return(f) 11 | } else if (file.exists(f_bz)) { 12 | return(decompress(f_bz)) 13 | } else if (file.exists(f_gz)) { 14 | return(decompress(f_gz)) 15 | } else if (file.exists(f_xz)) { 16 | return(decompress(f_xz)) 17 | } else { 18 | stop("Cannot locate file: ", fname) 19 | } 20 | } 21 | 22 | # adapted from https://github.com/HenrikBengtsson/R.utils/blob/develop/R/compressFile.R 23 | decompress <- function(filename, dest=NULL) { 24 | BFR.SIZE <- 1e7 25 | 26 | stopifnot(file.exists(filename)) 27 | if (grepl("\\.bz2$", filename)) FUN <- bzfile 28 | else if (grepl("\\.gz$", filename)) FUN <- gzfile 29 | else if (grepl("\\.xz$", filename)) FUN <- xzfile 30 | else stop("Cannot sort out compressed file extension from: ", filename) 31 | 32 | inn <- FUN(filename, open="rb") 33 | on.exit(if (!is.null(inn)) close(inn)) 34 | 35 | if (is.null(dest)) { 36 | ext <- sub(".*(\\.[^.]+)\\.(gz|xz|bz2)$", "\\1", filename, perl=TRUE) 37 | dest <- tempfile(fileext = ext) 38 | } 39 | outComplete <- FALSE 40 | out <- file(dest, open="wb") 41 | on.exit({ 42 | if (!is.null(out)) close(out) 43 | # Remove incomplete file? 44 | if (!outComplete) file.remove(destnameT) 45 | }, add=TRUE) 46 | 47 | # Process 48 | nbytes <- 0 49 | repeat { 50 | bfr <- readBin(inn, what=raw(0L), size=1L, n=BFR.SIZE) 51 | n <- length(bfr) 52 | if (n == 0L) break 53 | nbytes <- nbytes + n 54 | writeBin(bfr, con=out, size=1L) 55 | bfr <- NULL # Not needed anymore 56 | } 57 | outComplete <- TRUE 58 | close(out) 59 | out <- NULL 60 | return(dest) 61 | } 62 | 63 | -------------------------------------------------------------------------------- /tests/testthat/mplus_ug/8.11/ch3/ex3.6.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/tests/testthat/mplus_ug/8.11/ch3/ex3.6.h5 -------------------------------------------------------------------------------- /tests/testthat/mplus_ug/8.11/ch3/ex3.6.inp: -------------------------------------------------------------------------------- 1 | TITLE: this is an example of a multinomial 2 | logistic regression for an unordered 3 | categorical (nominal) dependent variable 4 | with two covariates 5 | DATA: FILE IS ex3.6.dat; 6 | VARIABLE: NAMES ARE u1 x1 x3; 7 | NOMINAL IS u1; 8 | MODEL: u1 ON x1 x3; 9 | SAVEDATA: 10 | H5RESULTS = ex3.6.h5; 11 | OUTPUT: 12 | CINTERVAL STANDARDIZED; -------------------------------------------------------------------------------- /tests/testthat/submitModels/ex3.1.inp: -------------------------------------------------------------------------------- 1 | ! memgb 16 2 | ! time 0:30:00 3 | ! processors 2 4 | ! #SBATCH --mail-type=FAIL 5 | ! pre Rscript --vanilla pre_example.R 6 | TITLE: this is an example of a simple linear 7 | regression for a continuous observed 8 | dependent variable with two covariates 9 | DATA: FILE IS ex3.1.dat; 10 | VARIABLE: NAMES ARE y1 x1 x3; 11 | MODEL: y1 ON x1 x3; 12 | ! post Rscript --vanilla post_example.R 13 | -------------------------------------------------------------------------------- /tests/testthat/submitModels/ex3.2.inp: -------------------------------------------------------------------------------- 1 | ! memgb 4 2 | ! time 4:00:00 3 | ! processors 1 4 | ! #SBATCH -p general 5 | TITLE: this is an example of a censored 6 | regression for a censored dependent 7 | variable with two covariates 8 | DATA: FILE IS ex3.2.dat; 9 | VARIABLE: NAMES ARE y1 x1 x3; 10 | CENSORED ARE y1 (b); 11 | ANALYSIS: ESTIMATOR = MLR; 12 | MODEL: y1 ON x1 x3; 13 | -------------------------------------------------------------------------------- /tests/testthat/submitModels/ex3.3.inp: -------------------------------------------------------------------------------- 1 | ! memgb 4 2 | ! time 1:00:00 3 | ! processors 1 4 | ! #SBATCH --mail-type=ALL 5 | TITLE: this is an example of a censored-inflated 6 | regression for a censored dependent 7 | variable with two covariates 8 | DATA: FILE IS ex3.3.dat; 9 | VARIABLE: NAMES ARE y1 x1 x3; 10 | CENSORED ARE y1 (bi); 11 | MODEL: y1 ON x1 x3; 12 | y1#1 ON x1 x3; 13 | -------------------------------------------------------------------------------- /tests/testthat/submitModels/post_example.R: -------------------------------------------------------------------------------- 1 | # simple script to show post-processing for Mplus 2 | 3 | cat("Running post_example.R\n") 4 | 5 | mplusdir <- Sys.getenv("MPLUSDIR") 6 | if (nchar(mplusdir) > 0) cat("MPLUSDIR from Sys.getenv() is: ", mplusdir, "\n") 7 | 8 | mplusinp <- Sys.getenv("MPLUSINP") 9 | if (nchar(mplusinp) > 0) cat("MPLUSINP from Sys.getenv() is: ", mplusinp, "\n") 10 | 11 | library(MplusAutomation) 12 | 13 | cat("Using readModels and printing parameters.\n") 14 | m <- readModels(file.path(mplusdir, sub(".inp", ".out", mplusinp, fixed = TRUE))) 15 | 16 | print(m$parameters$unstandardized) 17 | 18 | -------------------------------------------------------------------------------- /tests/testthat/submitModels/pre_example.R: -------------------------------------------------------------------------------- 1 | # simple script to show pre-processing for Mplus 2 | 3 | cat("Running pre_example.R\n") 4 | 5 | mplusdir <- Sys.getenv("MPLUSDIR") 6 | if (nchar(mplusdir) > 0) cat("MPLUSDIR from Sys.getenv() is: ", mplusdir, "\n") 7 | 8 | mplusinp <- Sys.getenv("MPLUSINP") 9 | if (nchar(mplusinp) > 0) cat("MPLUSINP from Sys.getenv() is: ", mplusinp, "\n") 10 | 11 | cat("Creating an arbitrary pre file pre.txt to show how this script works.\n") 12 | writeLines(c("PRE FILE", as.character(Sys.time())), con = file.path(mplusdir, "pre.txt")) -------------------------------------------------------------------------------- /tests/testthat/test-cfasem.R: -------------------------------------------------------------------------------- 1 | test_that("Mplus User Guide 5.1 - CFA with continuous indicators results can be read in", { 2 | m <- readModels(target = testthat::test_path("ex5.1.out")) 3 | b <- coef(m, params = "loading") 4 | expect_equal(b$est[1], 1.000) 5 | expect_equal(b$se[1], 0.000) 6 | expect_equal(m$summaries$BIC, 9931.295) 7 | }) 8 | 9 | test_that("Mplus User Guide 5.2 - CFA with categorical indicators results can be read in", { 10 | m <- readModels(target = testthat::test_path("ex5.2.out")) 11 | b <- coef(m, params = "loading") 12 | expect_equal(b$est[1], 1.000) 13 | expect_equal(b$se[1], 0.000) 14 | expect_equal(m$summaries$SRMR, 0.021) 15 | }) 16 | 17 | test_that("Mplus User Guide 5.5 part 4 - 4PL IRT results can be read in", { 18 | m <- readModels(target = testthat::test_path("ex5.5part4.out")) 19 | b <- coef(m, params = "loading") 20 | expect_equal(b$est[1], 0.918) 21 | expect_equal(b$se[1], 0.155) 22 | expect_equal(m$summaries$BIC, 269933.988) 23 | }) 24 | 25 | test_that("Mplus User Guide 5.12 - SEM results can be read in", { 26 | m <- readModels(target = testthat::test_path("ex5.12.out")) 27 | b <- coef(m, params = "loading") 28 | expect_equal(b$est[1], 1.000) 29 | expect_equal(b$se[1], 0.000) 30 | 31 | b <- coef(m, params = "regression") 32 | expect_equal(b$est[1], 0.473) 33 | expect_equal(b$se[1], 0.057) 34 | 35 | expect_equal(m$summaries$BIC, 19542.505) 36 | }) 37 | 38 | test_that("Mplus User Guide 5.33 - Bayesian SEM multiple group results can be read in", { 39 | m <- readModels(target = testthat::test_path("ex5.33.out")) 40 | b <- coef(m, params = "loading") 41 | expect_equal(b$est[1], 0.848) 42 | expect_equal(b$se[1], 0.061) 43 | expect_equal(m$summaries$DIC, 35277.206) 44 | }) 45 | -------------------------------------------------------------------------------- /tests/testthat/test-issue158_createmixtures.R: -------------------------------------------------------------------------------- 1 | # I'm trying to run several LCA's, but when I try the example from 2 | # https://rdrr.io/cran/MplusAutomation/man/createMixtures.html, I get the 3 | # following error for the first line of code (## Not run: 4 | # createMixtures(classes = 1:3, filename_stem = "iris", rdata = iris): 5 | 6 | # Error in check_mixtures(modelList) : mixtureSummaryTable requires a list of 7 | # mixture models as its first argument. In addition: Warning message: In 8 | # any(mixtures) : coercing argument of type 'list' to logical 9 | 10 | 11 | test_that("createmixtures works", { 12 | skip_on_cran() 13 | expect_error({ 14 | out <- createMixtures(classes = 1:3, filename_stem = "iris", rdata = iris) 15 | suppressWarnings(print(out)) 16 | }, NA) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test-lca.R: -------------------------------------------------------------------------------- 1 | test_that("Mplus User Guide 7.3 - LCA results can be read in", { 2 | m <- readModels(target = testthat::test_path("ex7.3.out")) 3 | expect_equal(m$summaries$LL, -965.244) 4 | 5 | expect_equal(nrow(m$tech10$bivar_model_fit_info), 24) 6 | expect_equal(m$tech10$bivar_model_fit_info[1,], data.frame( 7 | var1 = "U1", 8 | var2 = "U2", 9 | cat1 = "Category 1", 10 | cat2 = "Category 1", 11 | h1 = "0.582", 12 | h0 = "0.578", 13 | z = "0.161" 14 | )) 15 | 16 | expect_equal(nrow(m$tech10$bivar_chi_square), 6) 17 | expect_equal(m$tech10$bivar_chi_square[1,], data.frame( 18 | var1 = "U1", 19 | var2 = "U2", 20 | Pearson = "0.162", 21 | `Log-Liklihood` = "0.163", 22 | Significant = "0", 23 | check.names = F 24 | )) 25 | }) 26 | 27 | test_that("Mplus User Guide 7.3 - LCA results can be read in (tech10 error)", { 28 | m <- readModels(target = testthat::test_path("ex7.3_error.out")) 29 | expect_equal(m$summaries$LL, -965.244) 30 | expect_equal(m$tech10, list()) 31 | }) 32 | 33 | test_that("Mplus User Guide 7.3 - LCA results can be read in (older Mplus version)", { 34 | m <- readModels(target = testthat::test_path("ex7.3_old.out")) 35 | expect_equal(m$summaries$LL, -965.244) 36 | 37 | expect_equal(nrow(m$tech10$bivar_model_fit_info), 24) 38 | expect_equal(m$tech10$bivar_model_fit_info[1,], data.frame( 39 | var1 = "U1", 40 | var2 = "U2", 41 | cat1 = "Category 1", 42 | cat2 = "Category 1", 43 | h1 = "0.582", 44 | h0 = "0.578", 45 | z = "0.161" 46 | )) 47 | 48 | expect_equal(nrow(m$tech10$bivar_chi_square), 6) 49 | expect_equal(m$tech10$bivar_chi_square[1,], data.frame( 50 | var1 = "U1", 51 | var2 = "U2", 52 | Pearson = "0.162", 53 | `Log-Liklihood` = "0.163", 54 | check.names = F 55 | )) 56 | }) 57 | 58 | # Output file obtained from running code from: 59 | # https://github.com/garberadamc/SEM-Lab9 60 | test_that("Test LCA manual 3rd step", { 61 | m <- readModels(target = testthat::test_path("lca_man_3step.out")) 62 | expect_equal(nrow(m$parameters$unstandardized.alt$ref.cat.1), 6) 63 | expect_equal(m$parameters$unstandardized.alt$ref.cat.1$est[[1]], 0.294) 64 | }) -------------------------------------------------------------------------------- /tests/testthat/test-lgm.R: -------------------------------------------------------------------------------- 1 | test_that("Mplus User Guide 6.1 - LGM for continuous outcome results can be read in", { 2 | m <- readModels(target = testthat::test_path("ex6.1.out")) 3 | b <- coef(m, params = "loading") 4 | expect_equal(b$est[1], 1.000) 5 | expect_equal(b$se[1], 0.000) 6 | expect_equal(m$summaries$BIC, 6088.703) 7 | }) 8 | 9 | test_that("Mplus User Guide 6.4 - LGM for categorical outcome results can be read in", { 10 | m <- readModels(target = testthat::test_path("ex6.4.out")) 11 | b <- coef(m, params = "loading") 12 | expect_equal(b$est[1], 1.000) 13 | expect_equal(b$se[1], 0.000) 14 | expect_equal(m$summaries$SRMR, 0.016) 15 | }) 16 | -------------------------------------------------------------------------------- /tests/testthat/test-mlm.R: -------------------------------------------------------------------------------- 1 | test_that("Mplus User Guide 9.2c - Multilevel regression with random effect results can be read in", { 2 | m <- readModels(target = testthat::test_path("ex9.2c.out")) 3 | b <- coef(m, params = "regression") 4 | expect_equal(b$est[1], 0.569) 5 | expect_equal(b$se[1], 0.094) 6 | expect_equal(m$summaries$BIC, 6246.063) 7 | }) 8 | 9 | 10 | test_that("Mplus User Guide 9.31 - Bayesian Multilevel time series AR(1) results can be read in", { 11 | m <- readModels(target = testthat::test_path("ex9.31.out")) 12 | b <- coef(m, params = "regression") 13 | expect_equal(b$est[1], 0.120) 14 | expect_equal(b$se[1], 0.016) 15 | 16 | b <- coef(m, params = "variability") 17 | expect_equal(b$est[4], 0.104) ## random residual variance 18 | expect_equal(b$se[4], 0.023) 19 | 20 | expect_equal(m$summaries$DIC, 14729.136) 21 | }) 22 | -------------------------------------------------------------------------------- /tests/testthat/test-mplusModel.R: -------------------------------------------------------------------------------- 1 | # test mplusObject 2 | 3 | m <- mplusModel(inp_file="/Users/hallquist/Data_Analysis/r_packages/MplusAutomation/tests/testthat/mplus_ug/8.11/ch8/ex8.6r3step.inp") 4 | 5 | m <- mplusModel(inp_file="/Users/hallquist/Data_Analysis/Momentum/momentum_collab/code/ema/analysis/s1_s2_factors/07_fscores_RLla_p24_v2_fixloadings_exp.inp") 6 | 7 | m <- mplusModel(inp_file="/Users/hallquist/Data_Analysis/Momentum/momentum_collab/code/ema/analysis/s1_s2_factors/07_fscores_RLla_p24_v2_fixloadings_exp.inp", read=FALSE) 8 | 9 | orig <- readLines("/Users/hallquist/Data_Analysis/Momentum/momentum_collab/code/ema/analysis/s1_s2_factors/07_fscores_RLla_p24_v2_fixloadings_exp.inp") 10 | syn <- parseMplusSyntax(orig) 11 | recon <- mplusInpToString(syn) 12 | 13 | syn2 <- parseMplusSyntax(recon) 14 | recon2 <- mplusInpToString(syn2) 15 | 16 | m <- mplusModel(syntax=orig) 17 | identical(m$syntax, trimws(orig)) 18 | 19 | paste(m$syntax, collapse=" ") 20 | paste(trimws(orig), collapse=" ") 21 | 22 | trimws(orig) 23 | m$syntax 24 | m$write_inp() 25 | 26 | # simple regression 27 | syn <- " 28 | TITLE: this is an example of a simple linear 29 | regression for a continuous observed 30 | dependent variable with two covariates 31 | DATA: FILE IS ex3.1.dat; 32 | VARIABLE: NAMES ARE y1 x1 x3; 33 | MODEL: y1 ON x1 x3; 34 | " 35 | 36 | m <- mplusModel(inp_file="/Users/hallquist/Data_Analysis/r_packages/MplusAutomation/tests/testthat/submitModels/ex3.1.inp") 37 | 38 | dd <- m$data 39 | 40 | nobj <- mplusModel(syntax=syn, data=dd, inp_file="/Users/hallquist/Data_Analysis/r_packages/MplusAutomation/tests/testthat/ex3.1_mplusmodel.inp") 41 | nobj$run() 42 | 43 | 44 | m <- mplusModel(inp_file="/Users/hallquist/Data_Analysis/Miscellaneous/Rens_GMM_Constraints/mcex8.1.inp") 45 | m$run() 46 | -------------------------------------------------------------------------------- /tests/testthat/test-pathanalysis.R: -------------------------------------------------------------------------------- 1 | test_that("Mplus User Guide 3.1 - linear regression results can be read in", { 2 | m <- readModels(target = system.file("extdata", "ex3.1.out", package = "MplusAutomation")) 3 | b <- coef(m, params = "expectation") 4 | expect_equal(b$est, 0.511) 5 | expect_equal(b$se, 0.043) 6 | expect_equal(m$summaries$BIC, 1413.526) 7 | }) 8 | 9 | test_that("Mplus User Guide 3.4 - probit regression results can be read in", { 10 | m <- readModels(target = system.file("extdata", "ex3.4.out", package = "MplusAutomation")) 11 | b <- coef(m, params = "expectation") 12 | expect_equal(b$est, 0.984) 13 | expect_equal(b$se, 0.119) 14 | expect_equal(m$summaries$ChiSqBaseline_Value, 193.243) 15 | }) 16 | 17 | test_that("Mplus User Guide 3.5 - logistic regression results can be read in", { 18 | m <- readModels(target = system.file("extdata", "ex3.5.out", package = "MplusAutomation")) 19 | b <- coef(m, params = "expectation") 20 | expect_equal(b$est, 1.026) 21 | expect_equal(b$se, 0.137) 22 | expect_equal(m$summaries$BIC, 423.884) 23 | }) 24 | 25 | 26 | test_that("Mplus User Guide 3.6 - multinomial logistic regression results can be read in", { 27 | m <- readModels(target = system.file("extdata", "ex3.6.out", package = "MplusAutomation")) 28 | b <- coef(m, params = "expectation") 29 | expect_equal(b$est[1], -0.749) 30 | expect_equal(b$se[1], 0.158) 31 | expect_equal(m$summaries$BIC, 904.140) 32 | }) 33 | 34 | 35 | test_that("Mplus User Guide 3.7 - poisson regression results can be read in", { 36 | m <- readModels(target = system.file("extdata", "ex3.7.out", package = "MplusAutomation")) 37 | b <- coef(m, params = "expectation") 38 | expect_equal(b$est, 1.026) 39 | expect_equal(b$se, .030) 40 | expect_equal(m$summaries$BIC, 1952.412) 41 | }) 42 | 43 | 44 | test_that("Mplus User Guide 3.11 - continuous path analysis results can be read in", { 45 | m <- readModels(target = system.file("extdata", "ex3.11.out", package = "MplusAutomation")) 46 | b <- coef(m, params = "expectation") 47 | expect_equal(b$est[1], -1.064) 48 | expect_equal(b$se[1], 0.046) 49 | expect_equal(m$summaries$BIC, 4821.223) 50 | }) 51 | 52 | test_that("Mplus User Guide 3.16 - path analysis with bootstrapping results can be read in", { 53 | m <- readModels(target = system.file("extdata", "ex3.16.out", package = "MplusAutomation")) 54 | b <- coef(m, params = "expectation") 55 | expect_equal(b$est[1], -1.064) 56 | expect_equal(b$se[1], 0.046) 57 | expect_equal(m$summaries$BIC, 4821.223) 58 | ci <- confint(m, params = "expectation") 59 | expect_equal(ci$LowerCI[1], -1.150) 60 | expect_equal(ci$UpperCI[1], -0.969) 61 | }) 62 | 63 | test_that("Mplus User Guide 3.18 - Bayesian moderated mediation results can be read in", { 64 | m <- readModels(target = system.file("extdata", "ex3.18.out", package = "MplusAutomation")) 65 | b <- coef(m, params = "expectation") 66 | expect_equal(b$est[1], -0.134) 67 | expect_equal(b$se[1], 0.087) 68 | expect_equal(m$summaries$DIC, 745.265) 69 | }) 70 | 71 | -------------------------------------------------------------------------------- /tests/testthat/test-submitModels.R: -------------------------------------------------------------------------------- 1 | # tests for submitModels 2 | p <- test_path("submitModels") 3 | 4 | # checks on parsing of scheduling arguments and script setup 5 | track <- submitModels(p, sched_args=c("--mail=user", "--export=v"), debug=TRUE, max_time_per_job = "2:10:00", combine_jobs = TRUE) 6 | 7 | # single model 8 | inp <- file.path(p, "ex3.1.inp") 9 | 10 | submitModels(inp, sched_args=c("--mail=user", "--export=v"), debug=TRUE, max_time_per_job = "2:10:00", combine_jobs = TRUE, replace="always") 11 | 12 | test_that("submitModels job ID check", { 13 | expect_equal(track$jobid[1], "dummy_1") 14 | }) 15 | 16 | test_that("submitModels job allocation checks", { 17 | expect_equal(track$memgb[1], 4) 18 | expect_equal(track$cores[1], 1) 19 | expect_equal(track$wall_time[1], "2:00:00") 20 | 21 | }) 22 | 23 | # setwd("/proj/mnhallqlab/users/michael/MplusAutomation") 24 | # checks on cluster (must be run on slurm cluster!) 25 | # track <- submitModels(p, 26 | # scheduler = "slurm", 27 | # batch_outdir = "/proj/mnhallqlab/users/michael/submitModels_test", 28 | # Mplus_command = "/proj/mnhallqlab/local/bin/mplus", 29 | # sched_args = c("--mail-user=mnhallq"), 30 | # debug=FALSE, 31 | # replaceOutfile = "always" 32 | # ) 33 | # 34 | # track <- checkSubmission(track) 35 | # summary(track) 36 | 37 | # combine jobs challenge 38 | p <- test_path("submitModels/job_combine") 39 | track <- submitModels(p, sched_args=c("--mail=user", "--export=v"), debug=TRUE, max_time_per_job = "48:10:00", batch_outdir = file.path(p, "batchfiles")) 40 | -------------------------------------------------------------------------------- /tests/testthat/test-timeseriesN1.R: -------------------------------------------------------------------------------- 1 | test_that("Mplus User Guide 6.23 - Bayesian N = 1 time series results can be read in", { 2 | m <- readModels(target = testthat::test_path("ex6.23.out")) 3 | b <- coef(m, params = "regression") 4 | expect_equal(b$est[1], 0.171) 5 | expect_equal(b$se[1], 0.104) 6 | expect_equal(m$summaries$DIC, 298.426) 7 | }) 8 | -------------------------------------------------------------------------------- /tests/testthat/test_prepare_longpath.R: -------------------------------------------------------------------------------- 1 | # test use of long file paths in prepareMplusData 2 | test_that("prepareMplusData long path", { 3 | data(iris) 4 | subdirs <- replicate(3, paste(sample(letters, 25, replace=TRUE), collapse=""), simplify = FALSE) 5 | path <- do.call(file.path, c(tempdir(), subdirs)) 6 | expect_gte(nchar(path), 80) # make sure we force a long enough path 7 | dir.create(path, recursive = TRUE) 8 | ff <- file.path(path, "iris.dat") 9 | syn <- prepareMplusData(iris, filename=ff) 10 | dline <- grep("^DATA:", syn) 11 | dlens <- sapply(strsplit(syn[dline], "\n")[[1]], nchar) 12 | expect_no_error(dat <- read.table(ff)) 13 | expect_lt(max(dlens), 90) # ensure that longest line is less than 90 chars 14 | file.remove(ff) 15 | }) 16 | 17 | test_that("prepareMplusData short path", { 18 | data(iris) 19 | path <- tempdir() 20 | expect_lte(nchar(path), 70) # make sure we force a short enough path 21 | ff <- file.path(path, "i.dat") 22 | syn <- prepareMplusData(iris, filename=ff) 23 | dline <- grep("^DATA:", syn) 24 | dlens <- sapply(strsplit(syn[dline], "\n")[[1]], nchar) 25 | expect_no_error(dat <- read.table(ff)) 26 | expect_lt(max(dlens), 90) # ensure that longest line is less than 90 chars 27 | file.remove(ff) 28 | }) 29 | -------------------------------------------------------------------------------- /vignettes/README.md: -------------------------------------------------------------------------------- 1 | # README for MplusAutomation Vignettes 2 | 3 | Writing vignettes for *MplusAutomation* is complicated by the 4 | need for commercial Mplus to be installed, which will not be available 5 | for any continuous integration testing nor on CRAN. 6 | This README outlines the process and steps needed to create successful vignettes. 7 | 8 | The work flow for vignettes requiring Mplus to run is as follows. 9 | 10 | 11 | 1. Decide on the vignette short name, say "cfacont" for Confirmatory Factor Analysis - Continuous. 12 | 2. Create a file `shortname.Rmd.orig`, continuing with the example that would be `cfacont.Rmd.orig`. 13 | This will be an `Rmarkdown` document but is our original source document that can be run 14 | on machines with Mplus installed, but not on CRAN, etc. 15 | 3. Name each `R` chunk in `shortname.Rmd.orig` based on this convention: `shortname-chunkname`. 16 | For example, `cfacont-model` would be the label for a chunk "model" in the vignette "cfacont". 17 | It is a good idea to name all chunks. However, it is **required** for chunks with figures 18 | for the figure parsing to work correctly. 19 | 4. Edit the file `vignettes/precompile.R` to for the new vignette. `precompile.R` is a script 20 | that is explicitly added to `.Rbuildignore` so its never in the CRAN build. `precompile.R` 21 | does the precompilation of our `shortname.Rmd.orig` vignettes into `shortname.Rmd` vignettes 22 | that look like a `.Rmd` file but have already had all the code run so that Mplus is no longer 23 | required. The code in `precompile.R` for a new vignette should look like this: 24 | `knit("vignettes/shortname.Rmd.orig", "vignettes/shortname.Rmd")` 25 | 5. Any figures generated need to be moved into the `vignettes` folder from the top level package 26 | directory. This can be done automatically using the `file.rename()` function to move them 27 | and the `list.files()` function to find them all. For this to work smoothly, two things are required. 28 | **First** all the chunks with figures must be named consistently with the `shortname` of the 29 | vignette. **Second**, the `shortname` must be unique, both from other vignettes and from any 30 | package level files or directories. For example, because at the top level, there is a DESCRIPTION 31 | file, that would not be a good `shortname` nor would README, NEWS, vignettes (a directory name), 32 | etc. 33 | 6. Write your vignette in the file `shortname.Rmd.orig`. In addition to the `Rmarkdown` YAML header 34 | information required for the vignette and vignette index entry, `R` code is needed 35 | to set the chunk options so that `fig.path = ""`. Otherwise, by default figures go into 36 | a `figures` subfolder, which will break moving the figures to their correct, final location. 37 | The first `R` code chunk should include the following code: 38 | `knitr::opts_chunk$set(fig.path = "")` and so that users do not see it, this chunk should have 39 | the option `include = FALSE`. 40 | 7. From `R` make sure your working directory is in the top level, *MplusAutomation* package directory. 41 | From there, you can source/run `precompile.R`. This will precompile the vignette and should 42 | move all the figures to the right place. 43 | 8. Check that a new file `shortname.Rmd` has been generated. Check that if you have figures in the 44 | vignette these are **not** in the top level package directory anymore and **are** in the 45 | `vignettes` directory. 46 | 9. Commit changes via `git`. Make sure that changed / modified files look like what you expect. 47 | 48 | -------------------------------------------------------------------------------- /vignettes/cfa_mplus/cfa_m1_uli.gh5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/vignettes/cfa_mplus/cfa_m1_uli.gh5 -------------------------------------------------------------------------------- /vignettes/cfa_mplus/cfa_m2_uvi.gh5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/vignettes/cfa_mplus/cfa_m2_uvi.gh5 -------------------------------------------------------------------------------- /vignettes/mplusAutomationFMMPlot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/vignettes/mplusAutomationFMMPlot.png -------------------------------------------------------------------------------- /vignettes/precompile.R: -------------------------------------------------------------------------------- 1 | ## This runs knitr on .Rmd.orig files in the vignette folder that rely on Mplus 2 | ## and converts them into precompiled .Rmd files so that CRAN etc. can knit them into 3 | ## package vignettes without needing Mplus installed 4 | 5 | ## this script should be run from the top level MplusAutomation package directory 6 | ## as the working directory, otherwise the various paths and code may break 7 | 8 | ## the steps are: 9 | ## 1. knit the .Rmd.orig -> .Rmd file 10 | ## 2. find any figures generated 11 | ## 3. rename the figures so that they are moved from the top level package dir 12 | ## into the vignettes directory 13 | 14 | ## More detailed are in the vignettes/README.md file in the vignettes folder 15 | 16 | library(knitr) 17 | 18 | ## knit CFA - Continuous vignette 19 | knit("vignettes/cfacont.Rmd.orig", "vignettes/cfacont.Rmd") 20 | cfacont.figures <- list.files(pattern = "^cfacont.*") 21 | if (length(cfacont.figures)) { 22 | file.rename(cfacont.figures, sprintf("vignettes/%s", cfacont.figures)) 23 | } 24 | -------------------------------------------------------------------------------- /vignettes/runModels_Interactive-Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/798b589dd7ef99c4479b649d5f575f4902b31ec2/vignettes/runModels_Interactive-Screenshot.png --------------------------------------------------------------------------------