Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Suggests:
panelr,
pbkrtest,
PCDimension,
performance (>= 0.12.0),
performance (>= 0.14.0),
plm,
PMCMRplus,
poorman,
Expand Down
2 changes: 1 addition & 1 deletion R/1_model_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
#'
#' - **pseudo** (*for 2-level (G)LMMs only*): In this (post-hoc) method, the
#' response and the predictor are standardized based on the level of prediction
#' (levels are detected with [performance::check_heterogeneity_bias()]): Predictors
#' (levels are detected with [performance::check_group_variation()]): Predictors
#' are standardized based on their SD at level of prediction (see also
#' [datawizard::demean()]); The outcome (in linear LMMs) is standardized based
#' on a fitted random-intercept-model, where `sqrt(random-intercept-variance)`
Expand Down Expand Up @@ -185,7 +185,7 @@
#'
#' Compared to fixed effects (or single-level) models, determining appropriate
#' df for Wald-based inference in mixed models is more difficult.
#' See [the R GLMM FAQ](https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#what-are-the-p-values-listed-by-summaryglmerfit-etc.-are-they-reliable)

Check warning on line 188 in R/1_model_parameters.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/1_model_parameters.R,line=188,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 151 characters.

Check warning on line 188 in R/1_model_parameters.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/1_model_parameters.R,line=188,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 151 characters.
#' for a discussion.
#'
#' Several approximate methods for computing df are available, but you should
Expand Down
3 changes: 2 additions & 1 deletion R/standardize_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ standardize_info.default <- function(model,

f <- if (two_sd) 2 else 1

within_vars <- unclass(performance::check_heterogeneity_bias(model))
gv <- performance::check_group_variation(model)
within_vars <- gv[gv$Variation %in% c("both", "within"), "Variable"]
id <- insight::get_random(model)[[1]]
w <- insight::get_weights(model, remove_na = TRUE)

Expand Down
2 changes: 1 addition & 1 deletion R/standardize_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#' delta.
#' - **pseudo** (*for 2-level (G)LMMs only*): In this (post-hoc) method, the
#' response and the predictor are standardized based on the level of prediction
#' (levels are detected with [`performance::check_heterogeneity_bias()`]): Predictors
#' (levels are detected with [`performance::check_group_variation()`]): Predictors
#' are standardized based on their SD at level of prediction (see also
#' [`datawizard::demean()`]); The outcome (in linear LMMs) is standardized based
#' on a fitted random-intercept-model, where `sqrt(random-intercept-variance)`
Expand Down Expand Up @@ -125,7 +125,7 @@
#' @family standardize
#' @family effect size indices
#'
#' @seealso See also [package vignette](https://easystats.github.io/parameters/articles/standardize_parameters_effsize.html).

Check warning on line 128 in R/standardize_parameters.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/standardize_parameters.R,line=128,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 125 characters.
#'
#' @examples
#' model <- lm(len ~ supp * dose, data = ToothGrowth)
Expand Down Expand Up @@ -260,7 +260,7 @@
colnames(pars)[colnames(pars) == "Coefficient"] <- gsub(" ", "_", coefficient_name, fixed = TRUE)
}

i <- colnames(pars) %in% c("Coefficient", "Median", "Mean", "MAP", "Odds_Ratio", "Risk_Ratio", "IRR", "Prevalence_Ratio")

Check warning on line 263 in R/standardize_parameters.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/standardize_parameters.R,line=263,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 123 characters.
colnames(pars)[i] <- paste0("Std_", colnames(pars)[i])

## SE attribute?
Expand Down
2 changes: 1 addition & 1 deletion man/model_parameters.Rd

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

2 changes: 1 addition & 1 deletion man/standardize_parameters.Rd

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

1 change: 1 addition & 0 deletions tests/testthat/test-standardize_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ test_that("standardize_parameters (Bayes)", {
# Pseudo - GLMM --------------------------------
test_that("standardize_parameters (Pseudo - GLMM)", {
skip_if_not_installed("datawizard", minimum_version = "0.12.0")
skip_if_not_installed("performance", minimum_version = "0.14.0")
skip_on_cran()
skip_if_not_installed("lme4")
set.seed(1)
Expand Down
4 changes: 2 additions & 2 deletions vignettes/demean.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
are captured in *one* estimate.

You can check if your model may suffer from heterogeneity bias using the
`check_heterogeneity_bias()` function:
`check_group_variation()` function:

```{r}
library(performance)
check_heterogeneity_bias(qol_cancer, select = c("phq4", "education"), by = "ID")
check_group_variation(qol_cancer, select = c("phq4", "education"), by = "ID")
```

# Adressing heterogeneity bias: the Fixed Effects Regression (FE) approach
Expand Down Expand Up @@ -258,12 +258,12 @@
[@bell_fixed_2019]:

```{r echo=FALSE}
f <- "y<sub>it</sub> = &beta;<sub>0</sub> + &beta;<sub>1W</sub> (x<sub>it</sub> - &#x035E;x<sub>i</sub>) + &beta;<sub>2B</sub> &#x035E;x<sub>i</sub> + &beta;<sub>3</sub> z<sub>i</sub> + &upsilon;<sub>i0</sub> + &upsilon;<sub>i1</sub> (x<sub>it</sub> - &#x035E;x<sub>i</sub>) + &epsilon;<sub>it</sub>"

Check warning on line 261 in vignettes/demean.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/demean.Rmd,line=261,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 300 characters.
knitr::asis_output(f)
```

```{r echo=FALSE}
f <- "<ul><li>x<sub>it</sub> - &#x035E;x<sub>i</sub> is the de-meaned predictor, <em>phq4_within</em></li><li>&#x035E;x<sub>i</sub> is the group-meaned predictor, <em>phq4_between</em></li><li>&beta;<sub>1W</sub> is the coefficient for phq4_within (within-subject)</li><li>&beta;<sub>2B</sub> is the coefficient for phq4_between (bewteen-subject)</li><li>&beta;<sub>3</sub> is the coefficient for time-constant predictors, such as `hospital` or `education` (bewteen-subject)</li></ul>"

Check warning on line 266 in vignettes/demean.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/demean.Rmd,line=266,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 485 characters.
knitr::asis_output(f)
```

Expand Down
Loading