plot_pf: Visualization of Plausibility Functions

View source: R/viz.R

plot_pfR Documentation

Visualization of Plausibility Functions

Description

This function plots the plausibility function for up to two parameters of interest.

Usage

plot_pf(pf, alpha = 0.05, ngrid = 10, ncores = 1, subtitle = "")

Arguments

pf

A PlausibilityFunction object.

alpha

A numeric value specifying a significance level to contrast the plausibility function against. Defaults to 0.05.

ngrid

An integer specifying the grid size on which the plausibility function will be evaluated. Specifically if K is the number of parameters under investigation, the grid will be of size (ngrid + 1)^K. Defaults to 10L.

ncores

An integer specifying the number of cores to use for parallelized computations. Defaults to 1L.

subtitle

A string for specifying a subtitle to the plot. Defaults to "" leading to no subtitle.

Value

A ggplot object.

Examples

x <- rnorm(10)
y <- rnorm(10, mean = 2)
null_spec <- function(y, parameters) {purrr::map(y, ~ .x - parameters[1])}
stat_functions <- list(stat_t)
stat_assignments <- list(mean = 1)
pf <- PlausibilityFunction$new(
  null_spec = null_spec,
  stat_functions = stat_functions,
  stat_assignments = stat_assignments,
  x, y
)
pf$set_nperms(50)
pf$set_point_estimate(mean(y) - mean(x))
pf$set_parameter_bounds(
  point_estimate = pf$point_estimate,
  conf_level = 0.8
)
pf$set_grid(
  parameters = pf$parameters,
  npoints = 2L
)
pf$evaluate_grid(grid = pf$grid)
plot_pf(pf)

flipr documentation built on Aug. 23, 2023, 9:06 a.m.