plot.gfpop: plot.gfpop

View source: R/plot.R

plot.gfpopR Documentation

plot.gfpop

Description

Plotting inferred segment parameters (the result of gfpop) and data.

Usage

## S3 method for class 'gfpop'
plot(x, ..., data, multiple = TRUE)

Arguments

x

a gfpop class object

...

Other parameters

data

the data from which we get the gfpop result

multiple

if TRUE we plot data and the model on different graphs. Only with "mean" and "poisson" cost functions (as in that case the parameter values represent the data mean value over each segment) we allow the User to plot signal and data on a single graph.

Value

plot data and the inferred gfpop segments

Examples

n <- 1000 #data length
data <- dataGenerator(n, c(0.3, 0.4, 0.7, 0.95, 1), c(1, 3, 1, -1, 4), "mean", sigma = 3)
myGraph <- graph(type = "relevant", gap = 0.5, penalty = 2 * sdDiff(data) ^ 2 * log(n))
g <- gfpop(data, myGraph, type = "mean")
plot(x = g, data = data, multiple = FALSE)

data <- dataGenerator(n, c(0.4, 0.8, 1), c(1, 1.7, 2.3), "exp")
g <- gfpop(data,graph(type = "isotonic", penalty = 2 * sdDiff(data) ^ 2 * log(n)), type = "exp")
plot(x = g, data = data, multiple = TRUE)

data <- dataGenerator(n, c(0.22, 0.75, 1), c(1.4,1,0.8), "poisson")
g <- gfpop(data, paperGraph(8), type = "poisson")
plot(x = g, data = data, multiple = TRUE)

gfpop documentation built on April 1, 2023, 12:22 a.m.