library(knitr)
knitr::opts_chunk$set(
    fig.align = "center",
    fig.height = 5.5,
    fig.width = 6,
    warning = FALSE,
    collapse = TRUE,
    dev.args = list(pointsize = 10),
    out.width = "90%",
    par = TRUE
)
knit_hooks$set(par = function(before, options, envir)
  { if (before && options$fig.show != "none") 
       par(family = "sans", mar = c(4.1,4.1,1.1,1.1), mgp = c(3,1,0), tcl = -0.5)
})
library(MPWR)

Introduction

MPWR is an R package for multivariate time series (or multivariate structured longitudinal data) modeling and optimal segmentation via multiple polynomial piecewise regression (MPWR). It uses MLE for the estimation of the regression parameters with dynamic programming for the segmentation. This document gives a quick tour of MPWR (version r packageVersion("MPWR")) functionalities.

It was written in R Markdown, using the knitr package for production.

See help(package="MPWR") for further details and references provided by citation("MPWR").

Load data

data("toydataset")
x <- toydataset$x
Y <- as.matrix(toydataset[,c("y1", "y2", "y3")])

Set up MPWR model parameters

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

Estimation

mpwr <- fitMPWR(X = x, Y = Y, K, p)

Summary

mpwr$summary()

Plots

Regressors

mpwr$plot(what = "regressors")

Segmentation

mpwr$plot(what = "segmentation")


fchamroukhi/MPWR_r documentation built on April 24, 2020, 12:39 p.m.