getPiecewiseRMSE: Get the RMSE using piecewise regressions

View source: R/Trimming.R

getPiecewiseRMSER Documentation

Get the RMSE using piecewise regressions

Description

Internal function that retrieves the optimal RMSE from performing piecewise linear regression and/or harmonic regression fits on two consecutive segments.

Usage

getPiecewiseRMSE(series, changepoint, trendsOnly=F, seasonalityOnly=F, numHarmonics=2)

Arguments

series

A vector of observations on which to run changepoint analysis. For this particular function, this series should only contain two segments, separated by a single changepoint.

changepoint

The index indicating the changepoint. A changepoint is located immediately prior to a shift in the series.

trendsOnly

Boolean that, when TRUE, indicates that only linear regressions should be used.

seasonalityOnly

Boolean that, when TRUE, indicates that only harmonic regressions should be used.

numHarmonics

If harmonic regressions are used, this indicates the number of harmonics to be modeled (currently restricted to being 1 or 2).

Details

When both trendsOnly and seasonalityOnly are FALSE (the default), then both linear regressions and harmonic regressions are considered for the piecewise fits. The best fits on either side of the changepoint contribute to the piecewise RMSE.

For all regressions, the dependent variable is the series of observations and the independent variable is the index associated with each observation as part of that series.

Value

Returns the optimal piecewise RMSE (a numeric value).

Author(s)

Matthew Quinn


matthewquinn1/changepointSelect documentation built on July 25, 2022, 7:12 p.m.