Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise pd #618

Merged
merged 11 commits into from
Jul 31, 2023
Merged

Revise pd #618

merged 11 commits into from
Jul 31, 2023

Conversation

mattansb
Copy link
Member

@mattansb mattansb commented Jul 30, 2023

This PR closes #616 and #609.

  • Revise p-d docs
    • How the pd is actually computed
    • possible ranges of values for continuous (0.5-1) vs discretized (0-1) parameter spaces.
    • How values close to 0 can be used to support the null (discretized) hypothesis (https://doi.org/10.1177/2515245921992035)
  • Revise pd-to-p
    • docs: not valid for discretized parameter spaces
    • when pd is smaller than 0.5 we need to return p of exactly 1 with a warning
    • tests
  • For vector inputs:
    • map_estimate returns a data frame
    • p_direction returns a data frame
    • p_map returns a data frame
    • p_significance returns a data frame

@mattansb
Copy link
Member Author

The remaining error are unrelated to this PR:

  • brms fails to run
  • blavaan output is not the right dimension as expected

@mattansb
Copy link
Member Author

@DominiqueMakowski I'm done here. Take a look.

R/p_direction.R Outdated
#' or the model.
#' \item It is robust to the scale of both the response variable and the predictors.
#' \item It is strongly correlated with the frequentist p-value, and can thus
#' from 0 to 1, representing the certainty with which an effect goes in a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it confusing to say that in ranges from 0-1 when in practice it's 0.5-1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your practice 😉
I've already come across several applied examples with discrete parameter spaces in my work.

So how about this:

... is an index of effect existence, representing the certainty with which an effect goes in a particular direction (i.e., is positive or negative / has a sign), typically ranging from 0.5 to 1 (but see next section for cases where it can range between 0 and 1). ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, I'll make the edits and merge, thanks a lot!

#' from 0 to 1, representing the certainty with which an effect goes in a
#' particular direction (*i.e.*, is positive or negative / has a sign). Beyond
#' its simplicity of interpretation, understanding and computation, this index
#' also presents other interesting properties:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reasons to remove:

  • It is independent from the model: It is solely based on the posterior distributions and does not require any additional information from the data or the model.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear to me what that means - all posterior related functions (so all but BF and CI) are objective descriptions of the posterior - divorced from the data or model.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's not a unique feature, but it doesn't harm to mention it as well as part of the "interesting properties" (for good or for bad) 🤷

@mattansb
Copy link
Member Author

I think we can merge.

@DominiqueMakowski DominiqueMakowski merged commit 47d1512 into main Jul 31, 2023
8 of 26 checks passed
@DominiqueMakowski DominiqueMakowski deleted the revise-pd branch July 31, 2023 07:27
@strengejacke
Copy link
Member

This PR wasn't ready, and breaks parts of the code, e.g.

library(bayestestR)
x <- distribution_normal(4000)

describe_posterior(
  x,
  centrality = "all",
  dispersion = TRUE,
  test = "all",
  ci = 0.89,
  verbose = FALSE
)
#> Error in fix.by(by.y, y): 'by' must specify a uniquely valid column

Created on 2023-07-31 with reprex v2.0.2

Because those functions expect numerics instead of data frames for pd(), I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

P-Direction in zero-inflated models
3 participants