Learn R Programming

FluxPoint (version 0.1.2)

estimate_musseg: Estimate fluctuating mean segmentwise given detected change points

Description

Estimates the fluctuating mean sequence \(\{\boldsymbol{\mu}_t\}_{t=1}^n\) segmentwise by applying the maximum likelihood estimation (MLE) procedure within each segment defined by detected change points.

Usage

estimate_musseg(data, cps, Sig_eta, Sig_nu, Phi, Sig_e1)

Value

A numeric matrix of dimension \(n \times p\), containing the estimated fluctuating mean sequence across all segments.

Arguments

data

Numeric matrix of dimension \(n \times p\), representing the multivariate time series \(\{\mathbf{y}_t\}_{t=1}^n\).

cps

Numeric vector of detected change point locations (sorted indices).

Sig_eta

Numeric \(p \times p\) covariance matrix \(\Sigma_{\boldsymbol{\eta}}\) of the random walk innovation.

Sig_nu

Numeric \(p \times p\) covariance matrix \(\Sigma_{\boldsymbol{\nu}}\) of the VAR(1) innovation.

Phi

Numeric \(p \times p\) autoregressive coefficient matrix \(\Phi\).

Sig_e1

Numeric \(p \times p\) initial-state covariance matrix \(\Gamma_{\boldsymbol{\epsilon}}(0)\).

Details

The time series is partitioned into contiguous segments defined by the specified change points. Within each segment, estimate_mus is applied to obtain the maximum likelihood estimate of the fluctuating mean sequence for that interval. The resulting segment-wise estimates are then concatenated to form a complete piecewise estimate of \(\boldsymbol{\mu}_t\) over the entire time series.

Examples

Run this code
set.seed(123)
p <- 3
mu0 <- rep(0, p)
deltas <- list(c(3, 0, -3), c(-2, 4, 0))
Sig_eta <- diag(0.01, p)
Sig_nu  <- random_Signu(p, 0)
Phi     <- random_Phi(p, p)
Sig_e1  <- get_Sig_e1_approx(Sig_nu, Phi)

# Generate data and estimate mean segmentwise after known CPs
Y <- generate_data(mu0, deltas, Sig_eta, Sig_nu, Phi, Sig_e1,
                   errortype = "n", number_cps = 2, lengthofeachpart = 100)
cps <- c(100, 200)
mu_seg <- estimate_musseg(Y, cps, Sig_eta, Sig_nu, Phi, Sig_e1)
dim(mu_seg)

Run the code above in your browser using DataLab