Skip to contents

Compute the Probability of Direction (pd). Although differently expressed, this index is fairly similar (i.e., is strongly correlated) to the frequentist p-value. See bayestestR::p_direction() and vignette("overview_of_vignettes", package = "bayestestR") > "Probability of Direction (pd)" page for details. For converting pd to a frequentist p-value, see bayestestR::pd_to_p().

Usage

p_direction(x, ...)

# S3 method for class 'ermod_bin'
p_direction(
  x,
  null = 0,
  as_p = FALSE,
  as_num = FALSE,
  direction = "two-sided",
  ...
)

Arguments

x

An object of class ermod_bin_*

...

Additional arguments passed to bayestestR::p_direction().

null

The null hypothesis value. Default is 0.

as_p

If TRUE, the p-direction (pd) values are converted to a frequentist p-value using bayestestR::pd_to_p(). Only works when as_num = TRUE.

as_num

If TRUE, the output is converted to a numeric value.

direction

What type of p-value is requested or provided with as_p = TRUE. Can be "two-sided" (default, two tailed) or "one-sided" (one tailed).

Value

See bayestestR::p_direction() for details.

Details

For the class ermod_bin_*, it only calculates the pd for the exposure variable.

Examples

df_er_dr2 <-
  d_sim_binom_cov |>
  dplyr::filter(
    AETYPE == "dr2",
    ID %in% seq(1, 500, by = 5)
  ) |>
  dplyr::mutate(AUCss_1000 = AUCss / 1000, BHBA1C_5 = BHBA1C / 5)

ermod_bin <- dev_ermod_bin(
  data = df_er_dr2,
  var_resp = "AEFLAG",
  var_exposure = "AUCss_1000",
  var_cov = "BHBA1C_5"
)

p_direction(ermod_bin, as_num = TRUE, as_p = TRUE)
#> [1] 0.571