Skip to content

Commit 3a3e291

Browse files
committed
Expand on returned value
#227
1 parent 4aeb336 commit 3a3e291

31 files changed

+151
-46
lines changed

R/adjust.R

+21-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
#' Adjust data for the effect of other variable(s)
22
#'
3-
#' This function can be used to adjust the data for the effect of other variables present in the dataset. It is based on an underlying fitting of regressions models, allowing for quite some flexibility, such as including factors as random effects in mixed models (multilevel partialization), continuous variables as smooth terms in general additive models (non-linear partialization) and/or fitting these models under a Bayesian framework. The values returned by this function are the residuals of the regression models. Note that a regular correlation between two "adjusted" variables is equivalent to the partial correlation between them.
3+
#' This function can be used to adjust the data for the effect of other
4+
#' variables present in the dataset. It is based on an underlying fitting of
5+
#' regressions models, allowing for quite some flexibility, such as including
6+
#' factors as random effects in mixed models (multilevel partialization),
7+
#' continuous variables as smooth terms in general additive models (non-linear
8+
#' partialization) and/or fitting these models under a Bayesian framework. The
9+
#' values returned by this function are the residuals of the regression models.
10+
#' Note that a regular correlation between two "adjusted" variables is
11+
#' equivalent to the partial correlation between them.
412
#'
513
#' @param data A dataframe.
6-
#' @param effect Character vector of column names to be adjusted for (regressed out). If `NULL` (the default), all variables will be selected.
14+
#' @param effect Character vector of column names to be adjusted for (regressed
15+
#' out). If `NULL` (the default), all variables will be selected.
716
#' @inheritParams standardize
8-
#' @param multilevel If `TRUE`, the factors are included as random factors. Else, if `FALSE` (default), they are included as fixed effects in the simple regression model.
9-
#' @param additive If `TRUE`, continuous variables as included as smooth terms in additive models. The goal is to regress-out potential non-linear effects.
10-
#' @param bayesian If `TRUE`, the models are fitted under the Bayesian framework using `rstanarm`.
17+
#' @param multilevel If `TRUE`, the factors are included as random factors.
18+
#' Else, if `FALSE` (default), they are included as fixed effects in the
19+
#' simple regression model.
20+
#' @param additive If `TRUE`, continuous variables as included as smooth terms
21+
#' in additive models. The goal is to regress-out potential non-linear
22+
#' effects.
23+
#' @param bayesian If `TRUE`, the models are fitted under the Bayesian framework
24+
#' using `rstanarm`.
25+
#'
26+
#' @return A data frame comparable to `data`, with adjusted variables.
1127
#'
1228
#' @examples
1329
#' adjust(iris, effect = "Species", select = "Sepal.Length")

R/cohens_d.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
#' tail-probabilities, and then convert these `ncp`s to the corresponding effect
4141
#' sizes.
4242
#'
43-
#' @return A data frame with the effect size(s) and confidence interval(s).
43+
#' @return A data frame with the effect size ( `Cohens_d`, `Hedges_g`,
44+
#' `Glass_delta`) and their CIs (`CI_low` and `CI_high`).
4445
#'
4546
#' @seealso [d_to_common_language()] [sd_pooled()]
4647
#' @family effect size indices

R/convert_OR_to_RR.R

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#' @param p0 Baseline risk
55
#' @inheritParams oddsratio_to_d
66
#'
7+
#' @return Converted index.
8+
#'
79
#' @family convert between effect sizes
810
#'
911
#' @examples

R/convert_chisq.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#' @param adjust Should the effect size be bias-corrected? Defaults to `FALSE`.
1212
#' @param ... Arguments passed to or from other methods.
1313
#'
14-
#' @return A data frame with the effect size(s) between 0-1, and confidence interval(s).
14+
#' @return A data frame with the effect size(s) between 0-1, and confidence
15+
#' interval(s). See [cramers_v()].
1516
#'
1617
#' @details These functions use the following formulae:
1718
#' \cr

R/convert_d_to_common_language.R

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#' \cr\cr
1111
#' \deqn{Pr(superiority) = \Phi(d/\sqrt{2})}
1212
#'
13+
#' @return A list of `Cohen's U3`, `Overlap`, `Probability of superiority`.
14+
#'
1315
#' @note
1416
#' These calculations assume that the populations have equal variance and are
1517
#' normally distributed.

R/convert_odds_to_probs.R

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#' from transformation.
1010
#' @param ... Arguments passed to or from other methods.
1111
#'
12+
#' @return Converted index.
13+
#'
1214
#' @seealso [stats::plogis()]
1315
#' @family convert between effect sizes
1416
#'

R/convert_tF_to_pve.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
#' @inheritParams chisq_to_phi
1616
#' @param ... Arguments passed to or from other methods.
1717
#'
18-
#' @return A data frame with the effect size(s) between 0-1, and confidence interval(s) (Note that for \eqn{\omega_p^2} and \eqn{\epsilon_p^2}
19-
#' it is possible to compute a negative number; even though this doesn't make any practical sense,
20-
#' it is recommended to report the negative number and not a 0).
18+
#' @return A data frame with the effect size(s) between 0-1 (`Eta2_partial`,
19+
#' `Epsilon2_partial`, `Omega2_partial`, `Cohens_f_partial` or
20+
#' `Cohens_f2_partial`), and their CIs (`CI_low` and `CI_high`). (Note that
21+
#' for \eqn{\omega_p^2} and \eqn{\epsilon_p^2} it is possible to compute a
22+
#' negative number; even though this doesn't make any practical sense, it is
23+
#' recommended to report the negative number and not a 0).
2124
#'
2225
#' @details These functions use the following formulae:
2326
#' \cr

R/convert_tFz_to_r.R

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,27 @@
22

33
#' Convert test statistics (t, z, F) to effect sizes of differences (Cohen's d) or association (**partial** r)
44
#'
5-
#' These functions are convenience functions to convert t, z and F test statistics to Cohen's d and
6-
#' **partial** r. These are useful in cases where the data required to compute these are not easily
7-
#' available or their computation is not straightforward (e.g., in liner mixed models, contrasts, etc.).
5+
#' These functions are convenience functions to convert t, z and F test
6+
#' statistics to Cohen's d and **partial** r. These are useful in cases where
7+
#' the data required to compute these are not easily available or their
8+
#' computation is not straightforward (e.g., in liner mixed models, contrasts,
9+
#' etc.).
810
#' \cr
911
#' See [Effect Size from Test Statistics vignette.](https://easystats.github.io/effectsize/articles/from_test_statistics.html)
1012
#'
1113
#' @param t,f,z The t, the F or the z statistics.
12-
#' @param df,df_error Degrees of freedom of numerator or of the error estimate (i.e., the residuals).
14+
#' @param df,df_error Degrees of freedom of numerator or of the error estimate
15+
#' (i.e., the residuals).
1316
#' @param n The number of observations (the sample size).
14-
#' @param paired Should the estimate accout for the t-value being testing the difference between dependant means?
17+
#' @param paired Should the estimate accout for the t-value being testing the
18+
#' difference between dependant means?
1519
#' @param pooled Deprecated. Use `paired`.
1620
#' @inheritParams chisq_to_phi
1721
#' @param ... Arguments passed to or from other methods.
1822
#'
1923
#'
20-
#' @return A data frame with the effect size(s) between 0-1, and confidence interval(s)
24+
#' @return A data frame with the effect size(s)(`r` or `d`), and their CIs
25+
#' (`CI_low` and `CI_high`).
2126
#'
2227
#'
2328
#' @details These functions use the following formulae to approximate *r* and *d*:

R/effectsize.R

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#' **For statistical models it is recommended to directly use the listed
2525
#' functions, for the full range of options they provide.**
2626
#'
27+
#' @return A data frame with the effect size (depending on input) and and its
28+
#' CIs (`CI_low` and `CI_high`).
29+
#'
2730
#' @family effect size indices
2831
#'
2932
#' @examples

R/equivalence_test.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bayestestR::equivalence_test
3535
#'
3636
#' @seealso For more details, see [bayestestR::equivalence_test()].
3737
#'
38-
#' @return A data frame.
38+
#' @return A data frame with the results of the equivalence test.
3939
#'
4040
#' @references
4141
#' - Campbell, H., & Gustafson, P. (2018). Conditional equivalence testing: An alternative remedy for publication bias. PLOS ONE, 13(4), e0195145. https://doi.org/10.1371/journal.pone.0195145

R/eta_squared.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
#' @param ... For Bayesian models, passed to `ss_function`. Otherwise ignored.
2525
#'
2626
#' @return
27-
#' A data frame with the effect size(s) and confidence interval(s).
27+
#' A data frame with the effect size(s) between 0-1 (`Eta2`, `Epsilon2`,
28+
#' `Omega2`, `Cohens_f` or `Cohens_f2`, possibly with the `partial` or
29+
#' `generalized` suffix), and their CIs (`CI_low` and `CI_high`).
2830
#' \cr\cr
2931
#' For `eta_squared_posterior()`, a data frame containing the ppd of the Eta
3032
#' squared for each fixed effect, which can then be passed to
@@ -58,6 +60,10 @@
5860
#' Though Omega is the more popular choice (Albers \& Lakens, 2018), Epsilon is
5961
#' analogous to adjusted R2 (Allen, 2017, p. 382), and has been found to be less
6062
#' biased (Carroll & Nordholm, 1975).
63+
#' \cr\cr
64+
#' (Note that for \eqn{\omega_p^2} and \eqn{\epsilon_p^2} it is possible to
65+
#' compute a negative number; even though this doesn't make any practical sense,
66+
#' it is recommended to report the negative number and not a 0.)
6167
#'
6268
#' ## Cohen's f
6369
#' Cohen's f can take on values between zero, when the population means are all

R/normalize.R

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#' @family transform utilities
2626
#'
2727
#' @return A normalized object.
28+
#'
2829
#' @export
2930
normalize <- function(x, ...) {
3031
UseMethod("normalize")

R/ranktransform.R

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#' ranktransform(c(0, 1, 5, -5, -2), sign = TRUE)
1515
#'
1616
#' head(ranktransform(iris))
17+
#'
1718
#' @return A rank-transformed object.
1819
#'
1920
#' @family transform utilities

R/standardize_info.R

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#' @param include_pseudo (For (G)LMMs) Should Pseudo-standardized information be included?
77
#' @param ... Arguments passed to or from other methods.
88
#'
9+
#' @return A data frame with information on each parameter (see
10+
#' [parameters::parameters_type]), and various standardization coefficients
11+
#' for the post-hoc methods (see [standardize_parameters()]) for the predictor
12+
#' and the response.
13+
#'
914
#' @family standardize
1015
#'
1116
#' @examples

R/standardize_parameters.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,14 @@
8080
#' coefficients (e.g., in a binomial model: the exponent of the standardized
8181
#' parameter is the OR of a change of 1 SD in the predictor, etc.)
8282
#'
83-
#' @return A data frame with the standardized parameters and their CIs.
83+
#' @return A data frame with the standardized parameters (`Std_*`, depending on
84+
#' the model type) and their CIs (`CI_low` and `CI_high`). Where applicable,
85+
#' standard errors (SEs) are returned as an attribute (`attr(x,
86+
#' "standard_error")`).
8487
#'
8588
#' @family standardize
8689
#' @family effect size indices
90+
#' @seealso [standardize_info()]
8791
#'
8892
#' @examples
8993
#' library(effectsize)
@@ -125,10 +129,6 @@
125129
#' }
126130
#' }
127131
#'
128-
#' @seealso [standardize_info()]
129-
#'
130-
#' @return Standardized parameters table.
131-
#'
132132
#' @references
133133
#' - Hoffman, L. (2015). Longitudinal analysis: Modeling within-person fluctuation and change. Routledge.
134134
#' - Neter, J., Wasserman, W., & Kutner, M. H. (1989). Applied linear regression models.

R/xtab.R

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
#' @inheritSection cohens_d Confidence Intervals
4444
#' @inheritSection chisq_to_phi CI Contains Zero
4545
#'
46-
#' @return A data frame with the effect size(s), and confidence interval(s).
46+
#' @return A data frame with the effect size (`Cramers_v`, `phi` (possibly with
47+
#' the suffix `_adjusted`), `Odds_ratio`, `Risk_ratio` (possibly with the
48+
#' prefix `log_`), or `Cohens_g`) and its CIs (`CI_low` and `CI_high`).
4749
#'
4850
#' @seealso [chisq_to_phi()] for details regarding estimation and CIs.
4951
#' @family effect size indices

man/F_to_eta2.Rd

+6-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/adjust.Rd

+22-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/chisq_to_phi.Rd

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/cohens_d.Rd

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/d_to_common_language.Rd

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/effectsize.Rd

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/equivalence_test.effectsize_table.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/eta_squared.Rd

+7-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/odds_to_probs.Rd

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/oddsratio_to_riskratio.Rd

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)