Skip to content

Commit

Permalink
Release to CRAN 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewlcheung committed May 17, 2024
1 parent b279e06 commit 8507c3d
Show file tree
Hide file tree
Showing 10 changed files with 1,001 additions and 591 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: metaSEM
Type: Package
Title: Meta-Analysis using Structural Equation Modeling
Version: 1.4.0
Date: 2024-04-08
Date: 2024-05-15
Depends: R (>= 3.4.0), OpenMx
Imports: Matrix, MASS, ellipse, graphics, stats, utils, mvtnorm, numDeriv, lavaan
Suggests: metafor, semPlot, R.rsp, testthat, matrixcalc
Expand Down
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Release 1.4.0 (Apr 8, 2024)
Release 1.4.0 (May 15, 2024)
====================================
* Release to CRAN.
* Revise create.mxModel().
* Replace dontrun with donttest.

Release 1.3.1 (Aug 8, 2023)
====================================
* Release to CRAN.
* Lower the tolerance in testing asyCov(), which returns an error in latest R.

Release 1.3.0 (Jan 7, 2023)
Expand Down
27 changes: 15 additions & 12 deletions R/create.mxModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,25 @@ create.mxModel <- function(model.name="mxModel", RAM=NULL, data=NULL,
}
}

if (run==FALSE) return(mx.model)
if (run) {

## Default is z
mx.fit <- tryCatch(mxRun(mx.model, intervals=(intervals.type=="LB"),
suppressWarnings=TRUE, silent=TRUE, ...),
error=function(e) e)

## Check if any errors
if (inherits(mx.fit, "error")) {
mx.fit <- mxTryHard(mx.model, extraTries=50, intervals=FALSE, silent=TRUE)
mx.fit <- tryCatch(mxRun(mx.fit, intervals=(intervals.type=="LB"),
## Default is z
mx.fit <- tryCatch(mxRun(mx.model, intervals=(intervals.type=="LB"),
suppressWarnings=TRUE, silent=TRUE, ...),
error=function(e) e)
if (inherits(mx.fit, "error")) {
warning("Error in running mxModel.\n")

## Check if any errors
if (inherits(mx.fit, "error")) {
mx.fit <- mxTryHard(mx.model, extraTries=50, intervals=FALSE, silent=TRUE)
mx.fit <- tryCatch(mxRun(mx.fit, intervals=(intervals.type=="LB"),
suppressWarnings=TRUE, silent=TRUE, ...),
error=function(e) e)
if (inherits(mx.fit, "error")) {
warning("Error in running mxModel.\n")
}
}
} else {
mx.fit <- mx.model
}

out <- list(mx.fit=mx.fit, RAM=RAM, data=data, mxalgebras=mxalgebras.ci,
Expand Down
4 changes: 2 additions & 2 deletions R/meta2semPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ plot.osmasem <- function(x, manNames=NULL, latNames=NULL, labels=c("labels", "RA

labels <- match.arg(labels)
if (labels=="labels") {
A.labels <- x$mx.model$A0$labels
S.labels <- x$mx.model$S0$labels
A.labels <- x$mx.fit$A0$labels
S.labels <- x$mx.fit$S0$labels
labels <- c(c(A.labels), c(S.labels))
row.pars <- as.numeric(row.names(out@Pars))
out@Pars$label <- labels[row.pars]
Expand Down
10 changes: 5 additions & 5 deletions R/osmasem.R
Original file line number Diff line number Diff line change
Expand Up @@ -512,14 +512,13 @@ osmasem <- function(model.name="osmasem", RAM=NULL, Mmatrix=NULL,
## Assign same starting values, e.g., A and S matrices are different from those in provided in Jmatrix
mx.model <- omxAssignFirstParameters(mx.model)

## Return mx model without running the analysis
if (run==FALSE) {
return(mx.model)
} else {
if (run) {
mx.fit <- tryCatch(do.call(mxRun, c(list(mx.model, intervals=intervals,
suppressWarnings=suppressWarnings,
silent=silent),
mxRun.Args)), error = function(e) e)
} else {
mx.fit <- mx.model
}

# try to run it with error message as output
Expand All @@ -538,7 +537,8 @@ osmasem <- function(model.name="osmasem", RAM=NULL, Mmatrix=NULL,
mxRun.Args=mxRun.Args,
subset.variables=subset.variables,
subset.rows=subset.rows,
mx.model=mx.model, mx.fit=mx.fit)
#mx.model=mx.model,
mx.fit=mx.fit)
class(out) <- 'osmasem'
out
}
Expand Down
2 changes: 0 additions & 2 deletions man/Cheung09.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ A list of data with the following structure:
\item{n}{A vector of sample sizes}
}
}
\source{Cheung, M. W.-L. (2009). TSSEM: A LISREL syntax generator for two-stage structural equation modeling (Version 1.11) [Computer software]. Retrieved from \url{http://courses.nus.edu.sg/course/psycwlm/internet/tssem.zip}.
}
\references{
Cheung, M. W.-L., & Chan, W. (2005). Meta-analytic structural equation modeling: A two-stage approach. \emph{Psychological Methods}, \bold{10}, 40-64.
Expand Down
2 changes: 1 addition & 1 deletion man/metaSEM-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Package: \tab metaSEM\cr
Type: \tab Package\cr
Version: \tab 1.4.0\cr
Date: \tab 2024-04-08\cr
Date: \tab 2024-05-15\cr
License: \tab GPL (>=2)\cr
LazyLoad: \tab yes\cr
}
Expand Down
4 changes: 2 additions & 2 deletions man/tssem1.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ tssem1REM(Cov, n, cor.analysis=TRUE, RE.type=c("Diag", "Symm", "Zero","User"),
}
\item{RE.type}{Either \code{"Diag"}, \code{"Symm"},
\code{"Zero"} or \code{"User"}. If it is
\code{"Diag"}, a diagonal matrix is used for the random effects
meaning that the random effects are independent. If it is \code{"Symm"} (default if missing), a
\code{"Diag"} (default if missing), a diagonal matrix is used for the random effects
meaning that the random effects are independent. If it is \code{"Symm"}, a
symmetric matrix is used for the random effects on the covariances
among the correlation (or covariance) vectors. If it is
\code{"Zero"}, there is no random effects which is similar to the
Expand Down
1,537 changes: 972 additions & 565 deletions vignettes/Examples.html

Large diffs are not rendered by default.

Binary file modified vignettes/metaSEM.pdf
Binary file not shown.

0 comments on commit 8507c3d

Please sign in to comment.