Learn R Programming

funData (version 1.3-3)

Math.funData: Mathematical operations for functional data objects

Description

These functions allow to apply mathematical operations (such as \(exp(), log(), sin(), cos()\) or \(abs()\) to functional data objects based on Math. The operations are made pointwise for each observation.

Usage

# S4 method for funData
Math(x)

# S4 method for multiFunData Math(x)

# S4 method for irregFunData Math(x)

Arguments

x

An object of class funData, irregFunData or multiFunData.

Value

An object of the same functional data class as x.

See Also

'>funData, '>irregFunData, '>multiFunData, Math

Examples

Run this code
# NOT RUN {
oldpar <- par(no.readonly = TRUE)
par(mfrow = c(1,2))

# simulate a funData object on 0..1 with 10 observations
argvals <- seq(0, 1, 0.01)
f <- simFunData(argvals = argvals, N = 10, 
                M = 5, eFunType = "Fourier", eValType = "linear")$simData

### FunData
plot(f, main = "Original data")
plot(abs(f), main = "Absolute values")

### Irregular
# create an irrgFunData object by sparsifying f
i <- as.irregFunData(sparsify(f, minObs = 5, maxObs = 10))

plot(i, main = "Sparse data")
plot(cumsum(i), main = "'cumsum' of sparse data")

### Multivariate
m <- multiFunData(f, -1*f)
plot(m, main = "Multivariate Data")
plot(exp(m), main = "Exponential")

par(oldpar)
# }

Run the code above in your browser using DataLab