knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center",
  fig.path = "man/figures/README-"
)

Overview

PWR: Piecewise Regression (PWR) for time series (or structured longitudinal data) modeling and optimal segmentation by using optimized dynamic programming.

Installation

You can install the PWR package from GitHub with:

# install.packages("devtools")
devtools::install_github("fchamroukhi/PWR_R")

To build vignettes for examples of usage, type the command below instead:

# install.packages("devtools")
devtools::install_github("fchamroukhi/PWR_R", 
                         build_opts = c("--no-resave-data", "--no-manual"), 
                         build_vignettes = TRUE)

Use the following command to display vignettes:

browseVignettes("PWR")

Usage

library(PWR)
# Application to a toy data set
data("toydataset")
x <- toydataset$x
y <- toydataset$y

K <- 5 # Number of segments
p <- 3 # Polynomial degree

pwr <- fitPWRFisher(X = x, Y = y, K, p)

pwr$summary()

pwr$plot()
# Application to a real data set
data("realdataset")
x <- realdataset$x
y <- realdataset$y2

K <- 5 # Number of segments
p <- 3 # Polynomial degree

pwr <- fitPWRFisher(X = x, Y = y, K, p)

pwr$summary()

pwr$plot()


fchamroukhi/PWR_R documentation built on Aug. 8, 2019, 3:30 p.m.