Learn R Programming

ggfortify (version 0.4.17)

fortify.cpt: Convert changepoint::cpt and strucchange::breakpoints to data.frame

Description

Convert changepoint::cpt and strucchange::breakpoints to data.frame

Usage

# S3 method for cpt
fortify(model, data = NULL, is.date = NULL, ...)

Value

data.frame

Arguments

model

chantepoint::cpt or strucchange::breakpoints instance

data

original dataset, if needed

is.date

Logical frag indicates whether the stats::ts is date or not. If not provided, regard the input as date when the frequency is 4 or 12.

...

other arguments passed to methods

Examples

Run this code
if (FALSE) {
library(changepoint)
fortify(cpt.mean(AirPassengers))
fortify(cpt.var(AirPassengers))
fortify(cpt.meanvar(AirPassengers))

library(strucchange)
bp.nile <- breakpoints(Nile ~ 1)
fortify(bp.nile)
fortify(breakpoints(bp.nile, breaks = 2))
fortify(breakpoints(bp.nile, breaks = 2), data = Nile)
}

Run the code above in your browser using DataLab