Skip to content

Commit

Permalink
update 2025-01-16 13:47:43.595942
Browse files Browse the repository at this point in the history
  • Loading branch information
OPECHEESE committed Jan 16, 2025
1 parent 79b1a42 commit 9513b28
Show file tree
Hide file tree
Showing 102 changed files with 1,406 additions and 1,614 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ Suggests:
VignetteBuilder:
knitr
Encoding: UTF-8
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
LazyData: true
Roxygen: list(markdown = TRUE)
2 changes: 1 addition & 1 deletion R/mixture-pseudo_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pseudo_class_pool <- function(fits, df_complete = NULL, ...) {
cls <- unique(cls)

if ( length(cls) > 1 ) {
stop(paste0("'fits' consists of objects with different classes: ", paste(cl, collapse = ', ')))
stop(paste0("'fits' consists of objects with different classes: ", paste(cls, collapse = ', ')))
}

UseMethod("pseudo_class_pool", fits[[1]])
Expand Down
24 changes: 12 additions & 12 deletions R/mx_mixture.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' \item A list of \code{mxModel} objects, specified by the user.
#' }
#'
#' @return Returns an \code{\link[OpenMx]{mxModel}}.
#' @return Returns an \code{\link[OpenMx:mxModel]{OpenMx::mxModel()}}.
#' @export
#' @keywords mixture models openmx
#' @references Van Lissa, C. J., Garnier-Villarreal, M., & Anadria, D. (2023).
Expand Down Expand Up @@ -88,7 +88,7 @@ mx_mixture <- function(model,
#' the function calls \code{\link{mixture_starts}} and \code{\link{run_mx}}.
#' @param expand_grid Logical, whether or not to estimate all possible combinations of the `variances` and `covariances` arguments. Defaults to `FALSE`.
#' @param ... Additional arguments, passed to functions.
#' @return Returns an \code{\link[OpenMx]{mxModel}}.
#' @return Returns an \code{\link[OpenMx:mxModel]{OpenMx::mxModel()}}.
#' @export
#' @keywords mixture models openmx
#' @references Van Lissa, C. J., Garnier-Villarreal, M., & Anadria, D. (2023).
Expand Down Expand Up @@ -160,7 +160,7 @@ mx_profiles <- function(data = NULL,
#' Estimate growth mixture models using OpenMx
#'
#' This function is a wrapper around \code{\link{mx_mixture}}, adding the
#' default arguments of \code{\link[lavaan]{growth}} to simplify the
#' default arguments of \code{\link[lavaan:growth]{lavaan::growth()}} to simplify the
#' specification of growth mixture models. This function is only
#' useful if all the latent variables in the model are growth factors.
#' @param model Syntax for the model; either a character string, or a list of
Expand All @@ -172,7 +172,7 @@ mx_profiles <- function(data = NULL,
#' @param run Logical, whether or not to run the model. If \code{run = TRUE},
#' the function calls \code{\link{mixture_starts}} and \code{\link{run_mx}}.
#' @param ... Additional arguments, passed to functions.
#' @return Returns an \code{\link[OpenMx]{mxModel}}.
#' @return Returns an \code{\link[OpenMx:mxModel]{OpenMx::mxModel()}}.
#' @export
#' @keywords mixture models openmx
#' @references Van Lissa, C. J., Garnier-Villarreal, M., & Anadria, D. (2023).
Expand Down Expand Up @@ -224,9 +224,9 @@ mx_growth_mixture <- function(model,
#' @param classes A vector of integers, indicating which class solutions to
#' generate. Defaults to 1L. E.g., \code{classes = 1:6},
#' @param run Logical, whether or not to run the model. If \code{run = TRUE},
#' the function calls \code{\link[OpenMx]{mxTryHardOrdinal}}.
#' the function calls \code{\link[OpenMx:mxTryHardOrdinal]{OpenMx::mxTryHardOrdinal()}}.
#' @param ... Additional arguments, passed to functions.
#' @return Returns an \code{\link[OpenMx]{mxModel}}.
#' @return Returns an \code{\link[OpenMx:mxModel]{OpenMx::mxModel()}}.
#' @export
#' @keywords mixture models openmx
#' @references Van Lissa, C. J., Garnier-Villarreal, M., & Anadria, D. (2023).
Expand Down Expand Up @@ -449,7 +449,7 @@ as_mx_mixture <- function(model,
#' \code{mxModel}s.
#' @param model A mixture model of class \code{mxModel}.
#' @param splits Optional. A numeric vector of length equal to the number of
#' rows in the \code{\link{mxData}} used in the \code{model} object. The data
#' rows in the \code{\link[OpenMx:mxData]{OpenMx::mxData()}} used in the \code{model} object. The data
#' will be split by this vector. See Details for the default setting and
#' possible alternatives.
#' @param ... Additional arguments, passed to functions.
Expand All @@ -466,22 +466,22 @@ as_mx_mixture <- function(model,
#' }
#'
#' If the argument \code{splits} is not provided, the function will call
#' \code{\link[stats]{kmeans}}\code{(x = data, centers = classes)$cluster},
#' \code{stats::kmeans(x = data, centers = classes)$cluster},
#' where \code{data} is extracted from the \code{model} argument.
#'
#' Sensible ways to split the data include:
#' \itemize{
#' \item Using Hierarchical clustering:
#' \code{cutree(hclust(dist(data)), k = classes))}
#' \item Using K-means clustering:
#' \code{\link[stats]{kmeans}}\code{(x = data, centers = classes)$cluster}
#' \code{stats::kmeans(x = data, centers = classes)$cluster}
#' \item Using agglomerative hierarchical clustering:
#' \code{hclass(}\code{\link[mclust]{hc}}\code{(data = data), G = classes)[, 1]}
#' \code{mclust::hclass(data = data), G = classes)[, 1]}
#' \item Using a random split:
#' \code{\link{sample.int}}\code{(n = classes,
#' \code{sample.int(n = classes,
#' size = nrow(data), replace = TRUE)}
#' }
#' @return Returns an \code{\link[OpenMx]{mxModel}} with starting values.
#' @return Returns an \code{\link[OpenMx:mxModel]{OpenMx::mxModel()}} with starting values.
#' @export
#' @keywords mixture models openmx
#' @examples
Expand Down
25 changes: 11 additions & 14 deletions R/syntax-add_paths.R
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
#' @title Add paths to an object of class 'tidy_sem'
#' @description Add paths to an object of class \code{tidy_sem}, or replace
#' existing paths. The paths must be specified as
#' \code{\link[lavaan]{model.syntax}}, and separated by commas.
#' \code{\link[lavaan:model.syntax]{lavaan::model.syntax}}, and separated by commas.
#' @param model An object of class \code{tidy_sem}.
#' @param ... Paths to add or substitute, specified in
#' \code{\link{lavaan}{model.syntax}}, and separated by commas.
# @param strict_check Logical, indicating whether or not to throw an error if
# the variable names referenced in the new paths do not exist in the
# \code{data}, or in the \code{dictionary}, or in the existing \code{syntax}
# element. If \code{strict_check = FALSE}, the check is still performed, but
# throws a \code{warning} instead of an \code{error}.
# @param use_cols Character. Which columns to retain from the \code{lavaan}
# parameter table. Defaults to \code{c("lhs", "op", "rhs", "free", "label")}.
#' \code{\link[lavaan:model.syntax]{lavaan::model.syntax}},
#' and separated by commas.
#' @return An object of class \code{tidy_sem}.
#' @details Currently, only the \code{\link{lavaan}{lavaan}} commands \code{~,
#' @details Currently, only the
#' \code{\link[lavaan:lavaan]{lavaan::lavaan()}}
#' commands \code{~,
#' ~~, =~,} and \code{~1} are parsed.
#' @details This function
#' relies on \code{lavaan \link[lavaan]{model.syntax}} to convert syntax strings
#' @details This function relies on
#' \code{\link[lavaan:model.syntax]{lavaan::model.syntax}}
#' to convert syntax strings
#' to \code{lavaan} parameter tables. By default, is uses the arguments
#' \code{int.ov.free = TRUE, int.lv.free = FALSE, auto.fix.first = TRUE,
#' auto.fix.single = TRUE, auto.var = TRUE, auto.cov.lv.x = TRUE,
#' auto.efa = TRUE, auto.th = TRUE, auto.delta = TRUE, auto.cov.y = TRUE,
#' meanstructure = TRUE}, in a similar way
#' to \code{\link[lavaan]{sem}} and \code{\link[lavaan]{cfa}}.
#' to \code{\link[lavaan:sem]{lavaan::sem()}} and \code{\link[lavaan:cfa]{lavaan::cfa()}}.
#' @examples
#' library(lavaan)
#' df <- iris[, 1:4]
Expand All @@ -33,7 +30,7 @@
#' res <- estimate_lavaan(model)
#' summary(res)
#' @seealso
#' \code{\link[lavaan]{model.syntax}}
#' \code{\link[lavaan:model.syntax]{lavaan::model.syntax}}
#' @rdname add_paths
#' @export
#' @importFrom lavaan lavParseModelString
Expand Down
9 changes: 4 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# tidySEM 0.2.7
# tidySEM 0.2.8

* Stop calling tidySEM functions as default arguments of prepare_graph.lavaan().
This ensures that tidySEM works when its namespace is not attached.
* Frank Gootjes contributed pseudo class functionality, new functions are
append_class_draws() and pseudo_class()
* Fix CRAN check NOTES:
+ "Rd file(s) with Rd \link{} targets missing package
anchors"

## Test environments

Expand Down
14 changes: 7 additions & 7 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions docs/CODE_OF_CONDUCT.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9513b28

Please sign in to comment.