This is the constructor function for objects of the mfd class.
It is a wrapper to `fda::fd`

,
but it forces the coef argument to be
a three-dimensional array of coefficients even if
the functional data is univariate.
Moreover, it allows to include the original raw data from which
you get the smooth functional data.
Finally, it also includes the matrix of precomputed inner products
of the basis functions, which can be useful to speed up computations
when calculating inner products between functional observations

`mfd(coef, basisobj, fdnames = NULL, raw = NULL, id_var = NULL, B = NULL)`

- coef
A three-dimensional array of coefficients:

* the first dimension corresponds to basis functions.

* the second dimension corresponds to the number of multivariate functional observations.

* the third dimension corresponds to variables.

- basisobj
A functional basis object defining the basis, as provided to

`fda::fd`

, but there is no default.- fdnames
A list of length 3, each member being a string vector containing labels for the levels of the corresponding dimension of the discrete data.

The first dimension is for a single character indicating the argument values, i.e. the variable on the functional domain.

The second is for replications, i.e. it denotes the functional observations.

The third is for functional variables' names.

- raw
A data frame containing the original discrete data. Default is NULL, however, if provided, it must contain:

a column (indicated by the

`id_var`

argument) denoting the functional observations, which must correspond to values in`fdnames[[2]]`

,a column named as

`fdnames[[1]]`

, returning the argument values of each functionas many columns as the functional variables, named as in

`fdnames[[3]]`

, containing the discrete functional values for each variable.- id_var
A single character value indicating the column in the

`raw`

argument containing the functional observations (as in`fdnames[[2]]`

), default is NULL.- B
A matrix with the inner products of the basis functions. If NULL, it is calculated from the basis object provided. Default is NULL.

A multivariate functional data object
(i.e., having class `mfd`

),
which is a list with components named
`coefs`

, `basis`

, and `fdnames`

,
as for class `fd`

,
with possibly in addition the components `raw`

and `id_var`

.

To check that an object is of this class, use function is.mfd.

Ramsay, James O., and Silverman, Bernard W. (2006),
*Functional Data Analysis*, 2nd ed., Springer, New York.

Ramsay, James O., and Silverman, Bernard W. (2002),
*Applied Functional Data Analysis*, Springer, New York.