Skip to content

Commit

Permalink
version 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
sfcheung authored and cran-robot committed Mar 10, 2023
1 parent 2e4bf04 commit 1fde242
Show file tree
Hide file tree
Showing 38 changed files with 2,796 additions and 1,685 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: stdmod
Title: Standardized Moderation Effect and Its Confidence Interval
Version: 0.2.1
Version: 0.2.6
Authors@R:
c(person(given = "Shu Fai",
family = "Cheung",
Expand All @@ -22,15 +22,15 @@ BugReports: https://github.com/sfcheung/stdmod/issues
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Suggests: testthat, dplyr, knitr, rmarkdown, lavaan, visreg, lm.beta
Depends: R (>= 4.0.0)
Imports: boot, ggplot2, stats
Imports: boot, ggplot2, stats, utils, rlang
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2022-10-09 09:26:00 UTC; sfcheung
Packaged: 2023-03-10 10:49:59 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-10-09 10:20:02 UTC
Date/Publication: 2023-03-10 11:20:02 UTC
68 changes: 37 additions & 31 deletions MD5
@@ -1,37 +1,39 @@
7adfeb731c6b38767bbbc9dcba7d2fc1 *DESCRIPTION
5bc3d74cfb3e742c66487dff517207f0 *NAMESPACE
697fc8750bdd5efce61423c94623213d *NEWS.md
b1088a316e18e184af8e1d76dc31f29a *DESCRIPTION
84d58b755ec05446d92870081518805d *NAMESPACE
d4a4723386b5f4f317efbf1afac20be7 *NEWS.md
c91012ec543a1d47a5f0676fc59c49e4 *R/add1_stdmod.R
2c6043165c2870eec8028e655c380b22 *R/coef_condeff.R
228b2656af6da4104c784f2ccf2a0e22 *R/coef_stdmod_lavaan.R
aac89f72f3a5c8e05e4bff3621612c7b *R/condeff.R
adb1548d2cb3f6c25ed3156dd2c4fe12 *R/condeff_boot.R
d72229fd60f958970d91f0af301cc5a0 *R/condeff.R
377e7e27ca69904b9e1ea70ed3f9a286 *R/condeff_boot.R
6b9712e6d6f66f3a528efa8e5c2d28e3 *R/confint_condeff.R
5dbd7364389095f0e170825e5f0a38d0 *R/confint_stdmod.R
fd43e893e7d4af8cbd1df4c9c040450d *R/confint_stdmod_lavaan.R
18789f69bde80da16b7911f2a1c9d94c *R/data.R
bcb17baebae7df70b1db3fef7fb27f33 *R/data_2.R
b819d8629b065aab2f664e5f47a023ce *R/data_3.R
49b5410e95b7747809ed3ad1911ab86c *R/data_4.R
687854d151b006cdd910d6f6bdfee6ec *R/helpers.R
1800309201ac145da1d2ab98cb7fb946 *R/plotmod.R
4e924188415938b44d4f2e5063b8c0a0 *R/plotmod.R
436a80d659ba0c1cc1d04f24f4eb91f0 *R/plotmod_helpers.R
f94d22597a6b0de284fa6a96871d3299 *R/plotmod_helpers_2.R
24276ba812efb227d76038a210770935 *R/print_cond_eff.R
834ef210024d246447ac5ee0995582da *R/print_stdmod.R
80a2eadc13c1839cf0b1df404ffc10ae *R/print_cond_eff.R
6d1e26948567c8d37108b1bb8d6adc8a *R/print_stdmod.R
1108bbe92d2457ec32d4ec6f75636712 *R/print_stdmod_lavaan.R
53381afd6dd8e2ccdb26a7bb9ffbf0dd *R/print_summary_stdmod.R
a67c7cc81f8757e5b3f30be35c4d8d07 *R/print_summary_stdmod.R
d172092655df3a5a4cd4a7eee04af951 *R/std_selected.R
800e8b25a23ec69ea5609e92e0c9974a *R/std_selected_boot.R
f88f807b109c5a7098c56e320156e4da *R/std_selected_boot.R
af8e04a1500b54783ccfe6646910e923 *R/stdmod-package.R
582687ed0f63ef323470db4643ea7d66 *R/stdmod.R
f94c6ce9a91686b315a67d30fc57622d *R/stdmod_bootci.R
a04965fa4b650a376e5c0ed0a1ad34ad *R/stdmod_lavaan.R
bf38e4ea7dcfdd0f833f7730c7bce1c5 *R/summary_stdmod.R
1eb65f93ba1ea4383f02beed9b277acb *R/summary_stdmod.R
fbdb46b8f7b74a8f9cf683552fc62c12 *R/sweep2.R
828d5dc9e324c120eb600c0d6aaef4f2 *R/update_stdmod.R
22421b57671dae1837ae82e6e9bfd4a5 *R/vcov_stdmod.R
f82eca7f3185395129b63b5fe71aee43 *README.md
afbe4209b3bb961ba3e41cbfe79ea507 *build/partial.rdb
3e0485768439c7a4041c3e9423e3d895 *build/vignette.rds
2ef5ccdbfa6cb7d971b1f62af1a68401 *README.md
cb4924f3573383fca290a0a8e2ca5294 *build/partial.rdb
794cdaae68e285aa321299e9fcbd7448 *build/vignette.rds
cfac528a204b0a0ae0235a1f99bafb6a *data/sleep_emo_con.rda
f1f88af1d468fc13dca3e58e09e7c83a *data/test_mod1.rda
7b8802b1880748751497209ff8ca2362 *data/test_mod2.rda
Expand All @@ -40,37 +42,39 @@ d8e41d1a7cc5addf942e6b195e7c1234 *data/test_x_1_w_1_v_1_cat1_n_500.rda
0e71f0847c281c5131fde40e44a9aff2 *data/test_x_1_w_1_v_1_cat1_xw_cov_n_500.rda
78224e75a3bf3eec15b00ad6e94508e4 *data/test_x_1_w_1_v_1_cat1_xw_cov_wcat3_n_500.rda
27e139e81a7e481f51bcc9ad461b3ec6 *data/test_x_1_w_1_v_2_n_500.rda
791780661b0f355eadccebfb957f5b9b *inst/CITATION
3faf7434efb51873a4810b1dcc0f0e06 *inst/CITATION
68a460d612afd85434dc570d7e418440 *inst/doc/cond_effect.R
44292c6c047dab691255ea478525e37c *inst/doc/cond_effect.Rmd
fbcbb81ac450300c14994192e53efe00 *inst/doc/cond_effect.html
034192441fa2a6dfce313137d6f4de2c *inst/doc/cond_effect.html
37d1f17ece94601788f65257a1ef2b7c *inst/doc/moderation.R
4821b8978fab7b2bbf3b2ce3e053d50f *inst/doc/moderation.Rmd
cf7f4852142b896d8cb11c66b49469e0 *inst/doc/moderation.html
3d3ba2b3c155747fdba288e38f96ac46 *inst/doc/moderation.html
191bdffcf5685f094c0069396054d9aa *inst/doc/plotmod.R
7a819d0e3f180f0ff974a4e09035c3e0 *inst/doc/plotmod.Rmd
65d727571f1765d975f608a19420967b *inst/doc/plotmod.html
0595588997e86d07786794ed970bd5a7 *inst/doc/plotmod.html
d77779197a22c1d1a48eadd32ecd61fb *inst/doc/std_selected.R
d475f65b2a785902f6a27a690aee486c *inst/doc/std_selected.Rmd
bbd2467b519b808895c949a7aef8e807 *inst/doc/std_selected.html
87578c6bf301312cee62d76039f5dfee *inst/doc/std_selected.html
f2b7ae28dbfb6bc05050a31c93e1aaca *inst/doc/stdmod.R
2f5212ffdf4f966864c74a94cc4e38b1 *inst/doc/stdmod.Rmd
835f2b8d6fb4cf452c8cd323ad4e3157 *inst/doc/stdmod.html
a38b813310ba4aafbd930e0d0b922898 *inst/doc/stdmod.html
69252e3f1c22cb1f1a5415a4645281a1 *inst/doc/stdmod_lavaan.R
efafc302a2d898970b1ed524e47f236c *inst/doc/stdmod_lavaan.Rmd
15f78011ad8a048553b955ac582a0ba5 *inst/doc/stdmod_lavaan.html
30da20d6038af48fbec411db9eeae639 *inst/doc/stdmod_lavaan.html
e4cc05d13f860685b23f976542a241ba *man/add1.std_selected.Rd
8c9998f9d5b29fabc0a4cec3007b35c4 *man/coef.cond_effect.Rd
dbe154b5135e5daf33d9cb90aa35a665 *man/coef.stdmod_lavaan.Rd
8ba5d363321973b81aed4d6508a60396 *man/cond_effect.Rd
9ba22dfce8d61aa9f7d1316c5e0a922b *man/cond_effect.Rd
5198f393062541bd003e896646fa4fac *man/confint.cond_effect.Rd
cf31f019540640d9106585a360d7fe9d *man/confint.std_selected.Rd
2a098cbfe898693d61ca4c602387bc7b *man/confint.stdmod_lavaan.Rd
1023fab748e7f2facdd56149d8298ff8 *man/plotmod.Rd
976cbf2f5d67df651528cad35ddc276c *man/print.cond_effect.Rd
e23c46f3a24789d01c01afb7bc48ae2c *man/print.std_selected.Rd
1b169ca01ea84708be6288efe9a4e674 *man/print.cond_effect.Rd
7a5ea08bac5422af15d6116f3889c2b7 *man/print.std_selected.Rd
e31f769a6607fbeaf37a1622b79ba250 *man/print.stdmod_lavaan.Rd
7e932362c2194691c75e70aaad2d08f4 *man/print.summary.std_selected.Rd
3f5183cfef6a509a391c972386ddec31 *man/sleep_emo_con.Rd
5f9f69a758948b5a0dd612ec15b5fdcd *man/std_selected.Rd
b98adf04bf00d20ca0f51a36aef46a7d *man/std_selected.Rd
28cdfe3b692b01b9fe801b8e64ded12b *man/stdmod.Rd
46408bfc330859acf98e0565ba857cb4 *man/stdmod_lavaan.Rd
34638a9746f61ae47249437d53c03ca8 *man/summary.std_selected.Rd
Expand All @@ -84,22 +88,24 @@ ef5a016dfb84e5a0b807214950e8cc12 *man/test_x_1_w_1_v_2_n_500.Rd
80273b94c536f4e766849461b04bd346 *man/update.std_selected.Rd
88503b7ebc87f258aaa1d28496fac6f9 *man/vcov.std_selected.Rd
7de8723b98d69588e7e44c5b0a02e626 *tests/testthat.R
d92172a0f9b226f16fceec9c05a3fcae *tests/testthat/test_condeff.R
91f6ecd99222064ecd840703f186790a *tests/testthat/test_condeff_boot.R
1186c93a7c48645bca4c6a1b78572148 *tests/testthat/test_condeff.R
49f327dc3f01f5b41b5376bba67dc0d5 *tests/testthat/test_condeff_boot.R
53e541030c06662d65209e6f11b3eaf9 *tests/testthat/test_condeff_boot_methods.R
8fbc0aff90b2f4d0f14b1982a9a2ae4a *tests/testthat/test_condeff_methods.R
f00eb84ea0dd9765daedec971c3fe58d *tests/testthat/test_methods_stdmod_lavaan.R
5b730efd30d26f7ce322d9274f29ab48 *tests/testthat/test_plotmod.R
13ee08b488bf067c6597193f9f6df3c3 *tests/testthat/test_plotmod.R
1a5c74f3f30a1e5452c0f4f00d86bae1 *tests/testthat/test_plotmod_percentile_more_levels.R
18651fa8e64a7fc7d1e12e4436d38f25 *tests/testthat/test_plotmod_tumble.R
a6915c8ac83a614ca673467b0aa4e7ea *tests/testthat/test_plotmod_tumble.R
1880af01890ead3b799f64cf9895b68a *tests/testthat/test_stdmod.R
27785ebf267fc1fe1d5766932f260877 *tests/testthat/test_stdmod_cat.R
d982cd037d8d95781d07ebc8c69be47b *tests/testthat/test_stdmod_lavaan.R
3d3f135be63f00f160397bc67474e5b6 *tests/testthat/test_stdmod_lavaan2.R
3a091eb20eacee81ea27417035983942 *tests/testthat/test_stdmod_lavaan3_warning.R
77944c9e059749ba63a87406870f5302 *tests/testthat/test_stdmod_selected.R
f76d49855b061eaa2dadb6ec16f7a621 *tests/testthat/test_stdmod_selected.R
a6f4939e19239863fb98de061d913ec4 *tests/testthat/test_stdmod_selected_boot.R
254241f29601afc00eec70928f4c0ee7 *tests/testthat/test_stdmod_selected_boot_fac.R
e073431cd6c6a888e77edb692b0a3c1d *tests/testthat/test_stdmod_selected_confint.R
28018031920b7de106b7a6c0d19faf61 *tests/testthat/test_stdmod_selected_fac.R
463234da940f6f3fd3bf4fc534d94ad2 *tests/testthat/test_stdmod_selected_fac.R
306aa52355cc517ca587f6352dbf476f *tests/testthat/test_stdmod_selected_update.R
436288a2f8303dc81863cb2cb765e0b7 *tests/testthat/test_stdmod_selected_vcov.R
c01e6e9cf77d6d46ab8baa177bec0097 *tests/testthat/test_stdmod_update.R
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
@@ -1,7 +1,9 @@
# Generated by roxygen2: do not edit by hand

S3method(add1,std_selected)
S3method(coef,cond_effect)
S3method(coef,stdmod_lavaan)
S3method(confint,cond_effect)
S3method(confint,std_selected)
S3method(confint,stdmod_lavaan)
S3method(print,cond_effect)
Expand All @@ -19,3 +21,4 @@ export(std_selected_boot)
export(stdmod)
export(stdmod_boot)
export(stdmod_lavaan)
importFrom(rlang,.data)
26 changes: 25 additions & 1 deletion NEWS.md
@@ -1,7 +1,31 @@
# stdmod 0.2.1
# stdmod 0.2.6

- Improved the printout of the `summary()` of `std_selected()`
and `std_selected_boot()` outputs. (0.2.4.9001).
- Fixed deprecated functions and arguments in `ggplot2`. (0.2.4.9002)
- Fixed a problem with wrapping long lines in the
printout of the `summary()` of `std_selected()`. (0.2.4.9003)
- Update GitHub actions.
- Fixed a missing link in an Rd file in old macOS machines. (0.2.6)
- Use `bibentry()` in CITATION. (0.2.6)

# stdmod 0.2.4

- Fixed a bug in `std_selected()`: It now works correctly when
a variable in the data frame is a factor. (0.2.0.1)
- Added `confint()` and `coef()` methods for `cond_effect`-class
objects. `confint()` can return confidence intervals based on
*t* statistics, which are appropriate in some situations. (0.2.2)
- `print()` method for `cond_effect`-class
objects can print confidence intervals based on
*t* statistics. (0.2.2)
- Added `do_boot` to `std_selected_boot()`. If set to `FALSE`,
it will not do bootstrapping. (0.2.3)
- `cond_effect_boot()` will disable bootstrapping in the original
call if the output is generated by `std_selected_boot()`,
to avoid redundant bootstrapping inside bootstrapping. (0.2.3)
- Added `do_boot` to `cond_effect_boot()`. If set to `FALSE`,
it will not do bootstrapping. (0.2.4)

# stdmod 0.2.0.0

Expand Down
52 changes: 52 additions & 0 deletions R/coef_condeff.R
@@ -0,0 +1,52 @@
#' @title Conditional Effect in a 'cond_effect'-Class Object
#'
#' @description Return the estimates of the conditional
#' effects
#' in the output of
#' [cond_effect()] or [cond_effect_boot()].
#'
#' @details It just extracts and returns the column of
#' conditional effects in a `cond_effect`-class object.
#'
#' @return
#' A numeric vector: The estimates of the conditional
#' effects in a `cond_effect`-class object.
#'
#' @param object The output of [cond_effect()] or [cond_effect_boot()].
#' @param ... Optional arguments. Ignored by the function.
#'
#' @author Shu Fai Cheung <https://orcid.org/0000-0002-9871-9448>
#'
#'
#' @examples
#'
#' # Load a sample data set
#'
#' dat <- test_x_1_w_1_v_1_cat1_n_500
#'
#' # Do a moderated regression by lm
#' lm_raw <- lm(dv ~ iv*mod + v1 + cat1, dat)
#' summary(lm_raw)
#' out <- cond_effect(lm_raw, x = iv, w = mod)
#' out
#' coef(out)
#'
#' lm_std <- std_selected(lm_raw, to_scale = ~ iv + mod, to_center = ~ iv + mod)
#' out <- cond_effect(lm_std, x = iv, w = mod)
#' out
#' coef(out)
#'
#' # Categorical moderator
#' lm_cat <- lm(dv ~ iv*cat1 + v1, dat)
#' summary(lm_cat)
#' out <- cond_effect(lm_cat, x = iv, w = cat1)
#' out
#' coef(out)
#'
#' @export

coef.cond_effect <- function(object, ...) {
out <- as.data.frame(object)[, "x's Effect"]
names(out) <- object$Level
out
}
3 changes: 2 additions & 1 deletion R/condeff.R
Expand Up @@ -209,7 +209,7 @@ cond_effect <- function(output,
w_pq <- wecdf(w_levels)
w_mean <- mean(mf0[, w], na.rm = TRUE)
w_sd <- stats::sd(mf0[, w], na.rm = TRUE)
w_z <- (w_levels - w_mean) / w_sd
w_z <- (w_levels - w_mean) / w_sd
} else {
w_pq <- rep(NA, length(w_levels))
w_z <- rep(NA, length(w_levels))
Expand All @@ -219,6 +219,7 @@ cond_effect <- function(output,
attr(out0, "y_standardized") <- is_standardized(mf0[, y])
attr(out0, "x_standardized") <- is_standardized(mf0[, x])
attr(out0, "w_standardized") <- is_standardized(mf0[, w])
attr(out0, "out_all") <- out_all
class(out0) <- c("cond_effect", class(out0))
out0
}
Expand Down

0 comments on commit 1fde242

Please sign in to comment.