contour.angmcmc: Contour plot for angmcmc objects with bivariate data

View source: R/all_diagnostics.R

contour.angmcmcR Documentation

Contour plot for angmcmc objects with bivariate data

Description

Contour plot for angmcmc objects with bivariate data

Usage

## S3 method for class 'angmcmc'
contour(
  x,
  fn = "MAP",
  type = "point-est",
  show.data = TRUE,
  xpoints = seq(0, 2 * pi, length.out = 100),
  ypoints = seq(0, 2 * pi, length.out = 100),
  levels,
  nlevels = 20,
  cex = 1,
  col = "red",
  alpha = 0.4,
  pch = 19,
  ...
)

Arguments

x

angular MCMC object (with bivariate data).

fn

function, or a single character string specifying its name, to evaluate on MCMC samples to estimate parameters. Defaults to mean, which computes the estimated posterior mean. Note that if fn = "MODE" (warning: not "mode") or fn = "MAP", then the maximum aposteriori estimate (MAP) is calculated.

type

Passed to d_fitted. Possible choices are "point-est" and "post-pred".

show.data

logical. Should the data points be added to the contour plot? Ignored if object is NOT supplied.

xpoints

Points on the first (x-) coordinate where the density is to be evaluated. Default to seq(0, 2*pi, length.out=100).

ypoints

Points on the first (x-) coordinate where the density is to be evaluated. Default to seq(0, 2*pi, length.out=100).

levels

numeric vector of levels at which to draw contour lines; passed to the contour function in graphics.

nlevels

number of contour levels desired if levels is not supplied; passed to the contour function in graphics.

cex, col, pch

graphical parameters passed to points from graphics for plotting the data points. Ignored if show.data == FALSE.

alpha

color transparency for the data points, implemented via alpha from package scales. Ignored if show.data == FALSE.

...

additional arguments to be passed to the function contour.

Details

contour.angmcmc is an S3 function for angmcmc objects that calls contour from graphics.

To estimate the mixture density required to construct the contour plot, first the parameter vector η is estimated by applying fn on the MCMC samples, yielding the (consistent) Bayes estimate \hat{η}. Then the mixture density f(x|η) at any point x is (consistently) estimated by f(x|\hat{η}).

Examples

# first fit a vmsin mixture model
# illustration only - more iterations needed for convergence
fit.vmsin.20 <- fit_vmsinmix(tim8, ncomp = 3, n.iter =  20,
                             n.chains = 1)
# now create a contour plot
contour(fit.vmsin.20)


c7rishi/BAMBI documentation built on March 18, 2023, 6:17 p.m.