plot.fpca.dfrr {dfrr}R Documentation

Plot dfrr functional principal components

Description

Plot a fpca.dfrr object.

Usage

## S3 method for class 'fpca.dfrr'
plot(
  x,
  plot.eigen.functions = TRUE,
  select = NULL,
  plot.contour = FALSE,
  plot.3dsurface = FALSE,
  plot.contour.pars = list(breaks = NULL, minor_breaks = NULL, n.breaks = NULL, labels =
    NULL, limits = NULL, colors = NULL, xlab = NULL, ylab = NULL, title = NULL),
  plot.3dsurface.pars = list(xlab = NULL, ylab = NULL, zlab = NULL, title = NULL, colors
    = NULL),
  ask.hit.return = TRUE,
  ...
)

Arguments

x

a fpca.dfrr-object to be plotted. It is the output of the function fpca()

plot.eigen.functions

a boolean indicating whether to print the principal components/eigen-functions. Defaults to TRUE.

select

a vector of length one or more of indices of eigenfunctions to be plotted.

plot.contour

a boolean indicating whether to print the contour plot of the kernel function. It requires ggplot2-package to be installed. Defaults to FALSE.

plot.3dsurface

a boolean indicating whether to print the 3d surface plot of the kernel function. It requires the package plotly to be installed. Defaults to FALSE.

plot.contour.pars

a named list of graphical parameters passed to the function ggplot.

plot.3dsurface.pars

a named list of graphical parameters passed to the function plot_ly.

ask.hit.return

a boolean indicating whether to wait for interaction of the user between any two plots.

...

graphical parameters passed to plot function in drawing 2D eigenfunctions.

Details

This function plots the functional principal components, contour plot and 3d surface of the kernel function.

If ggplot2-package is installed, the contour plot of the kernel function is produced by setting the argument plot.contour=TRUE. Some graphical parameters of the contour plot can be modified by setting the (optional) argument plot.contour.pars.

If the package plotly is installed, the 3d surface of the kernel function is produced by setting the argument plot.3dsurface=TRUE. Some graphical parameters of the 3d surface can be modified by setting the (optional) argument plot.3dsurface.pars.

Value

This function generates the plot of principal components.

Examples

set.seed(2000)
N<-50;M<-24

X<-rnorm(N,mean=0)
time<-seq(0,1,length.out=M)
Y<-simulate_simple_dfrr(beta0=function(t){cos(pi*t+pi)},
                        beta1=function(t){2*t},
                        X=X,time=time)

 #The argument T_E indicates the number of EM algorithm.
#T_E is set to 1 for the demonstration purpose only.
#Remove this argument for the purpose of converging the EM algorithm.
dfrr_fit<-dfrr(Y~X,yind=time,T_E=1)
fpcs<-fpca(dfrr_fit)
plot(fpcs,plot.eigen.functions=TRUE,plot.contour=TRUE,plot.3dsurface=TRUE)


[Package dfrr version 0.1.5 Index]