Skip to content

Clarify multilevel argument documentation for correlation() and cor_test() #354

@indenkun

Description

@indenkun

Description:

I've identified a potential issue with the documentation for the multilevel argument in both correlation() and cor_test(). The current description seems to be inherited from another function (likely from the datawizard package via @inheritParams) and does not accurately reflect the behavior within the correlation package.

The current documentation states:

If TRUE, the factors are included as random factors. Else, if FALSE (default), they are included as fixed effects in the simple regression model.

However, based on my testing, when multilevel = FALSE, the function does not include factor variables as fixed effects. Instead, it calculates a simple, overall Pearson correlation between numeric variables, effectively ignoring the factor variable entirely.

This discrepancy likely stems from a shared documentation block intended for a different context. In the correlation package, multilevel = FALSE serves as a baseline for a simple, overall correlation, whereas multilevel = TRUE introduces a multilevel model with random effects. The current wording, suggesting a fixed-effects model for multilevel = FALSE, is misleading and could cause user confusion regarding the function's actual behavior.

Proposed change:

I propose that the documentation for the multilevel argument in both correlation() and cor_test() be updated to explicitly describe their specific behavior. A more accurate description would be:

If TRUE, the factors are included as random effects in a mixed-effects model to calculate within-group correlations. If FALSE (default), factors are ignored, and a simple correlation is calculated between the numeric variables.

This revised text clearly distinguishes between the two behaviors within the context of the correlation package, providing users with an accurate understanding of the function's output. Thank you for considering this clarification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions