Skip to content

Commit a260bf2

Browse files
Merge pull request #224 from michaelhallquist/codex/update-documentation-to-use-markdown-syntax
refactor: convert roxygen docs to markdown
2 parents 3acd1a2 + 37bb0eb commit a260bf2

File tree

10 files changed

+208
-225
lines changed

10 files changed

+208
-225
lines changed

R/MplusAutomation.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
#' and tabulating model parameters and fit statistics.
1111
#'
1212
#' @details The MplusAutomation package has four primary purposes:
13-
#' \enumerate{
14-
#' \item To automatically run groups/batches of models.
15-
#' \item To provide routines to extract model fit statistics, parameter estimates, and raw data from 'Mplus' output files.
16-
#' \item To facilitate comparisons among models
17-
#' \item To provide a template language that allows for the creation of related input files.
18-
#' }
13+
#' * To automatically run groups/batches of models.
14+
#' * To provide routines to extract model fit statistics, parameter estimates, and raw data from 'Mplus' output files.
15+
#' * To facilitate comparisons among models
16+
#' * To provide a template language that allows for the creation of related input files.
1917
#' The core routine for running batches of models is \code{\link{runModels}}, with
2018
#' an easy-to-use GUI wrapper, \code{\link{runModels_Interactive}}.
2119
#'

R/compareModels.R

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,37 @@
88
#'
99
#' Model outputs to be compared should come from the \code{readModels} command.
1010
#'
11-
#' The \code{show} parameter can be one or more of the following, which can be passed as a vector, such as c("equal", "pdiff").
11+
#' The \code{show} parameter can be one or more of the following, which can be
12+
#' passed as a vector, such as c("equal", "pdiff").
1213
#'
13-
#' \describe{
14-
#' \item{show}{
15-
#' \describe{
16-
#' \item{"all"}{Display all available model comparison. Equivalent to
17-
#' c("summaries", "equal", "diff", "pdiff", "unique").}
18-
#' \item{"summaries"}{Print a comparison of model summary statistics. Compares the following summary
19-
#' statistics (where available): c("Title", "Observations", "Estimator", "Parameters", "LL",
20-
#' "AIC", "BIC", "ChiSqM_Value", "ChiSqM_DF", "CFI", "TLI", "RMSEA", "SRMR", "WRMR")}
21-
#' \item{"allsummaries"}{Prints a comparison of all summary statistics available in each model. May
22-
#' generate a lot of output.}
23-
#' \item{"equal"}{Print parameter estimates that are equal between models
24-
#' (i.e., \code{<= equalityMargin["param"]})}.
25-
#' \item{"diff"}{Print parameter estimates that are different between models
26-
#' (i.e., \code{> equalityMargin["param"]})}.
27-
#' \item{"pdiff"}{Print parameter estimates where the p-values differ between models
28-
#' (i.e., \code{> equalityMargin["pvalue"]})}.
29-
#' \item{"unique"}{Print parameter estimates that are unique to each model.}
30-
#' }
31-
#' }
32-
#' }
14+
#' * `"all"`: Display all available model comparison. Equivalent to
15+
#' `c("summaries", "equal", "diff", "pdiff", "unique")`.
16+
#' * `"summaries"`: Print a comparison of model summary statistics. Compares
17+
#' the following summary statistics (where available):
18+
#' `c("Title", "Observations", "Estimator", "Parameters", "LL", "AIC",
19+
#' "BIC", "ChiSqM_Value", "ChiSqM_DF", "CFI", "TLI", "RMSEA", "SRMR",
20+
#' "WRMR")`.
21+
#' * `"allsummaries"`: Print a comparison of all summary statistics available
22+
#' in each model. May generate a lot of output.
23+
#' * `"equal"`: Print parameter estimates that are equal between models
24+
#' (i.e., `<= equalityMargin["param"]`).
25+
#' * `"diff"`: Print parameter estimates that are different between models
26+
#' (i.e., `> equalityMargin["param"]`).
27+
#' * `"pdiff"`: Print parameter estimates where the p-values differ between
28+
#' models (i.e., `> equalityMargin["pvalue"]`).
29+
#' * `"unique"`: Print parameter estimates that are unique to each model.
3330
#'
34-
#' The \code{sort} parameter determines the order in which parameter estimates are displayed. The following options are available:
31+
#' The \code{sort} parameter determines the order in which parameter estimates
32+
#' are displayed. The following options are available:
3533
#'
36-
#' \describe{
37-
#' \item{sort}{
38-
#' \describe{
39-
#' \item{"none"}{No sorting is performed, so parameters are output in the order presented in Mplus. (Default)}
40-
#' \item{"type"}{Sort parameters by their role in the model. This groups output by regression coefficient (ON),
41-
#' factor loadings (BY), covariances (WITH), and so on. Within each type, output is alphabetical.}
42-
#' \item{"alphabetical"}{Sort parameters in alphabetical order.}
43-
#' \item{"maxDiff"}{Sort parameter output by the largest differences between models (high to low).}
44-
#' }
45-
#' }
46-
#' }
34+
#' * `"none"`: No sorting is performed, so parameters are output in the order
35+
#' presented in Mplus. (Default)
36+
#' * `"type"`: Sort parameters by their role in the model. This groups output
37+
#' by regression coefficient (ON), factor loadings (BY), covariances (WITH),
38+
#' and so on. Within each type, output is alphabetical.
39+
#' * `"alphabetical"`: Sort parameters in alphabetical order.
40+
#' * `"maxDiff"`: Sort parameter output by the largest differences between
41+
#' models (high to low).
4742
#'
4843
#' @param m1 The first Mplus model to be compared. Generated by \code{readModels}.
4944
#' @param m2 The second Mplus model to be compared.

R/createModels.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,9 @@ getInitTags <- function(initCollection) {
147147
#' @param initCollection The initial collection
148148
#' @return A list with three elements, where each list represents the location,
149149
#' start character, end character, tag type, etc. of each tag.
150-
#' \describe{
151-
#' \item{initTags}{initMatches}
152-
#' \item{bodyTags}{bodyMatches}
153-
#' \item{bodyText}{bodySection}
154-
#' }
150+
#' * `initTags`: initMatches
151+
#' * `bodyTags`: bodyMatches
152+
#' * `bodyText`: bodySection
155153
#' @keywords internal
156154
parseTags <- function(bodySection, initCollection) {
157155
#first handle init tags

R/data.R

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
#' Latent Class Analysis Demonstration
2-
#'
3-
#' A list containing the Mplus Data, Output Files, and GH5 Files for a
4-
#' demonstration of using MplusAutomation for latent class analysis.
5-
#' Generated by the vignette on latent class analysis.
6-
#'
7-
#' @format A list containing 11 elements.
8-
#' \describe{
9-
#' \item{Data}{2 Class LCA data simulated using Mplus}
10-
#' \item{CFA}{Mplus output file for CFA}
11-
#' \item{LCA2}{Mplus output file for 2 class LCA}
12-
#' \item{LCA3}{Mplus output file for 3 class LCA}
13-
#' \item{LCA4}{Mplus output file for 4 class LCA}
14-
#' \item{LCA5}{Mplus output file for 5 class LCA}
15-
#' \item{CFAGH5}{GH5 file for CFA}
16-
#' \item{LCA2GH5}{GH5 file for 2 class LCA}
17-
#' \item{LCA3GH5}{GH5 file for 3 class LCA}
18-
#' \item{LCA4GH5}{GH5 file for 4 class LCA}
19-
#' \item{LCA5GH5}{GH5 file for 5 class LCA}
20-
#' }
21-
"lcademo"
22-
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+

R/extractModIndices.R

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,14 @@ extractModIndices_1file <- function(outfiletext, filename) {
150150
#' for a single file, and the top-level elements are named after the
151151
#' corresponding output file name. The basic \code{data.frame} containing
152152
#' the MODEL MODIFICATION INDICES section of \code{outfile}. Variables include
153-
#' \item{modV1}{The first variable in the pair to be freed according to the M.I.}
154-
#' \item{operator}{The suggested relationship between \code{modV1} and \code{modV2}
153+
#' * `modV1`: The first variable in the pair to be freed according to the M.I.
154+
#' * `operator`: The suggested relationship between \code{modV1} and \code{modV2
155155
#' (e.g., WITH for freeing the covariance between \code{modV1} and \code{modV2})}
156-
#' \item{modV2}{The first variable in the pair to be freed according to the M.I.}
157-
#' \item{MI}{The decrease in model chi-square if the specified relationship is freely estimated}
158-
#' \item{EPC}{The expected parameter estimate between \code{modV1} and \code{modV2} if freed.}
159-
#' \item{Std_EPC}{The EPC value standardized using the variances of the continuous latent variables.}
160-
#' \item{StdYX_EPC}{The EPC value standardized using the variances of the continuous latent
161-
#' variables as well as the variances of the background and/or outcome variables.}
156+
#' * `modV2`: The first variable in the pair to be freed according to the M.I.
157+
#' * `MI`: The decrease in model chi-square if the specified relationship is freely estimated
158+
#' * `EPC`: The expected parameter estimate between \code{modV1} and \code{modV2} if freed.
159+
#' * `Std_EPC`: The EPC value standardized using the variances of the continuous latent variables.
160+
#' * `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.
162161
#' @author Michael Hallquist
163162
#' @seealso \code{\link{readModels}}, \code{\link{extractModelSummaries}}, \code{\link{extractModelParameters}}
164163
#' @keywords internal

R/extractParameters.R

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -741,40 +741,40 @@ extractParameters_1file <- function(outfiletext, filename, resultType, efa = FAL
741741
#'
742742
#' The core \code{data.frame} for each MODEL RESULTS section typically has the following structure:
743743
#'
744-
#' \item{paramHeader}{The header that begins a given parameter set. Example: "FACTOR1 BY"}
745-
#' \item{param}{The particular parameter being measured (within \code{paramHeader}). Example: "ITEM1"}
746-
#' \item{est}{Parameter estimate value.}
747-
#' \item{se}{Standard error of the estimate}
748-
#' \item{est_se}{Quotient of \code{est/se}, representing z-test/t-test in large samples}
749-
#' \item{pval}{Two-tailed p-value for the \code{est_se} quotient.}
744+
#' * `paramHeader`: The header that begins a given parameter set. Example: "FACTOR1 BY"
745+
#' * `param`: The particular parameter being measured (within \code{paramHeader}). Example: "ITEM1"
746+
#' * `est`: Parameter estimate value.
747+
#' * `se`: Standard error of the estimate
748+
#' * `est_se`: Quotient of \code{est/se}, representing z-test/t-test in large samples
749+
#' * `pval`: Two-tailed p-value for the \code{est_se} quotient.
750750
#'
751751
#' In the case of output from Bayesian estimation (ESTIMATOR=BAYES), the \code{data.frame} will contain
752752
#' a different set of variables, including some of the above, as well as
753-
#' \item{posterior_sd}{Posterior standard deviation of the estimate.}
754-
#' \item{lower_2.5ci}{Lower 2.5 percentile of the estimate.}
755-
#' \item{upper_2.5ci}{Upper 2.5 percentile (aka 97.5 percentile) of the estimate.}
753+
#' * `posterior_sd`: Posterior standard deviation of the estimate.
754+
#' * `lower_2.5ci`: Lower 2.5 percentile of the estimate.
755+
#' * `upper_2.5ci`: Upper 2.5 percentile (aka 97.5 percentile) of the estimate.
756756
#'
757757
#' Also note that the \code{pval} column for Bayesian output represents a one-tailed estimate.
758758
#'
759759
#' In the case of output from a Monte Carlo study (MONTECARLO: and MODEL POPULATION:), the \code{data.frame} will contain
760760
#' a different set of variables, including some of the above, as well as
761-
#' \item{population}{Population parameter value.}
762-
#' \item{average}{Average parameter estimate across replications.}
763-
#' \item{population_sd}{Standard deviation of parameter value in population across replications.}
764-
#' \item{average_se}{Average standard error of estimated parameter value across replications.}
765-
#' \item{mse}{Mean squared error.}
766-
#' \item{cover_95}{Proportion of replications whose 95\% confidence interval for the parameter includes the population value.}
767-
#' \item{pct_sig_coef}{Proportion of replications for which the two-tailed significance test of the parameter is significant (p < .05).}
761+
#' * `population`: Population parameter value.
762+
#' * `average`: Average parameter estimate across replications.
763+
#' * `population_sd`: Standard deviation of parameter value in population across replications.
764+
#' * `average_se`: Average standard error of estimated parameter value across replications.
765+
#' * `mse`: Mean squared error.
766+
#' * `cover_95`: Proportion of replications whose 95\% confidence interval for the parameter includes the population value.
767+
#' * `pct_sig_coef`: Proportion of replications for which the two-tailed significance test of the parameter is significant (p < .05).
768768
#'
769769
#' In the case of confidence interval output (OUTPUT:CINTERVAL), the list element \code{ci.unstandardized} will contain
770770
#' a different set of variables, including some of the above, as well as
771-
#' \item{low.5}{Lower 0.5\% CI estimate.}
772-
#' \item{low2.5}{Lower 2.5\% CI estimate.}
773-
#' \item{low5}{Lower 5\% CI estimate.}
774-
#' \item{est}{Parameter estimate value.}
775-
#' \item{up5}{Upper 5\% (i.e., 95\%) CI estimate.}
776-
#' \item{up2.5}{Upper 2.5\% (i.e., 97.5\%) CI estimate.}
777-
#' \item{up.5}{Upper 0.5\% (i.e., 99.5\%) CI estimate.}
771+
#' * `low.5`: Lower 0.5\% CI estimate.
772+
#' * `low2.5`: Lower 2.5\% CI estimate.
773+
#' * `low5`: Lower 5\% CI estimate.
774+
#' * `est`: Parameter estimate value.
775+
#' * `up5`: Upper 5\% (i.e., 95\%) CI estimate.
776+
#' * `up2.5`: Upper 2.5\% (i.e., 97.5\%) CI estimate.
777+
#' * `up.5`: Upper 0.5\% (i.e., 99.5\%) CI estimate.
778778
#'
779779
#' If the model contains multiple latent classes, an additional variable, \code{LatentClass},
780780
#' will be included, specifying the latent class number. Also, the Categorical Latent Variables section
@@ -803,4 +803,4 @@ extractModelParameters <- function(target=getwd(), recursive=FALSE, filefilter,
803803
#extractParameters_1section: extract model parameters for a given section.
804804
#extractParameters_1chunk: extract model parameters for a given chunk (e.g., Latent class 2, Between Level) within a given section.
805805

806-
}
806+
}

R/extractSaveData.R

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
#' If \code{outfile} is a relative path or just the filename, then it is assumed that the file resides in
1010
#' the working directory \code{getwd()}.
1111
#' @return Returns a list of SAVEDATA file information that includes:
12-
#' \item{fileName}{The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.}
13-
#' \item{fileVarNames}{A character vector containing the names of variables in the dataset.}
14-
#' \item{fileVarFormats}{A character vector containing the Fortran-style formats of variables in the dataset.}
15-
#' \item{fileVarWidths}{A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).}
16-
#' \item{bayesFile}{The name of the BPARAMETERS file containing draws from the posterior distribution created by
17-
#' the Mplus SAVEDATA BPARAMETERS command.}
18-
#' \item{bayesVarNames}{A character vector containing the names of variables in the BPARAMETERS dataset.}
19-
#' \item{tech3File}{A character vector of the tech 3 output.}
20-
#' \item{tech4File}{A character vector of the tech 4 output.}
12+
#' * `fileName`: The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.
13+
#' * `fileVarNames`: A character vector containing the names of variables in the dataset.
14+
#' * `fileVarFormats`: A character vector containing the Fortran-style formats of variables in the dataset.
15+
#' * `fileVarWidths`: A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).
16+
#' * `bayesFile`: The name of the BPARAMETERS file containing draws from the posterior distribution created by the Mplus SAVEDATA BPARAMETERS command.
17+
#' * `bayesVarNames`: A character vector containing the names of variables in the BPARAMETERS dataset.
18+
#' * `tech3File`: A character vector of the tech 3 output.
19+
#' * `tech4File`: A character vector of the tech 4 output.
2120
#' @author Michael Hallquist
2221
#' @seealso \code{\link{getSavedata_Data}}
2322
#' @examples
@@ -55,15 +54,14 @@ getSavedata_Fileinfo <- function(outfile) {
5554
#' output file.
5655
#' @param outfiletext The contents of the output file, for example as read by \code{scan}
5756
#' @return A list that includes:
58-
#' \item{fileName}{The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.}
59-
#' \item{fileVarNames}{A character vector containing the names of variables in the dataset.}
60-
#' \item{fileVarFormats}{A character vector containing the Fortran-style formats of variables in the dataset.}
61-
#' \item{fileVarWidths}{A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).}
62-
#' \item{bayesFile}{The name of the BPARAMETERS file containing draws from the posterior distribution created by
63-
#' the Mplus SAVEDATA BPARAMETERS command.}
64-
#' \item{bayesVarNames}{A character vector containing the names of variables in the BPARAMETERS dataset.}
65-
#' \item{tech3File}{A character vector of the tech 3 output.}
66-
#' \item{tech4File}{A character vector of the tech 4 output.}
57+
#' * `fileName`: The name of the file containing the analysis dataset created by the Mplus SAVEDATA command.
58+
#' * `fileVarNames`: A character vector containing the names of variables in the dataset.
59+
#' * `fileVarFormats`: A character vector containing the Fortran-style formats of variables in the dataset.
60+
#' * `fileVarWidths`: A numeric vector containing the widths of variables in the dataset (which is stored in fixed-width format).
61+
#' * `bayesFile`: The name of the BPARAMETERS file containing draws from the posterior distribution created by the Mplus SAVEDATA BPARAMETERS command.
62+
#' * `bayesVarNames`: A character vector containing the names of variables in the BPARAMETERS dataset.
63+
#' * `tech3File`: A character vector of the tech 3 output.
64+
#' * `tech4File`: A character vector of the tech 4 output.
6765
#' @importFrom gsubfn strapply
6866
#' @seealso \code{\link{getSavedata_Data}}
6967
#' @examples

0 commit comments

Comments
 (0)