multiFunData-class | R Documentation |
The multiFunData
class represents multivariate functional data on
(potentially) different domains, i.e. a multivariate functional data object
is a vector of (univariate) functional data objects, just as a vector in
\mathrm{IR}^n
is a vector of n
scalars. In this implementation, a
multiFunData
object is represented as a list of univariate
funData
objects, see Details.
multiFunData(...)
## S4 method for signature 'ANY'
multiFunData(...)
## S4 method for signature 'multiFunData'
names(x)
## S4 replacement method for signature 'multiFunData'
names(x) <- value
## S4 method for signature 'multiFunData'
str(object, ...)
## S4 method for signature 'multiFunData'
summary(object, ...)
... |
A list of funData objects or several funData objects passed as one argument, each. See Details. |
x |
The |
value |
The names to be given to the |
object |
A |
A multiFunData
object is represented as a list of univariate
funData
objects, each having a argvals
and X
slot,
representing the x-values and the observed y-values (see the
funData
class). When constructing a multiFunData
object,
the elements can be supplied as a list of funData
objects or can be
passed directly as arguments to the constructor function.
Most functions implemented for the funData
class are also
implemented for multiFunData
objects. In most cases, they simply apply
the corresponding univariate method to each element of the multivariate
object and return it as a vector (if the result of the univariate function is
scalar, such as dimSupp
) or as a multiFunData
object (if
the result of the univariate function is a funData
object, such as
extractObs
).
The norm of a multivariate functional data f = (f_1 , \ldots, f_p)
is defined as
||| f ||| := \left(\sum_{j=1}^p ||
f_j ||^2 \right) ^{1/2}.
A funData
object can be coerced to a multiFunData
object with
one element using as.multiFunData(funDataObject).
multiFunData(ANY)
: Constructor for multivariate functional data
objects.
names(multiFunData)
: Get the names of the multiFunData
object.
names(multiFunData) <- value
: Set the names of the multiFunData
object.
str(multiFunData)
: A str
method for multiFunData
objects, giving a compact overview of the structure.
summary(multiFunData)
: A summary
method for multiFunData
objects.
multiFunData()
: Constructor for multivariate functional data objects
funData
### Creating a multifunData object with 2 observations on the same domain
# Univariate elements
x <- 1:5
f1 <- funData(x, rbind(x, x+1))
f2 <- funData(x,rbind(x^2, sin(x)))
# Basic
m1 <- new("multiFunData", list(f1,f2))
# Using the constructor, passing the elements as list
m2 <- multiFunData(list(f1,f2))
# Using the constructor, passing the elements directly
m3 <- multiFunData(f1,f2)
# Test if all the same
all.equal(m1,m2)
all.equal(m1,m3)
# Display multiFunData object in the console
m3
# Summarize
summary(m3)
### Creating a multifunData object with 2 observations on different domains (both 1D)
# A new element
y <- 1:3
g1 <- funData(y, rbind(3*y, y+4))
# Create the multiFunData object
m4 <- multiFunData(f1,g1)
# Display multiFunData object in the console
m4
### Creating a multifunData object with 2 observations on different domains (1D and 2D)
# A new element
y <- 1:3; z <- 1:4
g2 <- funData(list(y,z), array(rnorm(24), dim = c(2,3,4)))
# Create the multiFunData object
m5 <- multiFunData(f1,g2)
# Display multiFunData object in the console
m5
### A more realistic object
# element 1
x <- seq(0,2*pi, 0.01)
f1 <- funData(x, outer(seq(0.75, 1.25, length.out = 6), sin(x)))
# element 2
y <- seq(-1,1, 0.01); z <- seq(-0.5, 0.5, 0.01)
X2 <- array(NA, c(6, length(y), length(z)))
for(i in 1:6) X2[i,,] <- outer(y, z, function(x,y){sin(i*pi*y)*cos(i*pi*z)})
f2 <- funData(list(y,z), X2)
# MultiFunData Object
m6 <- multiFunData(f1,f2)
# Display multiFunData object in the console for basic information
m6
# Summarize
summary(m6)
# Use the plot function to get an impression of the data
## Not run: plot(m6) # m6 has 2D element, must specify one observation for plotting
plot(m6, obs = 1, main = c("1st element (obs 1)", "2nd element (obs 1)"))
plot(m6, obs = 6, main = c("1st element (obs 6)", "2nd element (obs 6)"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.