plot.fpca {registr}R Documentation

Plot the results of a functional PCA

Description

S3 plot method for class fpca. Plot FPCA results by visualizing the variation of the individual FPCs around the global mean. based on an object created with function fpca_gauss, bfpca or gfpca_twoStep.

The shares of explained variance are included in the plot titles if x contains an element evalues_sum.

Usage

## S3 method for class 'fpca'
plot(
  x,
  plot_FPCs = 1:x$npc,
  sd_factor = 2,
  response_function = NULL,
  add_symbols = TRUE,
  subtitle = TRUE,
  xlim = NULL,
  ylim = NULL,
  xlab = "t [registered]",
  ylab = "y",
  ...
)

Arguments

x

Object of class "fpca".

plot_FPCs

Optional index vector of the FPCs to be plotted. Defaults to all FPCs contained in x.

sd_factor

Numeric factor with which the standard deviations of each FPC's scores are multiplied to display its variation in the plots. Defaults to 2.

response_function

Optional response function to be applied before plotting the curves. Defaults to NULL, i.e. the identity function if x$family is one of c("gaussian","binomial") or exp() if x$family is one of c("gamma","poisson").

add_symbols

Indicator if '+' and '-' symbols should be added to the plot to highlight the direction of the displayed FPCs. Defaults to TRUE.

subtitle

If TRUE (default) the parameter sd_factor is displayed in the plot subtitle.

xlim, ylim

Optional numeric vectors with limits for the x and y axis.

xlab, ylab

Optional titles for the x and y axis.

...

Additional arguments passed to theme.

Value

@return If multiple FPCs are plotted, returns a grid of ggplot plots, created with cowplot::plot_grid. If only one FPC is plotted, returns a single ggplot plot.

Author(s)

Alexander Bauer alexander.bauer@stat.uni-muenchen.de

Examples

data(growth_incomplete)

fpca_obj = fpca_gauss(Y = growth_incomplete, npc = 2)
if (requireNamespace("ggplot2", quietly = TRUE) &&
requireNamespace("cowplot", quietly = TRUE)) {
library(ggplot2)
plot(fpca_obj)
}


[Package registr version 2.1.0 Index]