Skip to content

Commit

Permalink
add note about multilevel model
Browse files Browse the repository at this point in the history
Closes #237
  • Loading branch information
IndrajeetPatil committed Aug 10, 2022
1 parent ab67402 commit 1550fe9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
22 changes: 12 additions & 10 deletions R/correlation.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,18 @@
#' the variable to be adjusted for is a factor and is included as a random
#' effect in a mixed model (note that the remaining continuous variables of the
#' dataset will still be included as fixed effects, similarly to regular partial
#' correlations). That said, there is an important difference between using
#' `cor_test()` and `correlation()`: If you set `multilevel=TRUE` in
#' `correlation()` but `partial` is set to `FALSE` (as per default), then a
#' back-transformation from partial to non-partial correlation will be attempted
#' (through [`pcor_to_cor()`][pcor_to_cor]). However, this is not possible when
#' using `cor_test()` so that if you set `multilevel=TRUE` in it, the resulting
#' correlations are partial one. Note that for Bayesian multilevel correlations,
#' if `partial = FALSE`, the back transformation will also recompute *p*-values
#' based on the new *r* scores, and will drop the Bayes factors (as they are not
#' relevant anymore). To keep Bayesian scores, set `partial = TRUE`.
#' correlations). The model is a random intercept model, i.e. the multilevel
#' correlation is adjusted for `(1 | groupfactor)`.That said, there is an
#' important difference between using `cor_test()` and `correlation()`: If you
#' set `multilevel=TRUE` in `correlation()` but `partial` is set to `FALSE` (as
#' per default), then a back-transformation from partial to non-partial
#' correlation will be attempted (through [`pcor_to_cor()`][pcor_to_cor]).
#' However, this is not possible when using `cor_test()` so that if you set
#' `multilevel=TRUE` in it, the resulting correlations are partial one. Note
#' that for Bayesian multilevel correlations, if `partial = FALSE`, the back
#' transformation will also recompute *p*-values based on the new *r* scores,
#' and will drop the Bayes factors (as they are not relevant anymore). To keep
#' Bayesian scores, set `partial = TRUE`.
#' }
#'
#' \subsection{Notes}{
Expand Down
22 changes: 12 additions & 10 deletions man/cor_test.Rd

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

22 changes: 12 additions & 10 deletions man/correlation.Rd

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

0 comments on commit 1550fe9

Please sign in to comment.