├── .github
├── .gitignore
└── workflows
│ ├── pkgdown.yaml
│ └── R-CMD-check.yaml
├── .vscode
├── settings.json
└── launch.json
├── data
└── lcademo.rda
├── tests
├── testthat.R
└── testthat
│ ├── mplus_ug
│ └── 8.11
│ │ └── ch3
│ │ ├── ex3.6.h5
│ │ └── ex3.6.inp
│ ├── test-timeseriesN1.R
│ ├── test-issue217.R
│ ├── submitModels
│ ├── ex3.2.inp
│ ├── ex3.3.inp
│ ├── job_combine
│ │ ├── job_1.inp
│ │ ├── job_2.inp
│ │ ├── job_3.inp
│ │ ├── job_4.inp
│ │ ├── job_5.inp
│ │ ├── job_6.inp
│ │ ├── job_7.inp
│ │ ├── job_8.inp
│ │ ├── job_9.inp
│ │ ├── job_10.inp
│ │ ├── job_11.inp
│ │ ├── job_12.inp
│ │ ├── job_13.inp
│ │ ├── job_14.inp
│ │ ├── job_15.inp
│ │ ├── job_16.inp
│ │ ├── job_17.inp
│ │ ├── job_18.inp
│ │ ├── job_19.inp
│ │ └── job_20.inp
│ ├── ex3.1.inp
│ ├── post_example.R
│ └── pre_example.R
│ ├── test-compareModels.R
│ ├── test-lgm.R
│ ├── test-issue158_createmixtures.R
│ ├── test-mlm.R
│ ├── test_prepare_longpath.R
│ ├── test-cfasem.R
│ ├── nbh_indirect.out
│ ├── helper-out_files.R
│ ├── test-submitModels.R
│ ├── test-tech10.R
│ ├── test-lca.R
│ └── test-pathanalysis.R
├── docs
├── reference
│ └── Rplot001.png
├── articles
│ ├── mplusAutomationFMMPlot.png
│ ├── runModels_Interactive-Screenshot.png
│ └── vignette_files
│ │ ├── header-attrs-2.6
│ │ └── header-attrs.js
│ │ └── header-attrs-2.9
│ │ └── header-attrs.js
├── pkgdown.yml
├── link.svg
├── bootstrap-toc.css
└── docsearch.js
├── _pkgdown.yml
├── vignettes
├── cfa_mplus
│ ├── cfa_m1_uli.gh5
│ └── cfa_m2_uvi.gh5
├── mplusAutomationFMMPlot.png
├── runModels_Interactive-Screenshot.png
└── precompile.R
├── examples
├── lca_cfa_example
│ ├── templateExample
│ │ ├── CFA
│ │ │ ├── CFA.gh5
│ │ │ └── CFA.inp
│ │ ├── LCA2
│ │ │ ├── LCA2.gh5
│ │ │ └── LCA2.inp
│ │ ├── LCA3
│ │ │ ├── LCA3.gh5
│ │ │ └── LCA3.inp
│ │ ├── LCA4
│ │ │ ├── LCA4.gh5
│ │ │ └── LCA4.inp
│ │ ├── LCA5
│ │ │ ├── LCA5.gh5
│ │ │ └── LCA5.inp
│ │ └── Mplus Run Models.log
│ ├── analyze_lca.inp
│ ├── analyze_lca_3class.inp
│ ├── sim_lca_cfa.inp
│ └── templateExample.txt
└── monte_carlo
│ ├── Mplus_Monte_Carlo.Rproj
│ └── helper_functions.R
├── .Rbuildignore
├── man
├── graphModel.Rd
├── getInitTags.Rd
├── processInit.Rd
├── clipString.Rd
├── replaceInitTags.Rd
├── connectNodes.Rd
├── addNode.Rd
├── extractInput_1file.Rd
├── processConditionalTags.Rd
├── extractAux.Rd
├── extractTech10.Rd
├── trimSpace.Rd
├── dhms_to_hours.Rd
├── extractClassCounts.Rd
├── extractModIndices_1file.Rd
├── divideIntoFields.Rd
├── getSection.Rd
├── evaluateConditional.Rd
├── extractR3step.Rd
├── prepareMplusData_Mat.Rd
├── extractDataSummary.Rd
├── lookupValue.Rd
├── extractTech1.Rd
├── extractTech4.Rd
├── extractTech9.Rd
├── minutes_to_dhms.Rd
├── extractEFAparameters.Rd
├── extractFacScoreStats.Rd
├── extractSampstat.Rd
├── get_efa_nfactors.Rd
├── extractResiduals.Rd
├── replaceBodyTags.Rd
├── updateCurrentValues.Rd
├── splitDFByRow.Rd
├── recurseReplace.Rd
├── summary.mplus_submission_df.Rd
├── createVarSyntax.Rd
├── extractTech3.Rd
├── splitFilePath.Rd
├── validate_dhms.Rd
├── extractModIndices_1chunk.Rd
├── extractFreeFile.Rd
├── extractTech15.Rd
├── extractTech8.Rd
├── detectColumnNames.Rd
├── lookupSimpleTags.Rd
├── extractWarningsErrors_1file.Rd
├── checkSubmission.Rd
├── classifyTags.Rd
├── extractParameters_1file.Rd
├── extractTech7.Rd
├── parseMplusSyntax.Rd
├── unlabeledMatrixExtract.Rd
├── extractIndirect_section.Rd
├── mplus_as.numeric.Rd
├── isEmpty.Rd
├── local_job_status.Rd
├── extractResiduals_1section.Rd
├── extractSummaries_1file.Rd
├── extractSummaries_1section.Rd
├── OS.Rd
├── subsetModelList.Rd
├── l_getSavedata_Bparams.Rd
├── torque_job_status.Rd
├── parseTags.Rd
├── extractIndirect.Rd
├── slurm_job_status.Rd
├── extractTech12.Rd
├── extractSummaries_1plan.Rd
├── detectMplus.Rd
├── extractParameters_1chunk.Rd
├── mplusAvailable.Rd
├── mplusModel.Rd
├── separateHyphens.Rd
├── matrixExtract.Rd
├── friendlyGregexpr.Rd
├── createModels.Rd
├── finalizeInitCollection.Rd
├── getMultilineSection.Rd
├── lcademo.Rd
├── htmlout.Rd
├── convert_to_filelist.Rd
├── getOutFileList.Rd
├── extractParameters_1section.Rd
├── parseCatOutput.Rd
├── filter_inp_filelist.Rd
├── extractValue.Rd
├── getSavedata_readRawFile.Rd
├── lookupTech1Parameter.Rd
├── print.MplusRstructure.Rd
├── detectVariables.Rd
├── getSavedata_Data.Rd
├── dot-convertData.Rd
├── rmVarWarnings.Rd
├── plot.mplusObject.Rd
├── get_job_status.Rd
├── cd.Rd
├── summary.mplusObject.Rd
├── l_getSavedata_Fileinfo.Rd
├── update.mplusObject.Rd
├── createSyntax.Rd
├── parseMplus.Rd
├── expandCmd.Rd
├── getSavedata_Bparams.Rd
├── getSavedata_Fileinfo.Rd
├── runModels_Interactive.Rd
├── mplus.traceplot.Rd
├── MplusAutomationUtils.Rd
├── mplusGLM.Rd
├── dot-mplusMultinomial.Rd
├── mixtureSummaryTable.Rd
├── showSummaryTable.Rd
├── testBParamConstraint.Rd
├── LatexSummaryTable.Rd
├── plotMixtures.Rd
├── HTMLSummaryTable.Rd
├── plotLTA.Rd
├── testBParamCompoundConstraint.Rd
├── plotMixtureDensities.Rd
├── extractModIndices.Rd
├── extract.Rd
└── paramExtract.Rd
├── MplusAutomation.Rproj
├── .gitignore
├── R
└── data.R
├── inst
└── CITATION
└── DESCRIPTION
/.github/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "r.debugger.timeouts.startup": 4000
3 | }
--------------------------------------------------------------------------------
/data/lcademo.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/data/lcademo.rda
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(MplusAutomation)
3 |
4 | test_check("MplusAutomation")
5 |
--------------------------------------------------------------------------------
/docs/reference/Rplot001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/docs/reference/Rplot001.png
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | url: https://michaelhallquist.github.io/MplusAutomation/
2 | template:
3 | bootstrap: 5
4 | bootswatch: spacelab
5 |
6 |
--------------------------------------------------------------------------------
/vignettes/cfa_mplus/cfa_m1_uli.gh5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/vignettes/cfa_mplus/cfa_m1_uli.gh5
--------------------------------------------------------------------------------
/vignettes/cfa_mplus/cfa_m2_uvi.gh5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/vignettes/cfa_mplus/cfa_m2_uvi.gh5
--------------------------------------------------------------------------------
/vignettes/mplusAutomationFMMPlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/vignettes/mplusAutomationFMMPlot.png
--------------------------------------------------------------------------------
/docs/articles/mplusAutomationFMMPlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/docs/articles/mplusAutomationFMMPlot.png
--------------------------------------------------------------------------------
/tests/testthat/mplus_ug/8.11/ch3/ex3.6.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/tests/testthat/mplus_ug/8.11/ch3/ex3.6.h5
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/vignettes/runModels_Interactive-Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/vignettes/runModels_Interactive-Screenshot.png
--------------------------------------------------------------------------------
/docs/articles/runModels_Interactive-Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/docs/articles/runModels_Interactive-Screenshot.png
--------------------------------------------------------------------------------
/examples/lca_cfa_example/templateExample/CFA/CFA.gh5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/examples/lca_cfa_example/templateExample/CFA/CFA.gh5
--------------------------------------------------------------------------------
/examples/lca_cfa_example/templateExample/LCA2/LCA2.gh5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/examples/lca_cfa_example/templateExample/LCA2/LCA2.gh5
--------------------------------------------------------------------------------
/examples/lca_cfa_example/templateExample/LCA3/LCA3.gh5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/examples/lca_cfa_example/templateExample/LCA3/LCA3.gh5
--------------------------------------------------------------------------------
/examples/lca_cfa_example/templateExample/LCA4/LCA4.gh5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/examples/lca_cfa_example/templateExample/LCA4/LCA4.gh5
--------------------------------------------------------------------------------
/examples/lca_cfa_example/templateExample/LCA5/LCA5.gh5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhallquist/MplusAutomation/HEAD/examples/lca_cfa_example/templateExample/LCA5/LCA5.gh5
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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-issue217.R:
--------------------------------------------------------------------------------
1 | test_that("indirect effects with # in outcome are parsed", {
2 | m <- readModels(target = testthat::test_path("nbh_indirect.out"), what = "indirect")
3 | ind <- get_indirect(m)
4 | expect_true(any(ind$unstandardized$overall$outcome == "DVNB#1"))
5 | expect_true(any(ind$unstandardized$overall$outcome == "DVNB"))
6 | })
7 |
--------------------------------------------------------------------------------
/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.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.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.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.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 |
--------------------------------------------------------------------------------
/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/job_combine/job_1.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 1: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/job_combine/job_2.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 2: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/job_combine/job_3.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 3: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/job_combine/job_4.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/job_combine/job_5.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 5: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/job_combine/job_6.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 6: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/job_combine/job_7.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 7: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/job_combine/job_8.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 8: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/job_combine/job_9.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 9: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 |
--------------------------------------------------------------------------------
/.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 | .vscode
24 | ^\.github$
25 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/job_combine/job_10.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 10: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/job_combine/job_11.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 11: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/job_combine/job_12.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 12: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/job_combine/job_13.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 13: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/job_combine/job_14.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 14: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/job_combine/job_15.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 15: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/job_combine/job_16.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 16: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/job_combine/job_17.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 17: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/job_combine/job_18.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 18: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/job_combine/job_19.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 19: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/job_combine/job_20.inp:
--------------------------------------------------------------------------------
1 | ! memgb 4
2 | ! time 20: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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/MplusAutomation.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 | ProjectId: 73be2177-1dee-45c0-820f-cc18a9cac13f
3 |
4 | RestoreWorkspace: No
5 | SaveWorkspace: No
6 | AlwaysSaveHistory: No
7 |
8 | EnableCodeIndexing: Yes
9 | UseSpacesForTab: Yes
10 | NumSpacesForTab: 2
11 | Encoding: UTF-8
12 |
13 | RnwWeave: knitr
14 | LaTeX: pdfLaTeX
15 |
16 | BuildType: Package
17 | PackageUseDevtools: Yes
18 | PackageInstallArgs: --no-multiarch --with-keep.source
19 | PackageCheckArgs: --as-cran
20 | PackageRoxygenize: rd,collate,namespace
21 |
--------------------------------------------------------------------------------
/tests/testthat/submitModels/post_example.R:
--------------------------------------------------------------------------------
1 | # simple script to show post-processing for Mplus
2 | mplusdir <- Sys.getenv("MPLUSDIR")
3 | mplusinp <- Sys.getenv("MPLUSINP")
4 | if (nchar(mplusinp) > 0) cat("MPLUSINP from Sys.getenv() is: ", mplusinp, "\n")
5 |
6 | library(MplusAutomation)
7 |
8 | # parse output file and save to disk as rds object
9 | m <- readModels(file.path(mplusdir, sub(".inp", ".out", mplusinp, fixed = TRUE)))
10 |
11 | saveRDS(m, file.path(mplusdir, sub(".inp", ".rds", mplusinp, fixed=TRUE)))
12 |
13 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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-compareModels.R:
--------------------------------------------------------------------------------
1 | test_that("compareModels returns a list with diff test", {
2 | # not a valid diff test comparison -- just arbitrarily testing that we get the result
3 | m1 <- readModels(target = system.file("extdata", "ex6.4.out", package = "MplusAutomation"))
4 | m2 <- readModels(target = system.file("extdata", "ex3.7.out", package = "MplusAutomation"))
5 | res <- compareModels(m2, m1, diffTest = TRUE)
6 | expect_true(is.list(res))
7 | expect_true("summaries" %in% names(res))
8 | expect_true("diffTest" %in% names(res))
9 | })
10 |
--------------------------------------------------------------------------------
/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/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/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/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/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/extractTech10.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extractTech10.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 | \seealso{
21 | \code{\link{matrixExtract}}
22 | }
23 | \keyword{internal}
24 |
--------------------------------------------------------------------------------
/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/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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/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/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/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/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/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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}(object, refresh = TRUE, ...)
8 | }
9 | \arguments{
10 | \item{object}{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 | \item{...}{additional arguments, not currently used}
15 | }
16 | \description{
17 | summary function for submission from \code{submitModels}
18 | }
19 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/.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
36 | docs
37 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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 | \itemize{
19 | \item \code{errors}: Mplus Errors
20 | \item \code{warnings}: Mplus Warnings
21 | }
22 | }
23 | \description{
24 | Helper function
25 | }
26 | \examples{
27 | # make me!!!
28 | }
29 | \keyword{internal}
30 |
--------------------------------------------------------------------------------
/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 \verb{$status} amd \verb{$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/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/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/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 | \arguments{
10 | \item{syntax}{the character vector containing Mplus syntax}
11 |
12 | \item{dropSectionNames}{Logical. If TRUE, section names will be dropped from the parsed list}
13 | }
14 | \value{
15 | a parsed list of Mplus syntax
16 | }
17 | \description{
18 | Convert an Mplus syntax string into a parsed list
19 | }
20 | \details{
21 | This function converts an Mplus syntax string into a list parsed into sections such as TITLE and DATA
22 | }
23 | \keyword{internal}
24 |
--------------------------------------------------------------------------------
/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/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/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/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/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 |
--------------------------------------------------------------------------------
/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 | skip_if_not(mplusAvailable())
14 | expect_error({
15 | out <- createMixtures(classes = 1:3, filename_stem = "iris", rdata = iris)
16 | suppressWarnings(print(out))
17 | }, NA)
18 | })
19 |
--------------------------------------------------------------------------------
/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/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_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/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
37 | }
38 | \keyword{internal}
39 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 | #' * `Data`: 2 Class LCA data simulated using Mplus
9 | #' * `CFA`: Mplus output file for CFA
10 | #' * `LCA2`: Mplus output file for 2 class LCA
11 | #' * `LCA3`: Mplus output file for 3 class LCA
12 | #' * `LCA4`: Mplus output file for 4 class LCA
13 | #' * `LCA5`: Mplus output file for 5 class LCA
14 | #' * `CFAGH5`: GH5 file for CFA
15 | #' * `LCA2GH5`: GH5 file for 2 class LCA
16 | #' * `LCA3GH5`: GH5 file for 3 class LCA
17 | #' * `LCA4GH5`: GH5 file for 4 class LCA
18 | #' * `LCA5GH5`: GH5 file for 5 class LCA
19 | "lcademo"
20 |
21 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/docs/link.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | \itemize{
18 | \item \code{initTags}: initMatches
19 | \item \code{bodyTags}: bodyMatches
20 | \item \code{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/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/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 |
--------------------------------------------------------------------------------
/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/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/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/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
28 | }
29 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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(
8 | syntax = NULL,
9 | data = NULL,
10 | inp_file = NULL,
11 | read = TRUE,
12 | Mplus_command = NULL
13 | )
14 | }
15 | \arguments{
16 | \item{syntax}{a character vector of Mplus input syntax for this model}
17 |
18 | \item{data}{a data.frame to be used for estimating the model}
19 |
20 | \item{inp_file}{the location of .inp file for this model}
21 |
22 | \item{read}{If TRUE and the .out file already exists, read the contents of the .out file using \code{readModels}}
23 |
24 | \item{Mplus_command}{The location of the Mplus executable to run. If NULL, use \code{detectMplus()}}
25 | }
26 | \value{
27 | a \code{mplusModel_r6} object containing information about the model
28 | }
29 | \description{
30 | Create an mplusModel object for a given model
31 | }
32 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 \code{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 | \dontrun{
28 | friendlyGregexpr("(BY|WITH|ON)",
29 | c("POS_WI BY", "X WITH Y WITH Z")
30 | )
31 | }
32 | }
33 | \author{
34 | Michael Hallquist
35 | }
36 | \keyword{internal}
37 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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 | \itemize{
10 | \item \code{Data}: 2 Class LCA data simulated using Mplus
11 | \item \code{CFA}: Mplus output file for CFA
12 | \item \code{LCA2}: Mplus output file for 2 class LCA
13 | \item \code{LCA3}: Mplus output file for 3 class LCA
14 | \item \code{LCA4}: Mplus output file for 4 class LCA
15 | \item \code{LCA5}: Mplus output file for 5 class LCA
16 | \item \code{CFAGH5}: GH5 file for CFA
17 | \item \code{LCA2GH5}: GH5 file for 2 class LCA
18 | \item \code{LCA3GH5}: GH5 file for 3 class LCA
19 | \item \code{LCA4GH5}: GH5 file for 4 class LCA
20 | \item \code{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/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
30 | }
31 | \keyword{internal}
32 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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/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/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
39 | }
40 | \concept{Mplus-Formatting}
41 | \keyword{interface}
42 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
42 | }
43 | \keyword{internal}
44 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 | # don't attempt this if tempdir is rather long since we're trying to see how it handles short paths
21 | testthat::skip_if(nchar(path) > 70, "tempdir() too long on this platform")
22 | expect_lte(nchar(path), 70) # make sure we start with a short enough path
23 | ff <- file.path(path, "i.dat")
24 | syn <- prepareMplusData(iris, filename=ff)
25 | dline <- grep("^DATA:", syn)
26 | dlens <- sapply(strsplit(syn[dline], "\n")[[1]], nchar)
27 | expect_no_error(dat <- read.table(ff))
28 | expect_lt(max(dlens), 90) # ensure that longest line is less than 90 chars
29 | file.remove(ff)
30 | })
31 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
39 | }
40 | \keyword{internal}
41 |
--------------------------------------------------------------------------------
/.github/workflows/pkgdown.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | release:
8 | types: [published]
9 | workflow_dispatch:
10 |
11 | name: pkgdown.yaml
12 |
13 | permissions: read-all
14 |
15 | jobs:
16 | pkgdown:
17 | runs-on: ubuntu-latest
18 | # Only restrict concurrency for non-PR jobs
19 | concurrency:
20 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
21 | env:
22 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23 | permissions:
24 | contents: write
25 | steps:
26 | - uses: actions/checkout@v4
27 |
28 | - uses: r-lib/actions/setup-pandoc@v2
29 |
30 | - uses: r-lib/actions/setup-r@v2
31 | with:
32 | use-public-rspm: true
33 |
34 | - uses: r-lib/actions/setup-r-dependencies@v2
35 | with:
36 | extra-packages: any::pkgdown, local::.
37 | needs: website
38 |
39 | - name: Build site
40 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
41 | shell: Rscript {0}
42 |
43 | - name: Deploy to GitHub pages 🚀
44 | if: github.event_name != 'pull_request'
45 | uses: JamesIves/github-pages-deploy-action@v4.5.0
46 | with:
47 | clean: false
48 | branch: gh-pages
49 | folder: docs
50 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
52 | }
53 | \keyword{interface}
54 |
--------------------------------------------------------------------------------
/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/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
49 | }
50 | \keyword{utilities}
51 |
--------------------------------------------------------------------------------
/.github/workflows/R-CMD-check.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 |
8 | name: R-CMD-check.yaml
9 |
10 | permissions: read-all
11 |
12 | jobs:
13 | R-CMD-check:
14 | runs-on: ${{ matrix.config.os }}
15 |
16 | name: ${{ matrix.config.os }} (${{ matrix.config.r }})
17 |
18 | strategy:
19 | fail-fast: false
20 | matrix:
21 | config:
22 | - {os: macos-latest, r: 'release'}
23 | - {os: windows-latest, r: 'release'}
24 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
25 | - {os: ubuntu-latest, r: 'release'}
26 | - {os: ubuntu-latest, r: 'oldrel-1'}
27 |
28 | env:
29 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
30 | R_KEEP_PKG_SOURCE: yes
31 |
32 | steps:
33 | - uses: actions/checkout@v4
34 |
35 | - uses: r-lib/actions/setup-pandoc@v2
36 |
37 | - uses: r-lib/actions/setup-r@v2
38 | with:
39 | r-version: ${{ matrix.config.r }}
40 | http-user-agent: ${{ matrix.config.http-user-agent }}
41 | use-public-rspm: true
42 |
43 | - if: runner.os == 'macOS'
44 | run: brew install --cask xquartz
45 |
46 | - uses: r-lib/actions/setup-r-dependencies@v2
47 | with:
48 | extra-packages: any::rcmdcheck
49 | needs: check
50 |
51 | - uses: r-lib/actions/check-r-package@v2
52 | with:
53 | upload-snapshots: true
54 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
55 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
58 | }
59 | \concept{Mplus-Formatting}
60 | \keyword{interface}
61 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.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 | }
--------------------------------------------------------------------------------
/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 | \itemize{
18 | \item \code{fileName}: The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.
19 | \item \code{fileVarNames}: A character vector containing the names of variables in the dataset.
20 | \item \code{fileVarFormats}: A character vector containing the Fortran-style formats of variables in the dataset.
21 | \item \code{fileVarWidths}: A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).
22 | \item \code{bayesFile}: The name of the BPARAMETERS file containing draws from the posterior distribution created by the Mplus SAVEDATA BPARAMETERS command.
23 | \item \code{bayesVarNames}: A character vector containing the names of variables in the BPARAMETERS dataset.
24 | \item \code{tech3File}: A character vector of the tech 3 output.
25 | \item \code{tech4File}: A character vector of the tech 4 output.
26 | }
27 | }
28 | \description{
29 | This function is split out so that \code{getSaveData_Fileinfo} is
30 | exposed to the user, but the parsing function can be used by
31 | \code{readModels}
32 | }
33 | \examples{
34 | # make me!
35 | }
36 | \seealso{
37 | \code{\link{getSavedata_Data}}
38 | }
39 | \keyword{internal}
40 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
47 | }
48 | \keyword{interface}
49 |
--------------------------------------------------------------------------------
/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: 2025-08-25
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 | Roxygen: list(markdown = TRUE)
55 | RoxygenNote: 7.3.3
56 | Encoding: UTF-8
57 | Config/testthat/edition: 3
58 |
--------------------------------------------------------------------------------
/tests/testthat/nbh_indirect.out:
--------------------------------------------------------------------------------
1 | Mplus VERSION 8.3
2 | MUTHEN & MUTHEN
3 | 05/24/2024 5:05 PM
4 |
5 | INPUT INSTRUCTIONS
6 |
7 |
8 | title: test;
9 | data: file is ./p1_mi/p1_list.txt;
10 | type = imputation;
11 | vari: names are m1-m3 y x;
12 |
13 | model:
14 | !measurement model
15 | m by m1-m3;
16 |
17 | !structural model
18 | y on x m(c b);
19 | m on x(a);
20 |
21 | model constraint:
22 | new(med);
23 | med = a * b;
24 |
25 | output: samp stand;
26 |
27 |
28 |
29 | INPUT READING TERMINATED NORMALLY
30 |
31 |
32 | SUMMARY OF ANALYSIS
33 |
34 | this is a stub
35 |
36 |
37 |
38 | TOTAL, TOTAL INDIRECT, SPECIFIC INDIRECT, AND DIRECT EFFECTS
39 |
40 | Two-Tailed
41 | Estimate S.E. Est./S.E. P-Value
42 |
43 |
44 | Effects from MYIV to DVNB
45 |
46 | Total -0.015 0.230 -0.063 0.950
47 | Total indirect 0.035 0.062 0.567 0.571
48 |
49 | Specific indirect 1
50 | DVNB
51 | MYMED
52 | MYIV 0.035 0.062 0.567 0.571
53 |
54 | Direct
55 | DVNB
56 | MYIV -0.050 0.225 -0.222 0.824
57 |
58 | Effects from MYIV to DVNB#1
59 |
60 | Total 0.631 0.262 2.410 0.016
61 | Total indirect -0.080 0.076 -1.047 0.295
62 |
63 | Specific indirect 1
64 | DVNB#1
65 | MYMED
66 | MYIV -0.080 0.076 -1.047 0.295
67 |
68 | Direct
69 | DVNB#1
70 | MYIV 0.711 0.264 2.695 0.007
71 |
72 |
73 | MUTHEN & MUTHEN
74 | 3463 Stoner Ave.
75 | Los Angeles, CA 90066
76 |
77 | Tel: (310) 391-9971
78 | Fax: (310) 391-8971
79 | Web: www.StatModel.com
80 | Support: Support@StatModel.com
81 |
82 | Copyright (c) 1998-2019 Muthen & Muthen
83 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
55 | }
56 | \keyword{interface}
57 |
--------------------------------------------------------------------------------
/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/test-submitModels.R:
--------------------------------------------------------------------------------
1 | # tests for submitModels
2 | p <- test_path("submitModels")
3 |
4 | test_that("submitModels job ID check", {
5 | # checks on parsing of scheduling arguments and script setup
6 | mplus_fake <- tempfile()
7 | file.create(mplus_fake)
8 | track <- submitModels(p, sched_args=c("--mail=user", "--export=v"), debug=TRUE, replaceOutfile = "always",
9 | max_time_per_job = "4:10:00", combine_jobs = FALSE, Mplus_command = mplus_fake)
10 |
11 | expect_equal(track$jobid[1], "dummy_1")
12 |
13 | # job allocation checks
14 | expect_equal(track$memgb[1], 16)
15 | expect_equal(track$cores[1], 2)
16 | expect_equal(track$wall_time[1], "0:30:00")
17 |
18 | })
19 |
20 | # single model
21 | # inp <- file.path(p, "ex3.1.inp")
22 | #
23 | # submitModels(inp, sched_args=c("--mail=user", "--export=v"), debug=TRUE,
24 | # max_time_per_job = "2:10:00", combine_jobs = TRUE, replace="always", Mplus_command = mplus_fake)
25 |
26 |
27 | # setwd("/proj/mnhallqlab/users/michael/MplusAutomation")
28 | # checks on cluster (must be run on slurm cluster!)
29 | # track <- submitModels(p,
30 | # scheduler = "slurm",
31 | # batch_outdir = "/proj/mnhallqlab/users/michael/submitModels_test",
32 | # Mplus_command = "/proj/mnhallqlab/local/bin/mplus",
33 | # sched_args = c("--mail-user=mnhallq"),
34 | # debug=FALSE,
35 | # replaceOutfile = "always"
36 | # )
37 | #
38 | # track <- checkSubmission(track)
39 | # summary(track)
40 |
41 | # combine jobs challenge
42 | p <- test_path("submitModels/job_combine")
43 |
44 | test_that("submitModels combines jobs as expected", {
45 | mplus_fake <- tempfile()
46 | file.create(mplus_fake)
47 | track <- submitModels(p, sched_args=c("--mail=user", "--export=v"), debug=TRUE, max_time_per_job = "48:10:00",
48 | batch_outdir = file.path(p, "batchfiles"), Mplus_command = mplus_fake)
49 | expect_equal(track$file[[5]], c("job_19.inp", "job_20.inp"))
50 | expect_equal(track$wall_hr[5], 39)
51 | })
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
59 | }
60 | \keyword{utils}
61 |
--------------------------------------------------------------------------------
/man/expandCmd.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mplusModel.R
3 | \name{expandCmd}
4 | \alias{expandCmd}
5 | \title{Expand Mplus-style hyphenated variable ranges}
6 | \usage{
7 | expandCmd(cmd, expand_numeric = FALSE)
8 | }
9 | \arguments{
10 | \item{cmd}{A single character string containing Mplus syntax to expand.}
11 |
12 | \item{expand_numeric}{Logical. If \code{TRUE}, expand pure numeric ranges
13 | (e.g., \code{1-3} -> \verb{1 2 3}) in list-like contexts. Default: \code{FALSE}.}
14 | }
15 | \value{
16 | A character string with hyphenated ranges expanded to explicit
17 | variable lists.
18 | }
19 | \description{
20 | Expands Mplus shorthand expressions that specify sequences of variables
21 | using hyphenated ranges (e.g., \code{y1-y3}) into the full list of
22 | variables (e.g., \code{y1 y2 y3}). This function also propagates suffixes
23 | from the right-hand token (e.g., \code{@c}, \code{*c}, or bare \code{*})
24 | to every expanded variable (e.g., \verb{y1-y3@1} -> \verb{y1@1 y2@1 y3@1}).
25 | }
26 | \details{
27 | By default, the function does \strong{not} expand pure numeric ranges (e.g.,
28 | \code{1-3}) to avoid confusion with arithmetic subtraction. If
29 | \code{expand_numeric = TRUE}, such ranges will be expanded when they
30 | appear in list-like contexts (whitespace/comma/semicolon/parentheses
31 | boundaries) and the line does not contain an equals sign (to avoid
32 | accidental expansion of arithmetic like \code{d = 1 - 3}).
33 |
34 | Hyphens in \code{MODEL CONSTRAINT} expressions such as
35 | \code{a = b1-b2} are explicitly protected and left untouched.
36 | }
37 | \examples{
38 | \dontrun{
39 | expandCmd("y1-y3 y5-y6")
40 | # "y1 y2 y3 y5 y6"
41 |
42 | expandCmd("BY y1-y3@0.5;")
43 | # "BY y1@0.5 y2@0.5 y3@0.5;"
44 |
45 | expandCmd("z10-z12*2")
46 | # "z10*2 z11*2 z12*2"
47 |
48 | expandCmd("MODEL CONSTRAINT: a = b1-b2;")
49 | # "MODEL CONSTRAINT: a = b1-b2;" (unchanged)
50 |
51 | expandCmd("1 - 3", expand_numeric = TRUE)
52 | # "1 2 3"
53 |
54 | expandCmd("d = 1 - 3;", expand_numeric = TRUE)
55 | # "d = 1 - 3;" (unchanged because of '=')
56 | }
57 | }
58 | \keyword{internal}
59 |
--------------------------------------------------------------------------------
/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_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 | \itemize{
17 | \item \code{fileName}: The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.
18 | \item \code{fileVarNames}: A character vector containing the names of variables in the dataset.
19 | \item \code{fileVarFormats}: A character vector containing the Fortran-style formats of variables in the dataset.
20 | \item \code{fileVarWidths}: A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).
21 | \item \code{bayesFile}: The name of the BPARAMETERS file containing draws from the posterior distribution created by the Mplus SAVEDATA BPARAMETERS command.
22 | \item \code{bayesVarNames}: A character vector containing the names of variables in the BPARAMETERS dataset.
23 | \item \code{tech3File}: A character vector of the tech 3 output.
24 | \item \code{tech4File}: A character vector of the tech 4 output.
25 | }
26 | }
27 | \description{
28 | This function reads the SAVEDATA INFORMATION section from an Mplus output file that used
29 | the SAVEDATA command, and it returns a list with the filename, variable names, variable formats,
30 | and variable widths of the SAVEDATA file. If present, the function also parses information about the
31 | Bayesian Parameters (BPARAMETERS) file.
32 | }
33 | \examples{
34 | \dontrun{
35 | fileInfo <- getSavedata_Fileinfo("C:/Program Files/Mplus/Test Output.out")
36 | }
37 | }
38 | \seealso{
39 | \code{\link{getSavedata_Data}}
40 | }
41 | \author{
42 | Michael Hallquist
43 | }
44 | \keyword{internal}
45 |
--------------------------------------------------------------------------------
/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/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[coda:plot.mcmc]{plot.mcmc}}
51 | }
52 | \author{
53 | Joseph Glass, Michael Hallquist
54 | }
55 | \keyword{interface}
56 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
63 | }
64 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
85 | }
86 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/tests/testthat/test-tech10.R:
--------------------------------------------------------------------------------
1 | test_that("TECH10 pattern-level sections are parsed", {
2 | model <- readModels(
3 | target = testthat::test_path("mplus_ug/8.11/ch7/ex7.15.out"),
4 | what = "tech10"
5 | )
6 | tech10 <- model$tech10
7 |
8 | expect_equal(nrow(tech10$univar_model_fit_info), 6)
9 | expect_equal(tech10$univar_model_fit_info$h1[1], "0.403")
10 | expect_equal(tech10$univar_chi_square$Pearson, rep("0.000", 3))
11 | expect_equal(
12 | tech10$univar_overall$value[tech10$univar_overall$stat == "Pearson"],
13 | "0.000"
14 | )
15 |
16 | expect_equal(nrow(tech10$univar_pattern), 48)
17 | expect_equal(nrow(tech10$bivar_pattern), 96)
18 | expect_setequal(
19 | unique(tech10$univar_pattern$LatentClassPattern),
20 | c("1.1.1", "1.1.2", "1.2.1", "1.2.2", "2.1.1", "2.1.2", "2.2.1", "2.2.2")
21 | )
22 |
23 | u1_u2_pattern <- subset(
24 | tech10$bivar_pattern,
25 | LatentClassPattern == "1.1.1" &
26 | var1 == "U1" & var2 == "U2" &
27 | cat1 == "Category 1" & cat2 == "Category 1"
28 | )
29 | expect_equal(u1_u2_pattern$observed, 1)
30 | expect_equal(u1_u2_pattern$stand_resid, -0.007)
31 |
32 | chi_square_row <- subset(
33 | tech10$bivar_chi_square,
34 | var1 == "U1" & var2 == "U2"
35 | )
36 | expect_equal(chi_square_row$Pearson, "0.408")
37 | expect_equal(chi_square_row$Significant, "0")
38 | })
39 |
40 |
41 | test_that("TECH10 class-level sections are parsed", {
42 | model <- readModels(
43 | target = testthat::test_path("mplus_ug/8.11/ch7/ex7.6.out"),
44 | what = "tech10"
45 | )
46 | tech10 <- model$tech10
47 |
48 | expect_equal(nrow(tech10$univar_class), 24)
49 | expect_setequal(unique(tech10$univar_class$LatentClass), c(1, 2))
50 |
51 | class1_u1 <- subset(tech10$univar_class, variable == "U1" & LatentClass == 1)
52 | expect_equal(class1_u1$observed, c(0.649, 0.110, 0.241))
53 |
54 | class2_u3 <- subset(tech10$univar_class, variable == "U3" & LatentClass == 2)
55 | expect_equal(class2_u3$observed[class2_u3$category == 1], 0.605)
56 |
57 | expect_equal(nrow(tech10$bivar_class), 108)
58 | expect_equal(
59 | tech10$bivar_chi_square$Significant[
60 | tech10$bivar_chi_square$var1 == "U1" &
61 | tech10$bivar_chi_square$var2 == "U2"
62 | ],
63 | "1"
64 | )
65 |
66 | bivar_summary <- subset(
67 | tech10$bivar_model_fit_info,
68 | var1 == "U1" & var2 == "U2" & cat1 == "Category 2" & cat2 == "Category 2"
69 | )
70 | expect_equal(bivar_summary$h1, "0.017")
71 | expect_equal(bivar_summary$z, "2.254")
72 | })
73 |
--------------------------------------------------------------------------------
/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/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/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/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: \code{c('stdyx.standardized', 'stdy.standardized', 'std.standardized')}}
27 |
28 | \item{parameter}{Which parameter to plot (from Mplus parameter estimate
29 | headings included in the output).
30 | Defaults to \code{c('Means', 'Intercepts')}.}
31 |
32 | \item{ci}{What confidence interval should the errorbars span? Defaults to
33 | a 95\% confidence interval. Set to NULL to remove errorbars.}
34 |
35 | \item{bw}{Logical. Should the plot be black and white (for print), or color?}
36 |
37 | \item{rawdata}{Should raw data be plotted in the background? Setting this to
38 | TRUE might result in long plotting times. Requires including the Mplus syntax
39 | 'SAVEDATA: FILE IS "filename"; SAVE = cprobabilities' in the Mplus input.}
40 |
41 | \item{alpha_range}{The minimum and maximum values of alpha (transparancy) for
42 | the raw data. Minimum should be 0; lower maximum values of alpha can help
43 | reduce overplotting.}
44 | }
45 | \value{
46 | An object of class 'ggplot'.
47 | }
48 | \description{
49 | Creates a profile plot for a single object of class 'mplus.model', or a
50 | faceted plot of profile plots for an object of class 'mplus.model.list'.
51 | }
52 | \examples{
53 | \dontrun{
54 | res <- createMixtures(classes = 1:2, filename_stem = "cars",
55 | model_overall = "wt ON drat;",
56 | model_class_specific = "wt; qsec;",
57 | rdata = mtcars,
58 | usevariables = c("wt", "qsec", "drat"),
59 | OUTPUT = "standardized",
60 | run = 1L)
61 | plotMixtures(res, rawdata = TRUE)
62 | }
63 | \dontrun{
64 | plotMixtures(res, variables = "wt")
65 | }
66 | \dontrun{
67 | plotMixtures(res, coefficients = "stdyx.standardized")
68 | }
69 | }
70 | \author{
71 | Caspar J. van Lissa
72 | }
73 | \keyword{mixture}
74 | \keyword{mplus}
75 | \keyword{plot}
76 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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-Likelihood` = "0.163",
22 | Significant = "0",
23 | check.names = F
24 | ))
25 |
26 | expect_equal(nrow(m$tech10$univar_class), 16)
27 | expect_equal(m$tech10$univar_class[1,], data.frame(
28 | variable = "U1",
29 | category = 1,
30 | observed = 0.113,
31 | estimated = 0.113,
32 | resid = 0,
33 | stand_resid = 0,
34 | LatentClass = 1
35 | ))
36 |
37 | expect_equal(nrow(m$tech10$bivar_class), 48)
38 | expect_equal(m$tech10$bivar_class[1,], data.frame(
39 | var1 = "U1",
40 | var2 = "U2",
41 | cat1 = "Category 1",
42 | cat2 = "Category 1",
43 | observed = 0.028,
44 | estimated = 0.017,
45 | resid = 0.011,
46 | stand_resid = 0.974,
47 | LatentClass = 1
48 | ))
49 | })
50 |
51 | test_that("Mplus User Guide 7.3 - LCA results can be read in (tech10 error)", {
52 | m <- readModels(target = testthat::test_path("ex7.3_error.out"))
53 | expect_equal(m$summaries$LL, -965.244)
54 | expect_setequal(names(m$tech10), c("bivar_class", "univar_class"))
55 | expect_gt(nrow(m$tech10$univar_class), 0)
56 | expect_gt(nrow(m$tech10$bivar_class), 0)
57 | })
58 |
59 | test_that("Mplus User Guide 7.3 - LCA results can be read in (older Mplus version)", {
60 | m <- readModels(target = testthat::test_path("ex7.3_old.out"))
61 | expect_equal(m$summaries$LL, -965.244)
62 |
63 | expect_equal(nrow(m$tech10$bivar_model_fit_info), 24)
64 | expect_equal(m$tech10$bivar_model_fit_info[1,], data.frame(
65 | var1 = "U1",
66 | var2 = "U2",
67 | cat1 = "Category 1",
68 | cat2 = "Category 1",
69 | h1 = "0.582",
70 | h0 = "0.578",
71 | z = "0.161"
72 | ))
73 |
74 | expect_equal(nrow(m$tech10$bivar_chi_square), 6)
75 | expect_equal(m$tech10$bivar_chi_square[1,], data.frame(
76 | var1 = "U1",
77 | var2 = "U2",
78 | Pearson = "0.162",
79 | `Log-Likelihood` = "0.163",
80 | check.names = F
81 | ))
82 | })
83 |
84 | # Output file obtained from running code from:
85 | # https://github.com/garberadamc/SEM-Lab9
86 | test_that("Test LCA manual 3rd step", {
87 | m <- readModels(target = testthat::test_path("lca_man_3step.out"))
88 | expect_equal(nrow(m$parameters$unstandardized.alt$ref.cat.1), 6)
89 | expect_equal(m$parameters$unstandardized.alt$ref.cat.1$est[[1]], 0.294)
90 | })
91 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 | \enumerate{
56 | \item This results in a normal density plot for the "Total", which is subdivided
57 | by the latent classes, in proportion to the posterior probabilities of
58 | participants being assigned to those clases.
59 | }
60 | }
61 | \examples{
62 | \dontrun{
63 | results <- createMixtures(classes = 1:3, filename_stem = "iris",
64 | rdata = iris, run = 1L)
65 | plotMixtureDensities(results)
66 | }
67 | \dontrun{
68 | plotMixtureDensities(results, variables = "PETAL_LE")
69 | }
70 | \dontrun{
71 | plotMixtureDensities(results, bw = TRUE)
72 | }
73 | \dontrun{
74 | plotMixtureDensities(results, bw = FALSE, conditional = TRUE)
75 | }
76 | \dontrun{
77 | plotMixtureDensities(results[[2]], variables = "PETAL_LE")
78 | }
79 | }
80 | \author{
81 | Caspar J. van Lissa
82 | }
83 | \keyword{mixture}
84 | \keyword{models}
85 | \keyword{mplus}
86 |
--------------------------------------------------------------------------------
/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{https://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 | \itemize{
33 | \item \code{modV1}: The first variable in the pair to be freed according to the M.I.
34 | \item \code{operator}: The suggested relationship between \code{modV1} and \code{modV2}
35 | (e.g., WITH for freeing the covariance between \code{modV1} and \code{modV2})
36 | \item \code{modV2}: The first variable in the pair to be freed according to the M.I.
37 | \item \code{MI}: The decrease in model chi-square if the specified relationship is freely estimated
38 | \item \code{EPC}: The expected parameter estimate between \code{modV1} and \code{modV2} if freed.
39 | \item \code{Std_EPC}: The EPC value standardized using the variances of the continuous latent variables.
40 | \item \code{StdYX_EPC}: The EPC value standardized using the variances of the continuous latent variables as well as the variances of the background and/or outcome variables.
41 | }
42 | }
43 | \description{
44 | Extracts the model modification indices from the MODEL MODIFICATION INDICES section of one
45 | or more Mplus output files. If the \code{target} is a directory, all .out files therein will be parsed
46 | and a single list will be returned, where the list elements are named by the output file name.
47 | Returned parameters typically include the pairwise relationships between variables to be freed,
48 | the change in model chi-square (M.I.), and the expected parameter change (E.P.C.).
49 | }
50 | \examples{
51 | \dontrun{
52 | ex3.14 <- extractModIndices(
53 | "C:/Program Files/Mplus/Mplus Examples/User's Guide Examples/ex3.14.out")
54 | }
55 | }
56 | \seealso{
57 | \code{\link{readModels}}, \code{\link{extractModelSummaries}}, \code{\link{extractModelParameters}}
58 | }
59 | \author{
60 | Michael Hallquist
61 | }
62 | \keyword{internal}
63 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
98 | }
99 | \concept{Mplus-Formatting}
100 | \keyword{interface}
101 |
--------------------------------------------------------------------------------
/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 \href{mailto:jwiley.psych@gmail.com}{jwiley.psych@gmail.com}
71 | }
72 | \keyword{utils}
73 |
--------------------------------------------------------------------------------