funData-class {funData} | R Documentation |
A class for (univariate) functional data
Description
The funData
class represents functional data on -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
on a -dimensional
domain
. The data is usually sampled on a fine grid
, which is represented in the
argvals
slot of a funData
object. All observations are assumed
to be sampled over the same grid , but can contain missing values
(see below). If
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 is
higher-dimensional,
argvals
must always be supplied as a list,
containing numeric vectors of the x-values in dimensions
.
The observed values are represented in the X
slot of a funData
object, which is an array of dimension (for
one-dimensional domains, or
for higher-dimensional domains). Here
equals
the number of observations and
denotes the number of sampling
points (for higher dimensional domains
denotes the number of
sampling points in dimension
).
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 thenorm.
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 withargvals
given as list. -
funData(argvals = numeric, X = array)
: Constructor for functional data objects withargvals
given as vector of numerics (only valid for one-dimensional domains). -
show(funData)
: Print basic information about thefunData
object in the console. The default console output forfunData
objects. -
names(funData)
: Get the names of thefunData
object. -
names(funData) <- value
: Set the names of thefunData
object. -
str(funData)
: Astr
method forfunData
objects, giving a compact overview of the structure. -
summary(funData)
: Asummary
method forfunData
objects.
Functions
-
funData()
: Constructor for functional data objects, first argument (argvals) passed as list or vector of numerics
Slots
argvals
The domain
of the data. See Details.
X
The 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)