Skip to content

Commit

Permalink
Merge pull request #115 from sfcheung/devel
Browse files Browse the repository at this point in the history
Update to 0.1.12
  • Loading branch information
sfcheung authored Aug 21, 2023
2 parents 8c5e9f2 + 00056b6 commit 8def20b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: manymome
Title: Mediation, Moderation and Moderated-Mediation After Model Fitting
Version: 0.1.11.3
Version: 0.1.12
Authors@R:
c(person(given = "Shu Fai",
family = "Cheung",
Expand Down
16 changes: 15 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# manymome 0.1.11.3
# manymome 0.1.12

## New Features

Expand All @@ -20,6 +20,13 @@

- Customized `linters`. (0.1.11.1)

- Revised a test to accommodate a
behavior of MKL when `MASS::mvrnorm()`
is used to generate pseudo random
numbers. (0.1.11.4)

- Finalized to 0.1.12. (0.1.12)

## Bug Fixes

- *P*-value were not computed when
Expand All @@ -33,6 +40,13 @@
present in merged outputs. Fixed
in 0.1.11.3. (0.1.11.3)

- `cond_indirect()` did not hide the
progress when Monte Carlo CIs were
requested and `do_mc()` was called
internally. Fixed. It now hides the
progress if `progress = TRUE`.
(0.1.11.5)

# manymome 0.1.10

## New Features
Expand Down
5 changes: 3 additions & 2 deletions R/cond_indirect.R
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,9 @@ cond_indirect <- function(x,
}
} else {
mc_out <- do_mc(fit = fit,
R = R,
seed = seed)
R = R,
seed = seed,
progress = progress)
}
}
if (boot_ci) {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![R-CMD-check](https://github.com/sfcheung/manymome/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/sfcheung/manymome/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

(Version 0.1.11.3, updated on 2023-08-01, used a new color scheme and logo, [release history](https://sfcheung.github.io/manymome/news/index.html))
(Version 0.1.12, updated on 2023-08-21, [release history](https://sfcheung.github.io/manymome/news/index.html))

# manymome <img src="man/figures/logo.png" align="right" height="150" />

Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ bibentry(
textVersion =
paste("Cheung, S. F., & Cheung, S.-H. (2023).",
"manymome: An R package for computing the indirect effects, conditional effects, and conditional indirect effects.",
"R package version 0.1.11.3",
"R package version 0.1.12",
"https://github.com/sfcheung/manymome/")
)
32 changes: 22 additions & 10 deletions tests/testthat/test_cond_indirect_lavaan.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ outmo_mc <- cond_indirect(x = "m2", y = "m3", wvalues = c(m1 = -5),
fit = fitmoml,
mc_ci = TRUE,
R = 50,
seed = 8536)
seed = 8536,
save_mc_out = TRUE)
# Emulate se = boot
fitmo_boot_mc <- gen_mc_est(fitmoml, R = 50, seed = 8536)
fitmo_boot_mc@boot <- fitmo_boot@boot
Expand All @@ -221,10 +222,16 @@ outmo_boot_mc <- cond_indirect(x = "m2", y = "m3", wvalues = c(m1 = -5),
fit = fitmo_boot_mc,
boot_ci = TRUE)

test_that("cond_indirect: lavaan, moderation only: mc", {
expect_equal(outmo_mc$indirect, outmo_chk$indirect)
expect_equal(outmo_mc$mc_ci, outmo_boot_mc$boot_ci)
})
# For MKL
# Proceed only if RNG results identical
tmp1 <- sapply(outmo_mc$mc_out, function(x) x$est[1:4, "est"])
tmp2 <- t(fitmo_boot_mc@external$manymome$mc[, 1:4])
if (isTRUE(all.equal(tmp1, tmp2, check.attributes = FALSE))) {
test_that("cond_indirect: lavaan, moderation only: mc", {
expect_equal(outmo_mc$indirect, outmo_chk$indirect)
expect_equal(outmo_mc$mc_ci, outmo_boot_mc$boot_ci)
})
}

# Test ci_out

Expand Down Expand Up @@ -284,8 +291,13 @@ outmo_boot2 <- cond_indirect(x = "m2", y = "m3", wvalues = c(m1 = -5),
fit = fitmo,
ci_type = "boot",
ci_out = bootmo_out)

test_that("cond_indirect: lavaan, moderation only: ci_type", {
expect_equal(outmo_mc$mc_ci, outmo_mc2$mc_ci)
expect_equal(outmo_boot$boot_ci, outmo_boot2$boot_ci)
})
# For MKL
# Proceed only if RNG results identical
tmp1 <- sapply(outmo_mc$mc_out, function(x) x$est[1:4, "est"])
tmp2 <- sapply(fitmo_mc_out, function(x) x$est[1:4, "est"])
if (isTRUE(all.equal(tmp1, tmp2, check.attributes = FALSE))) {
test_that("cond_indirect: lavaan, moderation only: ci_type", {
expect_equal(outmo_mc$mc_ci, outmo_mc2$mc_ci)
expect_equal(outmo_boot$boot_ci, outmo_boot2$boot_ci)
})
}

0 comments on commit 8def20b

Please sign in to comment.