| funData-class {funData} | R Documentation |
A class for (univariate) functional data
Description
The funData class represents functional data on d-dimensional
domains. The two slots represent the domain (x-values) and the values of the
different observations (y-values).
Usage
funData(argvals, X)
## S4 method for signature 'list,array'
funData(argvals, X)
## S4 method for signature 'numeric,array'
funData(argvals, X)
## S4 method for signature 'funData'
show(object)
## S4 method for signature 'funData'
names(x)
## S4 replacement method for signature 'funData'
names(x) <- value
## S4 method for signature 'funData'
str(object, ...)
## S4 method for signature 'funData'
summary(object, ...)
Arguments
argvals |
A list of numeric vectors or a single numeric vector, giving the sampling points in the domains. See Details. |
X |
An array of dimension |
object |
A |
x |
The |
value |
The names to be given to the |
... |
Other parameters passed to |
Details
Functional data can be seen as realizations of a random process
X:
\mathcal{T} \to \mathrm{IR}
on a d-dimensional
domain \mathcal{T}. The data is usually sampled on a fine grid
T \subset \mathcal{T}, which is represented in the
argvals slot of a funData object. All observations are assumed
to be sampled over the same grid T, but can contain missing values
(see below). If \mathcal{T} is one-dimensional, argvals
can be supplied either as a numeric vector, containing the x-values or as a
list, containing such a vector. If \mathcal{T} is
higher-dimensional, argvals must always be supplied as a list,
containing numeric vectors of the x-values in dimensions
1,\ldots,d.
The observed values are represented in the X slot of a funData
object, which is an array of dimension N \times M (for
one-dimensional domains, or N \times M_1 \times \ldots \times M_d for higher-dimensional domains). Here N equals
the number of observations and M denotes the number of sampling
points (for higher dimensional domains M_i denotes the number of
sampling points in dimension i, i = 1,\ldots, d).
Missing values in the observations are allowed and must be marked by
NA. If missing values occur due to irregular observation points, the
data can be stored alternatively as an object of class
irregFunData.
Generic functions for the funData class include a print method,
plotting and basic arithmetics.
Further methods for funData:
-
dimSupp,nObs: Informations about the support dimensions and the number of observations, -
getArgvals,extractObs: Getting/Setting slot values (instead of accessing them directly viafunData@argvals, funData@X) and extracting single observations or data on a subset of the domain, -
integrate,norm: Integrate all observations over their domain or calculating theL^2norm.
A funData object can be coerced to a multiFunData object using
as.multiFunData(funDataObject).
Methods (by generic)
-
funData(argvals = list, X = array): Constructor for functional data objects withargvalsgiven as list. -
funData(argvals = numeric, X = array): Constructor for functional data objects withargvalsgiven as vector of numerics (only valid for one-dimensional domains). -
show(funData): Print basic information about thefunDataobject in the console. The default console output forfunDataobjects. -
names(funData): Get the names of thefunDataobject. -
names(funData) <- value: Set the names of thefunDataobject. -
str(funData): Astrmethod forfunDataobjects, giving a compact overview of the structure. -
summary(funData): Asummarymethod forfunDataobjects.
Functions
-
funData(): Constructor for functional data objects, first argument (argvals) passed as list or vector of numerics
Slots
argvalsThe domain
\mathcal{T}of the data. See Details.XThe functional data samples. See Details.
See Also
Examples
### Creating a one-dimensional funData object with 2 observations
# Basic
f1 <- new("funData", argvals = list(1:5), X = rbind(1:5,6:10))
# Using the constructor with first argument supplied as array
f2 <- funData(argvals = list(1:5), X = rbind(1:5, 6:10))
# Using the constructor with first argument supplied as numeric vector
f3 <- funData(argvals = 1:5, X = rbind(1:5, 6:10))
# Test if all the same
all.equal(f1,f2)
all.equal(f1,f3)
# Display funData object in the console
f3
# A more realistic object
argvals <- seq(0,2*pi,0.01)
object <- funData(argvals, outer(seq(0.75, 1.25, by = 0.05), sin(argvals)))
# Display / summary give basic information
object
summary(object)
# Use the plot function to get an impression of the data
plot(object)
### Higher-dimensional funData objects with 2 observations
# Basic
g1 <- new("funData", argvals = list(1:5, 1:3),
X = array(1:30, dim = c(2,5,3)))
# Using the constructor
g2 <- funData(argvals = list(1:5, 1:3),
X = array(1:30, dim = c(2,5,3)))
# Test if the same
all.equal(g1,g2)
# Display funData object in the console
g2
# Summarize information
summary(g2)