Type: | Package |
Title: | Bagplots, Boxplots and Rainbow Plots for Functional Data |
Version: | 3.8 |
Date: | 2024-01-23 |
Depends: | R (≥ 4.0.0), MASS, pcaPP |
Suggests: | forecast |
Imports: | hdrcde, cluster, colorspace, ks, methods |
LazyLoad: | yes |
LazyData: | yes |
ByteCompile: | TRUE |
Maintainer: | Han Lin Shang <hanlin.shang@mq.edu.au> |
Description: | Visualizing functional data and identifying functional outliers. |
License: | GPL-3 |
NeedsCompilation: | no |
Packaged: | 2024-01-22 22:57:28 UTC; hanlinshang |
Author: | Han Lin Shang |
Repository: | CRAN |
Date/Publication: | 2024-01-23 05:40:07 UTC |
Rainbow Plots, Bagplots and Boxplots for Functional Data
Description
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.
Author(s)
Han Lin Shang and Rob J Hyndman
Maintainer: Han Lin Shang <hanlin.shang@anu.edu.au>
References
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.
Australian age-specific fertility data
Description
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.
Usage
data(Australiafertility)
data(Australiasmoothfertility)
Format
An object of class fts
.
Details
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).
Author(s)
Han Lin Shang
Source
The Australian Demographic Data Bank (courtesy of Len Smith).
References
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.
Examples
plot(Australiafertility)
plot(Australiasmoothfertility)
Sea surface temperature data set from January 1950 to December 2018
Description
Sea surface temperature data set from January 1950 to December 2018 observed by the extended reconstructed sea surface temperature
Usage
data(ElNino_ERSST_region_1and2)
data(ElNino_ERSST_region_3)
data(ElNino_ERSST_region_4)
data(ElNino_ERSST_region_3and4)
Format
An object of class sfts
.
Details
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.
Source
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.
References
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.
Examples
data(ElNino_ERSST_region_1and2)
data(ElNino_ERSST_region_3)
data(ElNino_ERSST_region_4)
data(ElNino_ERSST_region_3and4)
Sea surface temperature data set from January 1982 to December 2018
Description
Monthly sea surface temperatures from January 1982 to December 2018 observed by the optimum interpolation sea surface temperature.
Usage
data(ElNino_OISST_region_1and2)
data(ElNino_OISST_region_3)
data(ElNino_OISST_region_4)
data(ElNino_OISST_region_3and4)
Format
An object of class sfts
.
Details
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.
Source
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.
References
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.
Examples
plot(ElNino_OISST_region_1and2)
plot(ElNino_OISST_region_3)
plot(ElNino_OISST_region_4)
plot(ElNino_OISST_region_3and4)
Functional bagplot and functional HDR boxplot
Description
Compute bivariate bagplot, functional bagplot and bivariate HDR boxplot, functional HDR boxplot.
Usage
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, ...)
Arguments
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. |
Details
The functional curves are first projected into a finite dimensional subspace via functional principal component decomposition.
For simiplicity, we choose the subspace as R^2
. Based on Tukey (1974)'s halfspace bagplot and Hyndman (1996)'s HDR boxplot, we order each data point in R^2
by data depth and data density.
Outliers are those that have either lowest depth (distance from the centre) or lowest density.
Value
Function produces a graphical plot.
Author(s)
Rob J Hyndman, Han Lin Shang. Please, report bugs and suggestions to hanlin.shang@anu.edu.au
References
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.
See Also
Examples
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.
Description
Compute functional depth.
Usage
fdepth(data, type = c("FM", "mode", "RP", "RPD", "radius"), trim = 0.25, alpha, weight)
Arguments
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 |
Details
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 R^2
. A data depth in R^2
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.
Value
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 |
Author(s)
Han Lin Shang
References
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.
Examples
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")
Create functional objects
Description
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.
Usage
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)
Arguments
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 |
Value
An object of class fds
or fts
or sfts
.
Author(s)
Rob J Hyndman and Han Lin Shang
Examples
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.
Description
Functional outlier detection methods.
Usage
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,...)
Arguments
data |
An object of class |
method |
Outlier detection method. |
dfunc |
When |
nb |
When |
suav |
When |
trim |
When |
order |
When |
lambda |
When |
... |
Other arguments. |
Details
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.
Value
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. |
Author(s)
Han Lin Shang
References
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.
Examples
foutliers(data = ElNino_OISST_region_1and2, method = "depth.trim")
Plot functional depth
Description
Plot functional depth.
Usage
## S3 method for class 'fdepth'
plot(x, show.legend = TRUE, pos.legend = "bottomleft", ...)
Arguments
x |
An object of class |
show.legend |
Is legend required in the plot? |
pos.legend |
When |
... |
Other plotting parameters passed to |
Value
Function produces a plot.
Author(s)
Rob J Hyndman, Han Lin Shang
References
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.
See Also
Examples
plot(fdepth(ElNino_OISST_region_1and2))
Plot functional objects
Description
Plot functional curves.
Usage
## 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, ...)
Arguments
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 |
Details
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.
Value
Function produces a plot.
Author(s)
Rob J Hyndman, Han Lin Shang. Please, report bugs and suggestions to hanlin.shang@anu.edu.au
References
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.
See Also
Examples
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
Description
Simulated data used in Hyndman and Shang (2008).
Usage
data(Simulationdata)
Format
An object of class fds
.
References
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.
Examples
plot(Simulationdata, col = rainbow(100))
lines(Simulationdata, index = 991:1000, col = "black")
Summary statistics for functional data
Description
Display summary statistics (minimum, 1st quantile, median, mean, 3rd quantile, maximum) and quantiles of functional data
Usage
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)
Arguments
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 |
Details
A function for displaying summary statistics or quantiles of functional data.
Value
Return a plot of summary statistics of functional data or a plot of quantiles of functional data.
Author(s)
Han Lin Shang. Please, report bugs and suggestions to hanlin.shang@anu.edu.au
See Also
Examples
summaryfunction(Australiasmoothfertility, plot.type = "summarystats")
summaryfunction(Australiasmoothfertility, plot.type = "quantilestats", plot.legend = TRUE)
Singular value decomposition plot
Description
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.
Usage
SVDplot(object, order = 3, plot = TRUE, plot.type = c("fts", "image"),
mfrow = c(2, 3))
Arguments
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. |
Details
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.
Value
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. |
Note
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.
Author(s)
Han Lin Shang. Please, report bugs and suggestions to hanlin.shang@anu.edu.au
References
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.
See Also
Examples
SVDplot(ElNino_OISST_region_1and2)
SVDplot(ElNino_OISST_region_1and2, plot.type = "image")