plot.fmca {cfda} R Documentation

## Plot the optimal encoding

### Description

Plot the optimal encoding

### Usage

```## S3 method for class 'fmca'
plot(
x,
harm = 1,
states = NULL,
coeff = 1.96,
col = NULL,
nx = 128,
...
)
```

### Arguments

 `x` output of `compute_optimal_encoding` function `harm` harmonic to use for the encoding `states` states to plot (default = NULL, it plots all states) `addCI` if TRUE, plot confidence interval (only when `computeCI = TRUE` in compute_optimal_encoding) `coeff` the confidence interval is computed with +- coeff * the standard deviation `col` a vector containing color for each state `nx` number of time points used to plot `...` not used

### Details

The encoding for the harmonic `h` is a_{x}^{(h)} \approx ∑_{i=1}^m α_{x,i}^{(h)}φ_i.

### Value

a `ggplot` object that can be modified using `ggplot2` package.

### Author(s)

Quentin Grimonprez

### Examples

```# Simulate the Jukes-Cantor model of nucleotide replacement
K <- 4
Tmax <- 6
PJK <- matrix(1/3, nrow = K, ncol = K) - diag(rep(1/3, K))
lambda_PJK <- c(1, 1, 1, 1)
d_JK <- generate_Markov(n = 10, K = K, P = PJK, lambda = lambda_PJK, Tmax = Tmax)
d_JK2 <- cut_data(d_JK, Tmax)

# create basis object
m <- 6
b <- create.bspline.basis(c(0, Tmax), nbasis = m, norder = 4)

# compute encoding
encoding <- compute_optimal_encoding(d_JK2, b, computeCI = FALSE, nCores = 1)

# plot the encoding produced by the first harmonic
plot(encoding)

# modify the plot using ggplot2
library(ggplot2)
plot(encoding, harm = 2, col = c("red" , "blue", "darkgreen", "yellow")) +
labs(title = "Optimal encoding")

```

[Package cfda version 0.9.9 Index]