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 IRn is a vector of n scalars. In this implementation, a multiFunData object is represented as a list of univariate funData objects, see Details.
class
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,...)
Arguments
...: A list of funData objects or several funData objects passed as one argument, each. See Details.
x: The multiFunData object.
value: The names to be given to the multiFunData curves.
object: A multiFunData object.
Details
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 c("f=\n", "(f1,ldots,fp)") is defined as
A funData object can be coerced to a multiFunData object with one element using as.multiFunData(funDataObject).
Methods (by generic)
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.
Functions
multiFunData(): Constructor for multivariate functional data objects
Examples
### Creating a multifunData object with 2 observations on the same domain# Univariate elementsx <-1:5f1 <- funData(x, rbind(x, x+1))f2 <- funData(x,rbind(x^2, sin(x)))# Basicm1 <- new("multiFunData", list(f1,f2))# Using the constructor, passing the elements as listm2 <- multiFunData(list(f1,f2))# Using the constructor, passing the elements directlym3 <- multiFunData(f1,f2)# Test if all the sameall.equal(m1,m2)all.equal(m1,m3)# Display multiFunData object in the consolem3
# Summarizesummary(m3)### Creating a multifunData object with 2 observations on different domains (both 1D)# A new elementy <-1:3g1 <- funData(y, rbind(3*y, y+4))# Create the multiFunData objectm4 <- multiFunData(f1,g1)# Display multiFunData object in the consolem4
### Creating a multifunData object with 2 observations on different domains (1D and 2D)# A new elementy <-1:3; z <-1:4g2 <- funData(list(y,z), array(rnorm(24), dim = c(2,3,4)))# Create the multiFunData objectm5 <- multiFunData(f1,g2)# Display multiFunData object in the consolem5
### A more realistic object# element 1x <- seq(0,2*pi,0.01)f1 <- funData(x, outer(seq(0.75,1.25, length.out =6), sin(x)))# element 2y <- seq(-1,1,0.01); z <- seq(-0.5,0.5,0.01)X2 <- array(NA, c(6, length(y), length(z)))for(i in1:6) X2[i,,]<- outer(y, z,function(x,y){sin(i*pi*y)*cos(i*pi*z)})f2 <- funData(list(y,z), X2)# MultiFunData Objectm6 <- multiFunData(f1,f2)# Display multiFunData object in the console for basic informationm6
# Summarizesummary(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 plottingplot(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)"))