Skip to contents

Creates visualizations of bias-bounded density estimation results

Usage

# S3 method for class 'bbnp_density'
plot(
  x,
  type = c("density", "ft"),
  fill_ci = .bbnp_pal[["ci"]],
  fill_bias = .bbnp_pal[["bias"]],
  alpha_ci = 0.55,
  alpha_bias = 0.55,
  ft_resol = 500,
  xi_range = NULL,
  expand = 2.5,
  ...
)

Arguments

x

An object of class bbnp_density

type

Character string specifying plot type. Options are:

  • "density" (default): Density estimate with bias bounds and confidence intervals

  • "ft": Fourier transform plot with estimated envelope

fill_ci

Color for confidence interval ribbon (default: a muted blue).

fill_bias

Color for bias bound ribbon (default: a muted terracotta).

alpha_ci

Transparency for confidence interval ribbon (default: 0.30)

alpha_bias

Transparency for bias bound ribbon (default: 0.45)

ft_resol

Resolution for Fourier transform plot (default: 500)

xi_range

Optional numeric c(lower, upper) giving the frequency range to display in the "ft" plot. If NULL (default) a wide range around the selected window is shown (see expand). This controls only what is drawn; it does not change the fitting window [xi_lb, xi_ub].

expand

For the "ft" plot when xi_range is NULL: how far past the selected window to display, as a multiple (default 2.5).

...

Additional arguments (unused)

Value

A ggplot2 object

Examples

# \donttest{
X <- gen_sample_data(size = 500, dgp = "2_fold_uniform", seed = 1)
fit <- biasBound_density(X, h = 0.1)
plot(fit)

plot(fit, type = "ft")

# }