Skip to content

Commit

Permalink
rc CRAN 0.8.5 (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattansb authored Aug 9, 2023
1 parent f40d8ed commit e381716
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 92 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: effectsize
Title: Indices of Effect Size
Version: 0.8.3.11
Version: 0.8.5
Authors@R:
c(person(given = "Mattan S.",
family = "Ben-Shachar",
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## New features

- `interpret_cfi()` gains a new rule option: `"hu&bentler1999"` ( #538 ).
- `cohens_f()` added option to return unbiased estimators (based on Omega- or Epsilon-squared).
- `tschuprows_t()` now returns an effect size corrected for small-sample bias. Set `adjust = FALSE` to preserve old behavior.
- `w_to_v()` and others for converting between effect sizes of Chi-square tests.
Expand All @@ -18,6 +19,7 @@
## Breaking Changes

- `*_to_riskratio()` and `riskratio_to_*()` argument `log` not longer converts RR to/from log(RR).
- `interpret_gfi()` and friends: some previously named `"default"` rules have been re-labelled as `"byrne1994"`.

## Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion R/convert_between_xtabcorr.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Convert Between *d*, *r*, and Odds Ratio
#' Convert Between Effect Sizes for Contingency Tables Correlations
#'
#' Enables a conversion between different indices of effect size, such as
#' Cohen's *w* to \ifelse{latex}{\eqn{Fei}}{פ (Fei)}, and Cramer's *V* to
Expand Down
14 changes: 10 additions & 4 deletions R/eta_squared-main.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#' `afex` package.
#' \cr\cr
#' For type 3 sum of squares, it is generally recommended to fit models with
#' *orthoginal factor weights* (e.g., `contr.sum`) and *centered covariates*,
#' *orthogonal factor weights* (e.g., `contr.sum`) and *centered covariates*,
#' for sensible results. See examples and the `afex` package.
#'
#' ## Un-Biased Estimate of Eta
Expand Down Expand Up @@ -316,19 +316,25 @@ cohens_f <- function(model,
if ("CI" %in% colnames(res)) attr(res, "ci_method") <- list(method = "ncp", distribution = "F")
class(res) <- unique(c("effectsize_anova", "effectsize_table", "see_effectsize_table", class(res)))
attr(res, "approximate") <- isTRUE(attr(res, "approximate", exact = TRUE))
attr(res, "table_footer") <- if (method != "eta") sprintf("Based on %s squared.", paste0(toupper(substring(methed, 1, 1)), substring(methed, 2)))
attr(res, "table_footer") <- if (method != "eta") sprintf("Based on %s squared.", paste0(toupper(substring(method, 1, 1)), substring(method, 2)))
res
}

#' @rdname eta_squared
#' @export
cohens_f_squared <- function(model,
partial = TRUE, squared = TRUE, model2 = NULL,
partial = TRUE, generalized = FALSE,
squared = TRUE,
method = c("eta", "omega", "epsilon"),
model2 = NULL,
ci = 0.95, alternative = "greater",
verbose = TRUE, ...) {
cohens_f(
model,
partial = partial, squared = squared, model2 = model2,
partial = partial, generalized = generalized,
squared = squared,
method = method,
model2 = model2,
ci = ci, alternative = alternative,
verbose = verbose, ...
)
Expand Down
10 changes: 9 additions & 1 deletion R/eta_squared-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

#' @keywords internal
.anova_es.mixed <- function(model,
type = c("eta", "omega", "epsilon"),
partial = TRUE, generalized = FALSE,
ci = 0.95, alternative = "greater",
verbose = TRUE,
include_intercept = FALSE,
...) {
Expand All @@ -52,7 +55,12 @@
aov_tab$df_error <- aov_tab[["den Df"]]
aov_tab <- aov_tab[, c("Parameter", "df", "df_error", "F")]

out <- .es_aov_table(aov_tab, verbose = verbose, include_intercept = include_intercept, ...)
out <- .es_aov_table(aov_tab, type = type,
partial = partial, generalized = generalized,
ci = ci, alternative = alternative,
verbose = verbose,
include_intercept = include_intercept, ...
)

attr(out, "anova_type") <- attr(model, "type")
attr(out, "approximate") <- TRUE
Expand Down
104 changes: 55 additions & 49 deletions R/interpret_cfa_fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#' equation modelling, such as RMSEA, CFI, NFI, IFI, etc.
#'
#' @param x vector of values, or an object of class `lavaan`.
#' @param rules Can be `"default"` or custom set of [rules()].
#' @param rules Can be the name of a set of rules (see below) or custom set of
#' [rules()].
#' @inheritParams interpret
#'
#' @inherit performance::model_performance.lavaan details
Expand All @@ -19,29 +20,19 @@
#'
#' - **GFI/AGFI**: The (Adjusted) Goodness of Fit is the proportion of variance
#' accounted for by the estimated population covariance. Analogous to R2. The
#' GFI and the AGFI should be > .95 and > .90, respectively.
#' GFI and the AGFI should be > .95 and > .90, respectively (Byrne, 1994;
#' `"byrne1994"`).
#'
#' - **NFI/NNFI/TLI**: The (Non) Normed Fit Index. An NFI of 0.95, indicates the
#' model of interest improves the fit by 95\% relative to the null model. The
#' NNFI (also called the Tucker Lewis index; TLI) is preferable for smaller
#' samples. They should be > .90 (Byrne, 1994) or > .95 (Schumacker & Lomax,
#' 2004).
#' samples. They should be > .90 (Byrne, 1994; `"byrne1994"`) or > .95
#' (Schumacker & Lomax, 2004; `"schumacker2004"`).
#'
#' - **CFI**: The Comparative Fit Index is a revised form of NFI. Not very
#' sensitive to sample size (Fan, Thompson, & Wang, 1999). Compares the fit of a
#' target model to the fit of an independent, or null, model. It should be >
#' .90.
#'
#' - **RMSEA**: The Root Mean Square Error of Approximation is a
#' parsimony-adjusted index. Values closer to 0 represent a good fit. It should
#' be < .08 or < .05. The p-value printed with it tests the hypothesis that
#' RMSEA is less than or equal to .05 (a cutoff sometimes used for good fit),
#' and thus should be not significant.
#'
#' - **RMR/SRMR**: the (Standardized) Root Mean Square Residual represents the
#' square-root of the difference between the residuals of the sample covariance
#' matrix and the hypothesized model. As the RMR can be sometimes hard to
#' interpret, better to use SRMR. Should be < .08.
#' target model to the fit of an independent, or null, model. It should be > .96
#' (Hu & Bentler, 1999; `"hu&bentler1999"`) or .90 (Byrne, 1994; `"byrne1994"`).
#'
#' - **RFI**: the Relative Fit Index, also known as RHO1, is not guaranteed to
#' vary from 0 to 1. However, RFI close to 1 indicates a good fit.
Expand All @@ -54,6 +45,18 @@
#' agreed-upon cutoff value for an acceptable model for this index. Should be >
#' 0.50.
#'
#' - **RMSEA**: The Root Mean Square Error of Approximation is a
#' parsimony-adjusted index. Values closer to 0 represent a good fit. It should
#' be < .08 (Awang, 2012; `"awang2012"`) or < .05 (Byrne, 1994; `"byrne1994"`).
#' The p-value printed with it tests the hypothesis that RMSEA is less than or
#' equal to .05 (a cutoff sometimes used for good fit), and thus should be not
#' significant.
#'
#' - **RMR/SRMR**: the (Standardized) Root Mean Square Residual represents the
#' square-root of the difference between the residuals of the sample covariance
#' matrix and the hypothesized model. As the RMR can be sometimes hard to
#' interpret, better to use SRMR. Should be < .08 (Byrne, 1994; `"byrne1994"`).
#'
#' See the documentation for \code{\link[lavaan:fitmeasures]{fitmeasures()}}.
#'
#'
Expand Down Expand Up @@ -92,29 +95,35 @@
#' - Awang, Z. (2012). A handbook on SEM. Structural equation modeling.
#'
#' - Byrne, B. M. (1994). Structural equation modeling with EQS and EQS/Windows.
#' Thousand Oaks, CA: Sage Publications.
#'
#' - Tucker, L. R., and Lewis, C. (1973). The reliability coefficient for maximum
#' likelihood factor analysis. Psychometrika, 38, 1-10.
#' Thousand Oaks, CA: Sage Publications.
#'
#' - Schumacker, R. E., and Lomax, R. G. (2004). A beginner's guide to structural
#' equation modeling, Second edition. Mahwah, NJ: Lawrence Erlbaum Associates.
#' - Fan, X., B. Thompson, and L. Wang (1999). Effects of sample size,
#' estimation method, and model specification on structural equation modeling
#' fit indexes. Structural Equation Modeling, 6, 56-83.
#'
#' - Fan, X., B. Thompson, and L. Wang (1999). Effects of sample size, estimation
#' method, and model specification on structural equation modeling fit indexes.
#' Structural Equation Modeling, 6, 56-83.
#' - Hu, L. T., & Bentler, P. M. (1999). Cutoff criteria for fit indexes in
#' covariance structure analysis: Conventional criteria versus new
#' alternatives. Structural equation modeling: a multidisciplinary journal,
#' 6(1), 1-55.
#'
#' - Kline, R. B. (2015). Principles and practice of structural equation
#' modeling. Guilford publications.
#' modeling. Guilford publications.
#'
#' - Schumacker, R. E., and Lomax, R. G. (2004). A beginner's guide to
#' structural equation modeling, Second edition. Mahwah, NJ: Lawrence Erlbaum
#' Associates.
#'
#' - Tucker, L. R., and Lewis, C. (1973). The reliability coefficient for
#' maximum likelihood factor analysis. Psychometrika, 38, 1-10.
#'
#'
#' @keywords interpreters
#' @export
interpret_gfi <- function(x, rules = "default") {
interpret_gfi <- function(x, rules = "byrne1994") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.95), c("poor", "satisfactory"), name = "default", right = FALSE)
byrne1994 = rules(c(0.95), c("poor", "satisfactory"), name = "byrne1994", right = FALSE)
)
)

Expand All @@ -124,11 +133,11 @@ interpret_gfi <- function(x, rules = "default") {

#' @rdname interpret_gfi
#' @export
interpret_agfi <- function(x, rules = "default") {
interpret_agfi <- function(x, rules = "byrne1994") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.90), c("poor", "satisfactory"), name = "default", right = FALSE)
byrne1994 = rules(c(0.90), c("poor", "satisfactory"), name = "byrne1994", right = FALSE)
)
)

Expand Down Expand Up @@ -157,42 +166,38 @@ interpret_nnfi <- interpret_nfi

#' @rdname interpret_gfi
#' @export
interpret_cfi <- function(x, rules = "default") {
interpret_cfi <- function(x, rules = "byrne1994") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.90), c("poor", "satisfactory"), name = "default", right = FALSE)
"hu&bentler1999" = rules(c(0.96), c("poor", "satisfactory"), name = "hu&bentler1999", right = FALSE),
"byrne1994" = rules(c(0.90), c("poor", "satisfactory"), name = "byrne1994", right = FALSE)
)
)

interpret(x, rules)
}




#' @rdname interpret_gfi
#' @export
interpret_rmsea <- function(x, rules = "default") {
interpret_rfi <- function(x, rules = "default") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.05), c("satisfactory", "poor"), name = "default"),
awang2012 = rules(c(0.05, 0.08), c("good", "satisfactory", "poor"), name = "awang2012")
default = rules(c(0.90), c("poor", "satisfactory"), name = "default", right = FALSE)
)
)

interpret(x, rules)
}


#' @rdname interpret_gfi
#' @export
interpret_srmr <- function(x, rules = "default") {
interpret_ifi <- function(x, rules = "default") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.08), c("satisfactory", "poor"), name = "default")
default = rules(c(0.90), c("poor", "satisfactory"), name = "default", right = FALSE)
)
)

Expand All @@ -201,11 +206,11 @@ interpret_srmr <- function(x, rules = "default") {

#' @rdname interpret_gfi
#' @export
interpret_rfi <- function(x, rules = "default") {
interpret_pnfi <- function(x, rules = "default") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.90), c("poor", "satisfactory"), name = "default", right = FALSE)
default = rules(c(0.50), c("poor", "satisfactory"), name = "default")
)
)

Expand All @@ -214,31 +219,32 @@ interpret_rfi <- function(x, rules = "default") {

#' @rdname interpret_gfi
#' @export
interpret_ifi <- function(x, rules = "default") {
interpret_rmsea <- function(x, rules = "byrne1994") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.90), c("poor", "satisfactory"), name = "default", right = FALSE)
byrne1994 = rules(c(0.05), c("satisfactory", "poor"), name = "byrne1994"),
awang2012 = rules(c(0.05, 0.08), c("good", "satisfactory", "poor"), name = "awang2012")
)
)

interpret(x, rules)
}


#' @rdname interpret_gfi
#' @export
interpret_pnfi <- function(x, rules = "default") {
interpret_srmr <- function(x, rules = "byrne1994") {
rules <- .match.rules(
rules,
list(
default = rules(c(0.50), c("poor", "satisfactory"), name = "default")
byrne1994 = rules(c(0.08), c("satisfactory", "poor"), name = "byrne1994")
)
)

interpret(x, rules)
}


# lavaan ------------------------------------------------------------------

#' @rdname interpret_gfi
Expand Down
4 changes: 2 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Test environments

* local installation: R 4.2.2 on Windows
* local installation: R 4.3.1 on Windows
* GitHub Actions
- Windows: release
- macOS: release
Expand All @@ -21,7 +21,7 @@

## revdepcheck results

We checked 19 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 20 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages
Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ BMC
Baptista
BayestestR's
Behaviour
Bentler
Bergsma
Biometrics
Biometrika
Expand Down Expand Up @@ -66,6 +67,7 @@ Hedges’
Hjort
Hoekstra
Hotelling's
Hu
IFI
IRRs
Intraclass
Expand Down
2 changes: 1 addition & 1 deletion man/effectsize.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/eta_squared.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e381716

Please sign in to comment.