Title: | Feature Extraction for Discretely-Sampled Functional Data |
---|---|
Description: | Discretely-sampled function is first smoothed. Features of the smoothed function are then extracted. Some of the key features include mean value, first and second derivatives, critical points (i.e. local maxima and minima), curvature of cunction at critical points, wiggliness of the function, noise in data, and outliers in data. |
Authors: | Ravi Varadhan, Johns Hopkins University, and MKG Subramaniam, AT&T Reserach Labs. |
Maintainer: | Ravi Varadhan <[email protected]> |
License: | GPL (>= 2) |
Version: | 2015.12-1 |
Built: | 2024-11-02 03:11:16 UTC |
Source: | https://github.com/cran/features |
Discretely-sampled function is first smoothed. Features of the smoothed function are then extracted. Some of the key features include mean value, first and second derivatives, critical points (i.e. local maxima and minima), curvature of function at critical points, wiggliness of the function, noise in data, and outliers in data.
features(x, y, smoother=c("glkerns", "smooth.spline"), fits.return=TRUE, control = list(), ...)
features(x, y, smoother=c("glkerns", "smooth.spline"), fits.return=TRUE, control = list(), ...)
x |
a vector of independent variable (e.g. time) at which the function is sampled. |
y |
a vector of response values to be smoothed |
smoother |
a character string specifying the name of the smoothing algorithm; currently only 2 smoothers are implemented: smoothing spline and a kernel smoother with a global plug-in bandwidth |
fits.return |
a logical variable specifying whether or not to return the smoothed function and its first 2 derivatives. Default is TRUE. It must be TRUE for plotting the results. |
control |
A list of control parameters. See *Details* for more information. |
... |
Additional arguments to be passed to the smoothers. An important optional parameter is the |
Argument control
is a list specifing any changes to default values of control parameters. Note that the names of these must be specified completely. Partial matching will not work.
Default values of control
are: ctrl <- list(npts=100, c.outlier=3, decim.out=2)
npts
: an integer. Number of points to use in estimating smoothed function and for computing features
c.outlier
: a constant denoting number of standard deviations away from smooth fit for determining whether a point is an outlier. Default is 3.
decim.out
: number of decimals to display in the features output.
A list with a number of extracted features of the underlying smooth function:
f |
: a numeric vector containing 10 basic features of the function: mean, min, max, std.dev, noise, signa-to-noise ratio, minimum and maximum of first derivative, wiggliness, and number of critical points |
cpts |
: Locations of the critical points (e.g. points where the first derivative is zero) |
curvature |
: Value of second derivative at the critical points |
outliers |
: Locations of outlying data points |
fits |
an attribute of the object returned by |
fget
, plot.features
, plot
, glkerns
, smooth.spline
# Estimating the smooth and the derivatives of a noisy and discretely sampled function. n <- 200 x <- sort(runif(n)) y <- exp(-0.2 * sin(2*pi*x)) + rnorm(n, sd=0.05) ans <- features(x, y) fget(ans)
# Estimating the smooth and the derivatives of a noisy and discretely sampled function. n <- 200 x <- sort(runif(n)) y <- exp(-0.2 * sin(2*pi*x)) + rnorm(n, sd=0.05) ans <- features(x, y) fget(ans)
class "features"
.
This is a utility function that operates only on objects of class "features"
that are returned by the function features()
. Some of the key extracted features include mean value, first and second derivatives, critical points
(i.e. local maxima and minima), curvature of function at critical points, wiggliness of the function, noise in data, and outliers in data.
fget(x)
fget(x)
x |
An object of |
A list with a number of extracted features of the underlying smooth function:
f |
: a numeric vector containing 10 basic features of the function (in order): mean, min, max, std.dev, noise, signal-to-noise ratio, minimum and maximum of first derivative, wiggliness, and number of critical points |
cpts |
: Locations of the critical points (e.g. points where the first derivative is zero) |
curvature |
: Value of second derivative at the critical points |
outliers |
: Locations of outlying data points |
# Estimating the smooth and the derivatives of a noisy and discretely sampled function. n <- 200 x <- sort(runif(n)) y <- exp(-0.2 * sin(2*pi*x)) + rnorm(n, sd=0.05) ans <- features(x, y) fget(ans)
# Estimating the smooth and the derivatives of a noisy and discretely sampled function. n <- 200 x <- sort(runif(n)) y <- exp(-0.2 * sin(2*pi*x)) + rnorm(n, sd=0.05) ans <- features(x, y) fget(ans)
Plots of the smoothed function and its first 2 derivatives.
## S3 method for class 'features' plot(x, ...)
## S3 method for class 'features' plot(x, ...)
x |
an object of |
... |
Additional arguments to be passed to the |
A plot is shown in a 2 x 2 layout, where the top 2 frames are the same and they depict the raw data and the smoothed function. The bottom left panel shows the smoothed first derivative, and the bottom right panel depicts the smoothed second derivative.
# Estimating the smooth and the derivatives of a noisy and discretely sampled function. n <- 200 x <- sort(runif(n)) y <- exp(-0.2 * sin(2*pi*x)) + rnorm(n, sd=0.05) ans <- features(x, y) plot(ans) ans.sm <- features(x, y, smoother="smooth.spline") plot(ans.sm)
# Estimating the smooth and the derivatives of a noisy and discretely sampled function. n <- 200 x <- sort(runif(n)) y <- exp(-0.2 * sin(2*pi*x)) + rnorm(n, sd=0.05) ans <- features(x, y) plot(ans) ans.sm <- features(x, y, smoother="smooth.spline") plot(ans.sm)