Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

funData-class

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

## 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 N x M (for one-dimensional domains, or N x M_1 x … x M_d for higher-dimensional domains), giving the observed values for N individuals. Missing values can be included via NA. See Details.

object

A funData object.

x

The funData object.

value

The names to be given to the funData curves.

...

Other parameters passed to summary.

Details

Functional data can be seen as realizations of a random process

X: T -> IR

on a d-dimensional domain T. The data is usually sampled on a fine grid T subset of 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 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 T is higher-dimensional, argvals must always be supplied as a list, containing numeric vectors of the x-values in dimensions 1,…,d.

The observed values are represented in the X slot of a funData object, which is an array of dimension N x M (for one-dimensional domains, or N x M_1 x … x 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,…, 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 via funData@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 the L^2 norm.

A funData object can be coerced to a multiFunData object using as.multiFunData(funDataObject).

Methods (by generic)

  • funData: Constructor for functional data objects with argvals given as list.

  • funData: Constructor for functional data objects with argvals given as vector of numerics (only valid for one-dimensional domains).

  • show: Print basic information about the funData object in the console. The default console output for funData objects.

  • names: Get the names of the funData object.

  • names<-: Set the names of the funData object.

  • str: A str method for funData objects, giving a compact overview of the structure.

  • summary: A summary method for funData objects.

Slots

argvals

The domain T 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)

funData

An S4 Class for Functional Data

v1.3-5
GPL-2
Authors
Clara Happ-Kurz [aut, cre]
Initial release
2020-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.