fBoxplot: Functional boxplot

View source: R/fboxplot.r

fBoxplotR Documentation

Functional boxplot

Description

Functional boxplot based on central region computed by a specified measure. The options of the measures can be found in central_region.

Usage

fBoxplot(curve_sets, factor = 1.5, coverage = 0.5, ...)

Arguments

curve_sets

A curve_set object or a list of curve_set objects. Also envelope objects of spatstat and fdata of fda.usc are accepted instead of curve_set objects.

factor

The constant factor to inflate the central region to produce a functional boxplot and determine fences for outliers. Default is 1.5 as in a classical boxplot.

coverage

A number between 0 and 1. The 100*coverage% central region will be calculated. A vector of values can also be provided, leading to the corresponding number of central regions.

...

Additional parameters to be passed to central_region, which is responsible for calculating the central region (global envelope) on which the functional boxplot is based.

Examples

if(requireNamespace("fda", quietly=TRUE)) {
  years <- paste(1:18)
  curves <- fda::growth[['hgtf']][years,]
  # Heights
  cset1 <- curve_set(r = as.numeric(years),
                     obs = curves)
  bp <- fBoxplot(cset1, coverage=0.50, type="area", factor=1)
  plot(bp)

  # Considering simultaneously heights and height differences
  cset2 <- curve_set(r = as.numeric(years[-1]),
                     obs = curves[-1,] - curves[-nrow(curves),])
  csets <- list(Height=cset1, Change=cset2)
  res <- fBoxplot(csets, type='area', factor=1.5)
  plot(res) + ggplot2::labs(x="Age (years)", y="")
}

GET documentation built on Sept. 11, 2024, 5:46 p.m.