Description Usage Arguments Value Adjustment References See Also Examples
This function can be used to perform the functional boxplot of univariate or multivariate functional data.
1 2 3 4 5 6 7 8 9 10 11  fbplot(Data, Depths = "MBD", Fvalue = 1.5, adjust = FALSE,
display = TRUE, xlab = NULL, ylab = NULL, main = NULL, ...)
## S3 method for class 'fData'
fbplot(Data, Depths = "MBD", Fvalue = 1.5, adjust = FALSE,
display = TRUE, xlab = NULL, ylab = NULL, main = NULL, ...)
## S3 method for class 'mfData'
fbplot(Data, Depths = list(def = "MBD", weights = "uniform"),
Fvalue = 1.5, adjust = FALSE, display = TRUE, xlab = NULL,
ylab = NULL, main = NULL, ...)

Data 
the univariate or multivariate functional dataset whose functional
boxplot must be determined, in form of 
Depths 
either a vector containing the depths for each element of the dataset, or:
In both cases the name of the functions to compute depths must be available in the caller's environment. 
Fvalue 
the value of the inflation factor F, default is

adjust 
either

display 
either a logical value indicating wether you want the outliergram to be displayed, or the number of the graphical device where you want the outliergram to be displayed. 
xlab 
the label to use on the x axis when displaying the functional boxplot. 
ylab 
the label (or list of labels for the multivariate functional case) to use on the y axis when displaying the functional boxplot. 
main 
the main title (or list of titles for the multivariate functional case) to be used when displaying the functional boxplot. 
... 
additional graphical parameters to be used in plotting functions. 
Even when used in graphical way to plot the functional boxplot, the function
returns a list of three elements: the first, Depths
, contains the depths
of each element of the functional dataset; the second, Fvalue
, is the
value of F used to obtain the outliers, and the third, ID_out
, contains
the vector of indices of dataset's elements flagged as outliers (if any).
In the univariate functional case, when the adjustment option is selected,
the value of F is optimised for the univariate functional dataset
provided with Data
.
In practice, a number adjust$N_trials
of times a synthetic population
(of size adjust$tiral_size
with the same covariance (robustly
estimated from data) and centerline as fData
is simulated without
outliers and each time an optimised value F_i is computed so that a
given proportion (adjust$TPR
) of observations is flagged as outliers.
The final value of F
for the functional boxplot is determined as an
average of F_1, F_2, …, F_{N_{trials}}.
At each time step the optimisation problem is solved using
stats::uniroot
(Brent's method.
Sun, Y., & Genton, M. G. (2012). Functional boxplots. Journal of Computational and Graphical Statistics.
Sun, Y., & Genton, M. G. (2012). Adjusted functional boxplots for spatio temporal data visualization and outlier detection. Environmetrics, 23(1), 5464.
fData
, MBD
, BD
,
mfData
, multiMBD
, multiBD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83  # UNIVARIATE FUNCTIONAL BOXPLOT  NO ADJUSTMENT
set.seed(1)
N = 2 * 100 + 1
P = 2e2
grid = seq( 0, 1, length.out = P )
D = 10 * matrix( sin( 2 * pi * grid ), nrow = N, ncol = P, byrow = TRUE )
D = D + rexp(N, rate = 0.05)
# c( 0, 1 : (( N  1 )/2), ( ( ( N  1 ) / 2 ) : 1 ) )^4
fD = fData( grid, D )
dev.new()
par( mfrow = c(1,3) )
plot( fD, lwd = 2, main = 'Functional dataset',
xlab = 'time', ylab = 'values' )
fbplot( fD, main = 'Functional boxplot', xlab = 'time', ylab = 'values', Fvalue = 1.5 )
boxplot(fD$values[,1], ylim = range(fD$values), main = 'Boxplot of functional dataset at t_0 ' )
# UNIVARIATE FUNCTIONAL BOXPLOT  WITH ADJUSTMENT
set.seed( 161803 )
P = 2e2
grid = seq( 0, 1, length.out = P )
N = 1e2
# Generating a univariate synthetic gaussian dataset
Data = generate_gauss_fdata( N, centerline = sin( 2 * pi * grid ),
Cov = exp_cov_function( grid,
alpha = 0.3,
beta = 0.4 ) )
fD = fData( grid, Data )
dev.new()
## Not run:
fbplot( fD, adjust = list( N_trials = 10,
trial_size = 5 * N,
VERBOSE = TRUE ),
xlab = 'time', ylab = 'Values',
main = 'My adjusted functional boxplot' )
## End(Not run)
# MULTIVARIATE FUNCTIONAL BOXPLOT  NO ADJUSTMENT
set.seed( 1618033 )
P = 1e2
N = 1e2
L = 2
grid = seq( 0, 1, length.out = 1e2 )
C1 = exp_cov_function( grid, alpha = 0.3, beta = 0.4 )
C2 = exp_cov_function( grid, alpha = 0.3, beta = 0.4 )
# Generating a bivariate functional dataset of gaussian data with partially
# correlated components
Data = generate_gauss_mfdata( N, L,
centerline = matrix( sin( 2 * pi * grid ),
nrow = 2, ncol = P,
byrow = TRUE ),
correlations = rep( 0.5, 1 ),
listCov = list( C1, C2 ) )
mfD = mfData( grid, Data )
dev.new()
fbplot( mfD, Fvalue = 2.5, xlab = 'time', ylab = list( 'Values 1',
'Values 2' ),
main = list( 'First component', 'Second component' ) )

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.