Learn R Programming

ReMFPCA (version 2.0.0)

mfd: Define a Set of Multidimensional Functional Data objects

Description

The `mfd` class represents a set of multidimensional functional data with `basismfd` object. Functional data objects are constructed by specifying a set of basis functions and a set of coefficients defining a linear combination of these basis functions.

Constructor for `mfd` objects (same as Mfd(...) )

Usage

Mfd(argval = NULL, X, mdbs, method = "data")

Arguments

argval

A list of numeric vectors of argument values at which the `mfd` object is to be evaluated

X

A numeric matrix corresponds to basis expansion coefficients if `method="coefs"` and discrete observations if `method="data"`.

mdbs

a basismfd object

method

determine the `X` matrix type as "coefs" and "data".

Active bindings

basis

an object of the class `basismfd`.

coefs

a matrix of the coefficients.

nobs

number of the observation

Methods


Method new()

Constructor for `mfd` objects (same as Mfd(...) )

Usage

mfd$new(argval = NULL, X, mdbs, method = "data")

Arguments

argval

A list of numeric vectors of argument values at which the `mfd` object is to be evaluated

X

A numeric matrix corresponds to basis expansion coefficients if `method="coefs"` and discrete observations if `method="data"`.

mdbs

a basismfd object

method

determine the `X` matrix type as "coefs" and "data".


Method eval()

Evaluation an `mfd` object in some arguments.

Usage

mfd$eval(evalarg)

Arguments

evalarg

a list of numeric vector of argument values at which the mfd is to be evaluated.

Returns

A matrix of evaluated values


Method print()

Print method for `mfd` objects

Usage

mfd$print(...)

Arguments

...

Additional arguments to be passed to `print`


Method clone()

The objects of this class are cloneable with this method.

Usage

mfd$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

basismfd

Examples

Run this code
require(fda)
bs1 <- create.fourier.basis(c(0,2*pi),5)
bs2 <- create.bspline.basis(c(0,1),7)
bs3 <- create.exponential.basis(c(0,2),3)

#1-D mfd :_____________________________
argval <- seq(0,2*pi,length.out=100)
nobs <- 10;
X <- outer(sin(argval),seq(0.5,1.5,length.out=nobs))
mdbs1 <- Basismfd(bs1)
mfd1 <- Mfd(X=X, mdbs = mdbs1)
inprod_mfd(mfd1,mfd1)
norm_mfd(mfd1)
mfd0 <- 2.5*mfd1
mfd1-mfd0
mfd1[1:3]

mfd1$eval(argval)
mfd1c <- Mfd(X=mfd1$coefs, mdbs = mdbs1, method = "coefs")
all.equal(c(mfd1$basis,mfd1$coefs,mfd1$nobs),c(mfd1c$basis,mfd1c$coefs,mfd1c$nobs))
length(mfd1)
mean(mfd1)
plot(mfd1)

Run the code above in your browser using DataLab