# fbplot: Functional boxplot of univariate and multivariate functional... In roahd: Robust Analysis of High Dimensional Data

## Description

This function can be used to perform the functional boxplot of univariate or multivariate functional data.

## Usage

  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 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, ... ) 

## References

1. Sun, Y., & Genton, M. G. (2012). Functional boxplots. Journal of Computational and Graphical Statistics.

2. Sun, Y., & Genton, M. G. (2012). Adjusted functional boxplots for spatio-temporal data visualization and outlier detection. Environmetrics, 23(1), 54-64.

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 84 85 86 # 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() oldpar <- par(mfrow = c(1, 1)) 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 ' ) par(oldpar) # 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() fbplot( fD, adjust = list( N_trials = 10, trial_size = 5 * N, VERBOSE = TRUE ), xlab = 'time', ylab = 'Values', main = 'My adjusted functional boxplot' ) # 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' ) )