mfd
classLet us show how the funcharts
package works through an example with the dataset air
,
which has been included from the R package FRegSigCom
and is used in the paper of Qi and Luo (2019).
mfd
classWe provide the mfd
class for multivariate functional data.
It inherits from the fd
class but provides some additional features:
coef
argument to be an array even when the number of functional observations and/or the number of functional variables are one[
that never drops dimensions, then it always returns a mfd
object with three-dimensional array argument coef
; moreover it allows extracting observations/variables also by nameThe first thing is to get the mfd
object from discrete data.
We currently allow two types of input with the two functions:
get_mfd_data.frame
: first input must be a data.frame in the long format, with:arg
column giving the argument (x
) values,id
column indicating the functional observation,y
valuesget_mfd_list
: first input must be a list of matrices for the case all functional data are observed on the same grid, which:In this example, the dataset air
is in the second format (list of matrices, with data observed on the same grid)
library(funcharts) data("air") fun_covariates <- names(air)[names(air) != "NO2"] mfdobj_x <- get_mfd_list(air[fun_covariates], grid = 1:24)
We also provide plotting functions based on ggplot2
and patchwork
.
plot_mfd(mfdobj_x)
plot_mfd(mfdobj_x[1:10, c("CO", "C6H6")])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.