Skip to content

Commit

Permalink
version 0.1.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sfcheung authored and cran-robot committed Aug 7, 2022
1 parent 036c63b commit e60c35d
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 64 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: stdmod
Title: Standardized Moderation Effect and Its Confidence Interval
Version: 0.1.7.1
Version: 0.1.7.4
Authors@R:
c(person(given = "Shu Fai",
family = "Cheung",
Expand All @@ -13,7 +13,7 @@ Authors@R:
Description: Functions for computing a standardized moderation effect
in moderated regression and forming its confidence interval
by nonparametric bootstrapping as proposed in
Cheung, Cheung, Lau, Hui, and Vong (2002)
Cheung, Cheung, Lau, Hui, and Vong (2022)
<doi:10.1037/hea0001188>. Also includes simple-to-use
functions for computing conditional effects (unstandardized
or standardized) and plotting moderation effects.
Expand All @@ -28,9 +28,9 @@ Depends: R (>= 4.0.0)
Imports: boot, ggplot2, stats
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2022-05-10 15:11:13 UTC; sfcheung
Packaged: 2022-08-06 23:35:05 UTC; sfcheung
Author: Shu Fai Cheung [aut, cre] (<https://orcid.org/0000-0002-9871-9448>),
David Weng Ngai Vong [ctb]
Maintainer: Shu Fai Cheung <shufai.cheung@gmail.com>
Repository: CRAN
Date/Publication: 2022-05-11 14:40:02 UTC
Date/Publication: 2022-08-07 06:10:02 UTC
25 changes: 13 additions & 12 deletions MD5
@@ -1,6 +1,6 @@
eca94879222e5d7bdcb98b50b20d91d8 *DESCRIPTION
b023375723d7c9fefd604aca45878347 *DESCRIPTION
5bc3d74cfb3e742c66487dff517207f0 *NAMESPACE
351730425c8eb02f0c6b1748dedbf2b0 *NEWS.md
53e0363e7c60f29f6d86e25c71488f17 *NEWS.md
c91012ec543a1d47a5f0676fc59c49e4 *R/add1_stdmod.R
228b2656af6da4104c784f2ccf2a0e22 *R/coef_stdmod_lavaan.R
aac89f72f3a5c8e05e4bff3621612c7b *R/condeff.R
Expand All @@ -11,7 +11,7 @@ fd43e893e7d4af8cbd1df4c9c040450d *R/confint_stdmod_lavaan.R
bcb17baebae7df70b1db3fef7fb27f33 *R/data_2.R
b819d8629b065aab2f664e5f47a023ce *R/data_3.R
49b5410e95b7747809ed3ad1911ab86c *R/data_4.R
9dee4299465c34fca529682b57cfaf18 *R/plotmod.R
1800309201ac145da1d2ab98cb7fb946 *R/plotmod.R
436a80d659ba0c1cc1d04f24f4eb91f0 *R/plotmod_helpers.R
f94d22597a6b0de284fa6a96871d3299 *R/plotmod_helpers_2.R
24276ba812efb227d76038a210770935 *R/print_cond_eff.R
Expand All @@ -28,9 +28,9 @@ bf38e4ea7dcfdd0f833f7730c7bce1c5 *R/summary_stdmod.R
fbdb46b8f7b74a8f9cf683552fc62c12 *R/sweep2.R
828d5dc9e324c120eb600c0d6aaef4f2 *R/update_stdmod.R
c0f8fdf7eaa57831f2234e47a8af0d70 *R/vcov_stdmod.R
561aa4400c844729147f4f886dd06374 *README.md
9ecb0bdfb906213cc54af05f9a8fb645 *build/partial.rdb
c60bb1b090805a8c7f7c67190c96e1e1 *build/vignette.rds
ab789b8c95d0a1883938892b5dbb384f *README.md
afbe4209b3bb961ba3e41cbfe79ea507 *build/partial.rdb
3e0485768439c7a4041c3e9423e3d895 *build/vignette.rds
cfac528a204b0a0ae0235a1f99bafb6a *data/sleep_emo_con.rda
f1f88af1d468fc13dca3e58e09e7c83a *data/test_mod1.rda
7b8802b1880748751497209ff8ca2362 *data/test_mod2.rda
Expand All @@ -42,22 +42,22 @@ d8e41d1a7cc5addf942e6b195e7c1234 *data/test_x_1_w_1_v_1_cat1_n_500.rda
be54d4887582625540fb683eaebc4008 *inst/CITATION
68a460d612afd85434dc570d7e418440 *inst/doc/cond_effect.R
064ac59a51cbeaec9149cc2aea347414 *inst/doc/cond_effect.Rmd
bbfc629c816e9d2d137f888f240bad37 *inst/doc/cond_effect.html
da07a412d57bd90a224f097035c8230c *inst/doc/cond_effect.html
37d1f17ece94601788f65257a1ef2b7c *inst/doc/moderation.R
1ce7ff9c92beae2851e4ccb90d5f1a15 *inst/doc/moderation.Rmd
181566a3330ebe09bf5ab162abc00d59 *inst/doc/moderation.html
be66500b6e0cd4d00d6e819406291933 *inst/doc/moderation.html
191bdffcf5685f094c0069396054d9aa *inst/doc/plotmod.R
9b9c8f70c406980ee02cd588974cd552 *inst/doc/plotmod.Rmd
1e48e69d07fcc2dc9cfe94adfba4eee2 *inst/doc/plotmod.html
a135da513bb28617425b2641dcf95dca *inst/doc/plotmod.html
d77779197a22c1d1a48eadd32ecd61fb *inst/doc/std_selected.R
e24444e738631b55c41cb291b537995a *inst/doc/std_selected.Rmd
bb4675b31e87af4150ee1ba7a54d5948 *inst/doc/std_selected.html
7efd2e38be9ded86e8d07d703806a4f7 *inst/doc/std_selected.html
f2b7ae28dbfb6bc05050a31c93e1aaca *inst/doc/stdmod.R
4131f5c0d70ec5c56a9e21ed34bf0ac2 *inst/doc/stdmod.Rmd
c457de30576dc22b1c4f4fd847c451c4 *inst/doc/stdmod.html
d241dfb16a7bb94df5eb5861a96dc78f *inst/doc/stdmod.html
69252e3f1c22cb1f1a5415a4645281a1 *inst/doc/stdmod_lavaan.R
54ff8a35951957a73cdd5947d094b240 *inst/doc/stdmod_lavaan.Rmd
977a3da5132851961bc0e32fd0074640 *inst/doc/stdmod_lavaan.html
050dc058f96d7e3c11331c4f0be65a71 *inst/doc/stdmod_lavaan.html
e4cc05d13f860685b23f976542a241ba *man/add1.std_selected.Rd
dbe154b5135e5daf33d9cb90aa35a665 *man/coef.stdmod_lavaan.Rd
ac14174b711b9fa5abdc02fcb35e859b *man/cond_effect.Rd
Expand Down Expand Up @@ -87,6 +87,7 @@ d92172a0f9b226f16fceec9c05a3fcae *tests/testthat/test_condeff.R
91f6ecd99222064ecd840703f186790a *tests/testthat/test_condeff_boot.R
f00eb84ea0dd9765daedec971c3fe58d *tests/testthat/test_methods_stdmod_lavaan.R
c36267ef059d87fc6ba3a4ac28d1aef3 *tests/testthat/test_plotmod.R
7410cad3de3df6bba977f5e7f58218f1 *tests/testthat/test_plotmod_percentile_more_levels.R
8ba774ac9ebf215a337ab19e50a92d3c *tests/testthat/test_plotmod_tumble.R
1880af01890ead3b799f64cf9895b68a *tests/testthat/test_stdmod.R
27785ebf267fc1fe1d5766932f260877 *tests/testthat/test_stdmod_cat.R
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
@@ -1,3 +1,11 @@
# stdmod 0.1.7.4

(All major changes after 0.1.7.1)

- Fixed a bug in `plotmod()`. It now correctly handles more than two levels
when `w_method` is set to`"percentile"`. (0.1.7.2, 0.1.7.3)
- Fixed a typo in DESCRIPTION. (0.1.7.4)

# stdmod 0.1.7.1

(All major changes after 0.1.5)
Expand Down
40 changes: 29 additions & 11 deletions R/plotmod.R
Expand Up @@ -228,6 +228,25 @@ plotmod <- function(output, x, w,
sd_levels = c(-1, 1),
sd_to_percentiles = w_sd_to_percentiles,
percentiles = w_percentiles)
tmp <- length(w_levels)
if (tmp == 2) {
w_levels_labels <- c("Low", "High")
}
if (tmp == 3) {
w_levels_labels <- c("Low", "Medium", "High")
}
if (tmp > 3) {
if (w_method == "percentile") {
w_levels_labels <- paste0(formatC(w_percentiles * 100,
digits = 0,
format = "f"),
"%")
} else {
w_levels_labels <- formatC(w_levels,
digits = 2,
format = "f")
}
}
} else {
w_lo <- NA
w_hi <- NA
Expand Down Expand Up @@ -262,15 +281,15 @@ plotmod <- function(output, x, w,
x_levels,
w_levels,
x_levels_labels = c("Low", "High"),
w_levels_labels = c("Low", "High"),
w_levels_labels = w_levels_labels,
other_numeric_on = "mean",
other_categorical_on = "reference")
}
if (graph_type == "tumble") {
mf_list <- mapply(plot_df_meansd_w_numeric,
x_levels = x_levels_list,
w_levels = w_levels,
w_levels_labels = c("Low", "High"),
w_levels_labels = w_levels_labels,
MoreArgs = list(output = output,
x = x,
w = w,
Expand Down Expand Up @@ -355,12 +374,10 @@ plotmod <- function(output, x, w,
b_format <- paste0("%.", digits, "f")

if (w_numeric) {
subtxt <- paste0(w_label, " low: ", x_label, " effect = ",
sprintf(b_format, b_all[1]),
"\n",
w_label, " high: ", x_label, " effect = ",
sprintf(b_format, b_all[2])
)
tmp <- paste0(w_label, " ", w_levels_labels, ": ",
x_label, " effect = ",
sprintf(b_format, b_all))
subtxt <- paste(tmp, collapse = "\n")
} else {
subtxt <- paste0(w_levels,
": ",
Expand All @@ -371,10 +388,11 @@ plotmod <- function(output, x, w,
}
if (w_numeric) {
if (w_method == "percentile") {
tmp <- paste0(w_levels_labels, ": ",
round(w_percentiles * 100, 0),
"th percentile")
cap_txt <- paste0(w_label, " levels: ",
"Low: ", 100 * w_percentiles[1],
"th percentile; Hi: ",
100 * w_percentiles[2], "th percentile")
paste0(tmp, collapse = "; "))
}
if (w_method == "sd") {
cap_txt <- paste0(w_label, " levels: ",
Expand Down
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -42,11 +42,13 @@ https://sfcheung.github.io/stdmod/

# Installation

Stable release versions of this package can be downloaded below:
The stable CRAN version can be installed by `install.packages()`:

https://github.com/sfcheung/stdmod/releases
```
install.packages("stdmod")
```

The latest developmental version of this package at GitHub can be
The latest version of this package at GitHub can be
installed by `remotes::install_github()`:

```
Expand Down
Binary file modified build/partial.rdb
Binary file not shown.
Binary file modified build/vignette.rds
Binary file not shown.
4 changes: 2 additions & 2 deletions inst/doc/cond_effect.html
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Shu Fai Cheung" />

<meta name="date" content="2022-05-10" />
<meta name="date" content="2022-08-07" />

<title>Conditional Effects by cond_effect()</title>

Expand Down Expand Up @@ -349,7 +349,7 @@

<h1 class="title toc-ignore">Conditional Effects by cond_effect()</h1>
<h4 class="author">Shu Fai Cheung</h4>
<h4 class="date">2022-05-10</h4>
<h4 class="date">2022-08-07</h4>



Expand Down

0 comments on commit e60c35d

Please sign in to comment.