Title: | Bagplots, Boxplots and Rainbow Plots for Functional Data |
---|---|
Description: | Visualizing functional data and identifying functional outliers. |
Authors: | Han Lin Shang [aut, cre, cph] , Rob Hyndman [aut] |
Maintainer: | Han Lin Shang <[email protected]> |
License: | GPL-3 |
Version: | 3.8 |
Built: | 2024-12-01 08:47:51 UTC |
Source: | CRAN |
This package presents the rainbow plots, bagplots and boxplots for functional data. The latter two can also be used to identify outliers, which have either the lowest depth or the lowest density, respectively.
Han Lin Shang and Rob J Hyndman
Maintainer: Han Lin Shang <[email protected]>
R. J. Hyndman and H. L. Shang. (2008) "Bagplots, boxplots and outlier detection for functional data", in S. Dabo-Niang and F. Ferraty, eds, ‘Functional and Operatorial Statistics’, Springer, Heidelberg, pp. 201-207.
R. J. Hyndman and H. L. Shang. (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
H. L. Shang (2011) "rainbow: an R package for visualizing functional time series", The R Journal, 3(2), 54-59.
H. L. Shang and R. J. Hyndman (2011) "Nonparametric time series forecasting with dynamic updating", Mathematics and Computers in Simulation, 81(7), 1310-1324.
H. L. Shang (2013) "Functional time series approach for forecasting very short-term electricity demand", Journal of Applied Statistics, 40(1), 153-168.
H. L. Shang (2013) "ftsa: An R package for analyzing functional time series", The R Journal, 5(1), 64-72.
H. L. Shang (2014) "A survey of functional principal component analysis", Advances in Statistical Analysis, 98(2), 121-142.
H. L. Shang, P. Smith, J. Bijak and A. Wisniowski (2016) "A multilevel functional data method for forecasting population, with an application to the United Kingdom", International Journal of Forecasting, 32(3), 629-649.
H. L. Shang (2016) "Mortality and life expectancy forecasting for a group of populations in developed countries: A multilevel functional data method", Annals of Applied Statistics, 10(3), 1639-1672.
H. L. Shang (2017) "Functional time series forecasting with dynamic updating: An application to intraday particulate matter concentration", Econometrics and Statistics, 1, 184-200.
H. L. Shang (2017) "Forecasting intraday S&P 500 index returns: A functional time series approach", Journal of Forecasting, 36(7), 741-755.
H. L. Shang and S. Haberman (2017) "Grouped multivariate and functional time series forecasting: An application to annuity pricing", Insurance: Mathematics and Economics, 75, 166-179.
H. L. Shang and R. J. Hyndman (2017) "Grouped functional time series forecasting: An application to age-specific mortality rates", Journal of Computational and Graphical Statistics, 26(2), 330-343.
G. Rice and H. L. Shang (2017) "A plug-in bandwidth selection procedure for long-run covariance estimation with stationary functional time series", Journal of Time Series Analysis, 38(4), 591-609.
P. Reiss, J. Goldsmith, H. L. Shang and R. T. Ogden (2017) "Methods for scalar-on-function regression", International Statistical Review, 85(2), 228-249.
P. Kokoszka, G. Rice and H. L. Shang (2017) "Inference for the autocovariance of a functional time series under conditional heteroscedasticity", Journal of Multivariate Analysis, 162, 32-50.
Y. Gao and H. L. Shang (2017) "Multivariate functional time series forecasting: An application to age-specific mortality rates", Risks, 5(2), 21.
H. L. Shang (2018) "Visualizing rate of change: An application to age-specific fertility rates", Journal of the Royal Statistical Society: Series A (Statistics in Society), 182(1), 249-262.
H. L. Shang (2018) "Bootstrap methods for stationary functional time series", Statistics and Computing, 28(1), 1-10/
Y. Gao, H. L. Shang and Y. Yang (2018) "High-dimensional functional time series forecasting: An application to age-specific mortality rates", Journal of Multivariate Analysis, forthcoming.
Age-specific fertility rates between ages 15 and 49 in Australia from 1921 to 2006.
The age-specific fertility rates can be smoothed using a weighted median smoothing B-splines, constrained to be concave.
data(Australiafertility) data(Australiasmoothfertility)
data(Australiafertility) data(Australiasmoothfertility)
An object of class fts
.
Australian fertility rates and populations (1921-2006) for age groups (15-49) were obtained from the Australian Bureau of Statistics (Cat.No.3105.0.65.001, Table 38). These are defined as the number of live births during the calendar year, according to the age of the mother, per 1000 of the female resident population of the same age at 30 June.
Australiasmoothfertility is the smoothed version of Australiafertility data. The smoothing technique is the penalized regression spline with concave constraint, described in Hyndman and Ullah (2007).
Han Lin Shang
The Australian Demographic Data Bank (courtesy of Len Smith).
R. J. Hyndman and M. S. Ullah (2007) "Robust forecasting of mortality and fertility rates: A functional data approach", Computational Statistics and Data Analysis, 51(10), 4942-4956.
R. J. Hyndman and H. Booth (2008) "Stochastic population forecasts using functional data models for mortality, fertility and migration", International Journal of Forecasting, 24(3), 323-342.
R. J. Hyndman and H. L. Shang (2009) "Forecasting functional time series (with discussion)", Journal of the Korean Statistical Society, 38(3), 199-221.
H. L. Shang (2012) Point and interval forecasts of age-specific fertility rates: a comparison of functional principal component methods, Journal of Population Research, 29(3), 249-267.
H. L. Shang (2015) On the selection of optimal Box-Cox transformation parameter for modeling and forecasting age-specific fertility, Journal of Population Research, 32(1), 69-79.
H. L. Shang (2016) Visualising rate of change: application to age-specific fertility, https://arxiv.org/abs/1406.4386.
plot(Australiafertility) plot(Australiasmoothfertility)
plot(Australiafertility) plot(Australiasmoothfertility)
Sea surface temperature data set from January 1950 to December 2018 observed by the extended reconstructed sea surface temperature
data(ElNino_ERSST_region_1and2) data(ElNino_ERSST_region_3) data(ElNino_ERSST_region_4) data(ElNino_ERSST_region_3and4)
data(ElNino_ERSST_region_1and2) data(ElNino_ERSST_region_3) data(ElNino_ERSST_region_4) data(ElNino_ERSST_region_3and4)
An object of class sfts
.
These averaged monthly sea surface temperatures are measured by the different moored buoys in the "Nino region" defined by the coordinates 0-10 degree South and 90-80 degree West.
National Weather Service Climate Prediction Center website at http://www.cpc.ncep.noaa.gov/data/indices/sstoi.indices. The data is the third column with the title NINO1+2.
A. Antoniadis and T. Sapatinas (2003) "Wavelet methods for continuous-time prediction using Hilbert-valued autoregressive processes", Journal of Multivariate Analysis, 87(1), 133-158.
P. C. Besse, H. Cardot and D. B. Stephenson (2000) "Autoregressive forecasting of some functional climatic variations", Scandinavian Journal of Statistics, 27(4), 673-687.
F. Ferraty, A. Rabhi and P. Vieu (2005) "Conditional quantiles for dependent functional data with application to the climate EL Nino Phenomenon", Sankhya: The Indian Journal of Statistics, 67(2), 378-398.
F. Ferraty and P. Vieu (2007) Nonparametric functional data analysis, New York: Springer.
R. J. Hyndman and H. L. Shang (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
E. Moran, R. Adams, B. Bakoyema, S. Fiorini and B. Boucek (2006) "Human strategies for coping with El Nino related drought in Amazonia", Climatic Change, 77(3-4), 343-361.
A. Timmermann, J. Oberhuber, A. Bacher, M. Esch, M. Latif and E. Roeckner (1999) "Increased El Nino frequency in a climate model forced by future greenhouse warming", Nature, 398(6729), 694-697.
data(ElNino_ERSST_region_1and2) data(ElNino_ERSST_region_3) data(ElNino_ERSST_region_4) data(ElNino_ERSST_region_3and4)
data(ElNino_ERSST_region_1and2) data(ElNino_ERSST_region_3) data(ElNino_ERSST_region_4) data(ElNino_ERSST_region_3and4)
Monthly sea surface temperatures from January 1982 to December 2018 observed by the optimum interpolation sea surface temperature.
data(ElNino_OISST_region_1and2) data(ElNino_OISST_region_3) data(ElNino_OISST_region_4) data(ElNino_OISST_region_3and4)
data(ElNino_OISST_region_1and2) data(ElNino_OISST_region_3) data(ElNino_OISST_region_4) data(ElNino_OISST_region_3and4)
An object of class sfts
.
These averaged monthly sea surface temperatures are measured by the different moored buoys in the "Nino region" defined by the coordinates 0-10 degree South and 90-80 degree West.
National Weather Service Climate Prediction Center website at http://www.cpc.ncep.noaa.gov/data/indices/sstoi.indices. The data is the third column with the title NINO1+2.
A. Antoniadis and T. Sapatinas (2003) "Wavelet methods for continuous-time prediction using Hilbert-valued autoregressive processes", Journal of Multivariate Analysis, 87(1), 133-158.
P. C. Besse, H. Cardot and D. B. Stephenson (2000) "Autoregressive forecasting of some functional climatic variations", Scandinavian Journal of Statistics, 27(4), 673-687.
F. Ferraty, A. Rabhi and P. Vieu (2005) "Conditional quantiles for dependent functional data with application to the climate EL Nino Phenomenon", Sankhya: The Indian Journal of Statistics, 67(2), 378-398.
F. Ferraty and P. Vieu (2007) Nonparametric functional data analysis, New York: Springer.
R. J. Hyndman and H. L. Shang (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
E. Moran, R. Adams, B. Bakoyema, S. Fiorini and B. Boucek (2006) "Human strategies for coping with El Nino related drought in Amazonia", Climatic Change, 77(3-4), 343-361.
A. Timmermann, J. Oberhuber, A. Bacher, M. Esch, M. Latif and E. Roeckner (1999) "Increased El Nino frequency in a climate model forced by future greenhouse warming", Nature, 398(6729), 694-697.
plot(ElNino_OISST_region_1and2) plot(ElNino_OISST_region_3) plot(ElNino_OISST_region_4) plot(ElNino_OISST_region_3and4)
plot(ElNino_OISST_region_1and2) plot(ElNino_OISST_region_3) plot(ElNino_OISST_region_4) plot(ElNino_OISST_region_3and4)
Compute bivariate bagplot, functional bagplot and bivariate HDR boxplot, functional HDR boxplot.
fboxplot(data, plot.type = c("functional", "bivariate"), type = c("bag", "hdr"), alpha = c(0.05, 0.5), projmethod = c("PCAproj","rapca"), factor = 1.96, na.rm = TRUE, xlab = data$xname, ylab = data$yname, shadecols = gray((9:1)/10), pointcol = 1, plotlegend = TRUE, legendpos = "topright", ncol = 2, ...)
fboxplot(data, plot.type = c("functional", "bivariate"), type = c("bag", "hdr"), alpha = c(0.05, 0.5), projmethod = c("PCAproj","rapca"), factor = 1.96, na.rm = TRUE, xlab = data$xname, ylab = data$yname, shadecols = gray((9:1)/10), pointcol = 1, plotlegend = TRUE, legendpos = "topright", ncol = 2, ...)
data |
An object of class |
plot.type |
Version of boxplot. When |
type |
Type of boxplot. When |
alpha |
Coverage probability for the functional HDR boxplot. |
factor |
When |
na.rm |
Remove missing values. |
xlab |
A title for the x axis. |
ylab |
A title for the y axis. |
shadecols |
Colors for shaded regions. |
pointcol |
Color for outliers and mode. |
plotlegend |
Add a legend to the graph. |
legendpos |
Legend position. By default, it is the top right corner. |
ncol |
Number of columns in the legend. |
projmethod |
Method used for projection. |
... |
Other arguments. |
The functional curves are first projected into a finite dimensional subspace via functional principal component decomposition.
For simiplicity, we choose the subspace as . Based on Tukey (1974)'s halfspace bagplot and Hyndman (1996)'s HDR boxplot, we order each data point in
by data depth and data density.
Outliers are those that have either lowest depth (distance from the centre) or lowest density.
Function produces a graphical plot.
Rob J Hyndman, Han Lin Shang. Please, report bugs and suggestions to [email protected]
J. W. Tukey (1974) "Mathematics and the picturing of data", Proceedings of the International Congress of Mathematicians, 2, 523-532, Canadian Mathematical Congress, Montreal.
P. Rousseeuw, I. Ruts and J. Tukey (1999) "The bagplot: A bivariate boxplot", The American Statistician, 53(4), 382-387.
R. J. Hyndman (1996) "Computing and graphing highest density regions", The American Statistician, 50(2), 120-126.
R. J. Hyndman and H. L. Shang (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
Y. Sun and M. G. Genton (2011) "Functional boxplots", Journal of Computational and Graphical Statistics, 20(2), 316-334.
Y. Sun and M. G. Genton (2012) "Adjusted functional boxplots for spatio-temporal data visualization and outlier detection", Environmetrics, 23, 54-64.
Y. Sun and M. G. Genton (2012) "Functional median polish", Journal of Agricultural, Biological, and Environmental Statistics, 17, 354-376.
fboxplot(data = ElNino_OISST_region_1and2, plot.type = "functional", type = "bag", projmethod="PCAproj") fboxplot(data = ElNino_OISST_region_1and2, plot.type = "bivariate", type = "bag", projmethod="PCAproj")
fboxplot(data = ElNino_OISST_region_1and2, plot.type = "functional", type = "bag", projmethod="PCAproj") fboxplot(data = ElNino_OISST_region_1and2, plot.type = "bivariate", type = "bag", projmethod="PCAproj")
Compute functional depth.
fdepth(data, type = c("FM", "mode", "RP", "RPD", "radius"), trim = 0.25, alpha, weight)
fdepth(data, type = c("FM", "mode", "RP", "RPD", "radius"), trim = 0.25, alpha, weight)
data |
An object of class |
type |
Type of functional depth. See detail section below. |
trim |
Percentage of trimming. |
alpha |
Tuning parameter used when |
weight |
Hard-thresholding or soft-thresholding when |
If type = "FM"
, it computes the functional depth of Fraiman and Muniz (2001), which is considered as the first functional depth.
If type = "mode"
, it computes the functional depth of Cuevas et al. (2006). A functional mode is defined as the curve most densely surrounded by the rest of curves of the dataset.
If type = "RP"
and type = "RPD"
, it computes random projection functional depth of Cuevas et al. (2007).
Cuevas et al. (2007) considered the random projection depth based on measuring the depth of the functional data
under projections and taking additional information of their derivatives. The basic idea is to project each functional curve, along a random direction, defining a
point in . A data depth in
provides an order of the projected points.
If type = "radius"
, it ranks the curves according to alpha-radius. Then using the hard thresholding or soft thresholding, trimmed mean and median can be computed.
The argument trim = 0.25 first order curves by depth, and then trim 25 percent curves that have comparably lower depth.
A list containing the following components is returned.
median |
Median curve (highest depth). |
lmed |
Index of median curve. |
ltrim |
Indexes of the trimmed curves. |
prof |
Functional depth for each curve. |
mtrim |
Mean of trimmed curves. |
weight |
Weight values for all observations, when |
Han Lin Shang
R. Fraiman and G. Muniz (2001) "Trimmed means for functional data", Test, 10(2), 419-440.
A. Cuevas and M. Febrero and R. Fraiman (2001) "Cluster Analysis:a further approach based on density estimation", Computational Statistics and Data Analysis, 36(4), 441-456.
A. Cuevas and M. Febrero and R. Fraiman (2006) "On the use of bootstrap for estimating functions with functional data", Computational Statistics and Data Analysis, 51(10), 1063-1074.
A. Cuevas and M. Febrero and R. Fraiman (2007) "Robust estimation and classification for functional data via projection-based depth notions", Computational Statistics, 22(3), 481-496.
M. Febrero and P. Galeano and W. Gonzalez-Manteiga (2007) "A functional analysis of NOx levels: location and scale estimation and outlier detection", Computational Statistics, 22(3), 411-427.
M. Febrero and P. Galeano and W. Gonzalez-Manteiga (2008) "Outlier detection in functional data by depth measures, with application to identify abnormal NOx levels", Environmetrics, 19(4), 331-345.
M. Febrero and P. Galeano and W. Gonzalez-Manteiga (2010) "Measures of influence for the functional linear model with scalar response", Journal of Multivariate Analysis, 101(2), 327-339.
J. A. Cuesta-Albertos and A. Nieto-Reyes (2010) "Functional classification and the random Tukey depth. Practical issues", Combining Soft Computing and Statistical Methods in Data Analysis, Advances in Intelligent and Soft Computing, Volume 77, 123-130.
D. Gervini (2012) "Outlier detection and trimmed estimation in general functional spaces", Statistica Sinica, 22(4), 1639-1660.
P. Rana, G. Aneiros and J. M. Vilar (2015) "Detection of outliers in functional time series", Environmetrics, 26, 178-191.
fdepth(data = ElNino_OISST_region_1and2, type = "FM") fdepth(data = ElNino_OISST_region_1and2, type = "mode") fdepth(data = ElNino_OISST_region_1and2, type = "RP") fdepth(data = ElNino_OISST_region_1and2, type = "RPD") fdepth(data = ElNino_OISST_region_1and2, type = "radius", trim = 0.25, alpha = 0.5, weight = "hard") fdepth(data = ElNino_OISST_region_1and2, type = "radius", trim = 0.25, alpha = 0.5, weight = "soft")
fdepth(data = ElNino_OISST_region_1and2, type = "FM") fdepth(data = ElNino_OISST_region_1and2, type = "mode") fdepth(data = ElNino_OISST_region_1and2, type = "RP") fdepth(data = ElNino_OISST_region_1and2, type = "RPD") fdepth(data = ElNino_OISST_region_1and2, type = "radius", trim = 0.25, alpha = 0.5, weight = "hard") fdepth(data = ElNino_OISST_region_1and2, type = "radius", trim = 0.25, alpha = 0.5, weight = "soft")
The function fds
is used to create general independent and identically distributed (i.i.d.) functional objects that are not ordered by time.
The function fts
is used to create functional time series objects.
The function sfts
is used to create sliced functional time series objects, where the x
variable is
also a time variable.
fds(x, y, xname, yname) fts(x, y, start = 1, frequency = 1, xname, yname) sfts(data, period = frequency(data), start = tsp(data)[1], frequency = 1, xname, yname)
fds(x, y, xname, yname) fts(x, y, start = 1, frequency = 1, xname, yname) sfts(data, period = frequency(data), start = tsp(data)[1], frequency = 1, xname, yname)
x |
Numeric vector of length |
y |
Matrix of size |
data |
An object of class |
period |
Time period of sliced functional data. For instance, |
start |
The time of the first observation. Either a single number or a vector
of two integers, which specify a natural time unit and a (1-based) number of
samples into the time unit. See |
frequency |
The number of observations per unit of time. |
xname |
Character string giving name of |
yname |
Character string giving name of |
An object of class fds
or fts
or sfts
.
Rob J Hyndman and Han Lin Shang
fds(x = 1:20, y = Simulationdata$y, xname = "x", yname = "Simulated value") fts(x = 15:49, y = Australiasmoothfertility$y, xname = "Age", yname = "Fertility rate") sfts(ts(as.numeric(ElNino_OISST_region_1and2$y), frequency = 12), xname = "Month", yname = "Sea surface temperature")
fds(x = 1:20, y = Simulationdata$y, xname = "x", yname = "Simulated value") fts(x = 15:49, y = Australiasmoothfertility$y, xname = "Age", yname = "Fertility rate") sfts(ts(as.numeric(ElNino_OISST_region_1and2$y), frequency = 12), xname = "Month", yname = "Sea surface temperature")
Functional outlier detection methods.
foutliers(data, method = c("robMah", "lrt", "depth.trim", "depth.pond", "HUoutliers"), dfunc = depth.mode, nb = 200, suav = 0.05, trim = 0.1, order = 2, lambda = 3.29,...)
foutliers(data, method = c("robMah", "lrt", "depth.trim", "depth.pond", "HUoutliers"), dfunc = depth.mode, nb = 200, suav = 0.05, trim = 0.1, order = 2, lambda = 3.29,...)
data |
An object of class |
method |
Outlier detection method. |
dfunc |
When |
nb |
When |
suav |
When |
trim |
When |
order |
When |
lambda |
When |
... |
Other arguments. |
When method = "lrt"
, the outlier detection method corresponds to the approach of Febrero et al. (2007) using the likelihood ratio test.
When method = "depth.trim"
, the outlier detection method corresponds to the approach of Febrero et al. (2008) using the functional depth with trimmed curves.
When method = "depth.pond"
, the outlier detection method corresponds to the approach of Febrero et al. (2008) using the functional depth with all curves.
When method = "HUoutliers"
, the outlier detection method corresponds to the approach of Hyndman and Ullah (2008) using the integrated square forecast errors.
When method = "robMah"
, the outlier detection method corresponds to the approach of Rousseeuw and Leroy (1987) using the robust Mahalanobis distance.
A list containing the following components is returned.
outliers |
Detected outliers. |
cutoff |
Threshold value to separate outliers from non-outliers, when |
depth.total |
Depth measure of each functional curve. |
depth.out |
Depth measure of functional outliers. |
Han Lin Shang
P. Rousseeuw and A. Leroy (1987) Robust regression and outlier detection, John Wiley and Sons, New York.
A. Atkinson (1994) "Fast very robust methods for the detection of multiple outliers", Journal of the American Statistical Association, 89(428), 1329-1339.
R. J. Hyndman and M. S. Ullah (2007) "Robust forecasting of mortality and fertility rates: A functional data approach", Computational Statistics and Data Analysis, 51(10), 4942-4956.
M. Febrero and P. Galeano and W. Gonzalez-Manteiga (2007) "A functional analysis of NOx levels: location and scale estimation and outlier detection", Computational Statistics, 22(3), 411-427.
M. Febrero and P. Galeano and W. Gonzalez-Manteiga (2008) "Outlier detection in functional data by depth measures, with application to identify abnormal NOx levels", Environmetrics, 19(4), 331-345.
R. J. Hyndman and H. L. Shang. (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
foutliers(data = ElNino_OISST_region_1and2, method = "depth.trim")
foutliers(data = ElNino_OISST_region_1and2, method = "depth.trim")
Plot functional depth.
## S3 method for class 'fdepth' plot(x, show.legend = TRUE, pos.legend = "bottomleft", ...)
## S3 method for class 'fdepth' plot(x, show.legend = TRUE, pos.legend = "bottomleft", ...)
x |
An object of class |
show.legend |
Is legend required in the plot? |
pos.legend |
When |
... |
Other plotting parameters passed to |
Function produces a plot.
Rob J Hyndman, Han Lin Shang
R. J. Hyndman and H. L. Shang. (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
plot(fdepth(ElNino_OISST_region_1and2))
plot(fdepth(ElNino_OISST_region_1and2))
Plot functional curves.
## S3 method for class 'fds' plot(x, plot.type = c("functions", "time", "depth", "density"), col = NULL, type = "l", lty = 1, xlab = x$xname, ylab = x$yname, pch = c(1:9,0, letters, LETTERS), add = FALSE, index, colorchoice = c("rainbow", "heat.colors", "terrain.colors", "topo.colors", "cm.colors", "rainbow_hcl", "gray", "sequential_hcl", "heat_hcl", "terrain_hcl", "diverge_hcl"), plotlegend = FALSE, legendpos = "topright", ncol = 1, ...) ## S3 method for class 'fds' lines(x, type = "l", index, ...) ## S3 method for class 'fds' points(x, type = "p", index, ...)
## S3 method for class 'fds' plot(x, plot.type = c("functions", "time", "depth", "density"), col = NULL, type = "l", lty = 1, xlab = x$xname, ylab = x$yname, pch = c(1:9,0, letters, LETTERS), add = FALSE, index, colorchoice = c("rainbow", "heat.colors", "terrain.colors", "topo.colors", "cm.colors", "rainbow_hcl", "gray", "sequential_hcl", "heat_hcl", "terrain_hcl", "diverge_hcl"), plotlegend = FALSE, legendpos = "topright", ncol = 1, ...) ## S3 method for class 'fds' lines(x, type = "l", index, ...) ## S3 method for class 'fds' points(x, type = "p", index, ...)
x |
An object of class |
plot.type |
Type of plot. See details for more explanations. |
col |
Colors to use in plot. Default in |
type |
1-character string giving the type of plot desired. |
lty |
The line type. |
xlab |
A title for x axis. |
ylab |
A title for y axis. |
pch |
Either an integer specifying a symbol or a single character to be used as the default in plotting points. |
add |
If |
index |
Index of a specific curve that is plotted as a line or points. |
colorchoice |
Color palette used for drawing the rainbow plot. |
plotlegend |
Add a legend to the graph. |
legendpos |
Position of legend. |
ncol |
Number of column in the legend. |
... |
Other plotting parameters passed to |
If plot.type = "functions"
, then functions are plotted using a rainbow color palette so the
first few functions are shown in red, followed by orange, yellow, green, blue
and indigo with the last few functions plotted in violet.
If plot.type = "time"
, then each value of x is shown as a separate time series in a time plot.
If plot.type = "depth"
, then functions are first ordered by depth and then plotted using a rainbow color palette.
If plot.type = "density"
, then functions are first ordered by density and then plotted using a rainbow color palette.
Function produces a plot.
Rob J Hyndman, Han Lin Shang. Please, report bugs and suggestions to [email protected]
R. J. Hyndman and H. L. Shang. (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
plot(x = ElNino_OISST_region_1and2, plot.type = "functions", legend = TRUE) lines(x = ElNino_OISST_region_1and2, plot.type = "functions", index = 3) points(x = ElNino_OISST_region_1and2, plot.type = "functions", index = 3)
plot(x = ElNino_OISST_region_1and2, plot.type = "functions", legend = TRUE) lines(x = ElNino_OISST_region_1and2, plot.type = "functions", index = 3) points(x = ElNino_OISST_region_1and2, plot.type = "functions", index = 3)
Simulated data used in Hyndman and Shang (2008).
data(Simulationdata)
data(Simulationdata)
An object of class fds
.
R. J. Hyndman and H. L. Shang. (2010) "Rainbow plots, bagplots, and boxplots for functional data", Journal of Computational and Graphical Statistics, 19(1), 29-45.
plot(Simulationdata, col = rainbow(100)) lines(Simulationdata, index = 991:1000, col = "black")
plot(Simulationdata, col = rainbow(100)) lines(Simulationdata, index = 991:1000, col = "black")
Display summary statistics (minimum, 1st quantile, median, mean, 3rd quantile, maximum) and quantiles of functional data
summaryfunction(ftsdata, plot.type = c("summarystats", "quantilestats"), quantilepercent = seq(0.1, 0.9, by = 0.1), plot.legend = FALSE, legendpos = "topright", cex = 0.9, lwd = 1, lty = 1, ncol = 2)
summaryfunction(ftsdata, plot.type = c("summarystats", "quantilestats"), quantilepercent = seq(0.1, 0.9, by = 0.1), plot.legend = FALSE, legendpos = "topright", cex = 0.9, lwd = 1, lty = 1, ncol = 2)
ftsdata |
An object of class |
plot.type |
Summary statistics or quantiles. |
quantilepercent |
Percentage of quantiles. |
plot.legend |
Is the legend required in the plot? |
legendpos |
When the |
cex |
When the |
lwd |
When the |
lty |
When the |
ncol |
When the |
A function for displaying summary statistics or quantiles of functional data.
Return a plot of summary statistics of functional data or a plot of quantiles of functional data.
Han Lin Shang. Please, report bugs and suggestions to [email protected]
summaryfunction(Australiasmoothfertility, plot.type = "summarystats") summaryfunction(Australiasmoothfertility, plot.type = "quantilestats", plot.legend = TRUE)
summaryfunction(Australiasmoothfertility, plot.type = "summarystats") summaryfunction(Australiasmoothfertility, plot.type = "quantilestats", plot.legend = TRUE)
The singular value decomposition (SVD) plot of Zhang et al. (2007) captures the changes in the singular columns as the number of curves gradually increases.
SVDplot(object, order = 3, plot = TRUE, plot.type = c("fts", "image"), mfrow = c(2, 3))
SVDplot(object, order = 3, plot = TRUE, plot.type = c("fts", "image"), mfrow = c(2, 3))
object |
An object of |
order |
Number of Singular Value Decomposition (SVD) components. The maximum order is 4. |
plot |
Is graphical display required? |
plot.type |
Plot functional time series or images? |
mfrow |
Grid of graphics. |
By using the SVD, Zhang et al. (2007) proposed a plot for visualizing patterns
of functional time series. They considered a set of curves as a two-way (p * n)
data matrix, where p
is the total number of covariates and n
is the total number of curves.
The main advantage of this dynamic plot is to visualize both column and row information of a two-way matrix simultaneously, relate the matrix to the corresponding curves, show local variations, and highlight interactions between columns and rows of a two-way matrix.
When plot = TRUE
, it returns a plot.
When plot = FALSE
, it returns the following:
svds |
A number of singular value decomposition ordered by the amount of explained variation. |
reconstruction |
Reconstruction of the original data using the SVD. |
residual |
Residual of the original data. |
MATLAB code is available at https://www.stat.purdue.edu/~lingsong/.
Using the animate package of Grahn(2011), a set of dynamic movies can be created to visualize the changes in singular rows and singular columns.
Han Lin Shang. Please, report bugs and suggestions to [email protected]
L. Zhang, J. Marron, H. Shen and Z. Zhu (2007) "Singular value decomposition and its visualization", Journal of Computational and Graphical Statistics, 16(4), 833-854.
A. Grahn (2011) "The animate Package", https://ctan.org/pkg/animate?lang=en.
SVDplot(ElNino_OISST_region_1and2) SVDplot(ElNino_OISST_region_1and2, plot.type = "image")
SVDplot(ElNino_OISST_region_1and2) SVDplot(ElNino_OISST_region_1and2, plot.type = "image")