mxPBF_mean {hdbcp}R Documentation

Change Point Detection in Mean Structure using Maximum Pairwise Bayes Factor (mxPBF)

Description

This function detects change points in the mean structure of multivariate Gaussian data using the Maximum Pairwise Bayes Factor (mxPBF). The function selects alpha that controls the empirical False Positive Rate (FPR), as suggested in the paper. One can conduct a multiscale approach using the function majority_rule_mxPBF().

Usage

mxPBF_mean(given_data, nws, alps, FPR_want = 0.05, n_sample = 300, n_cores = 1)

Arguments

given_data

An (n \times p) data matrix representing n observations and p variables.

nws

A set of window sizes for change point detection.

alps

A grid of alpha values used in the empirical False Positive Rate (FPR) method.

FPR_want

Desired False Positive Rate for selecting alpha, used in the empirical FPR method (default: 0.05).

n_sample

Number of simulated samples to estimate the empirical FPR, used in the empirical FPR method (default: 300).

n_cores

Number of threads for parallel execution via OpenMP (default: 1).

Value

A list of length equal to the number of window sizes provided. Each element in the list contains:

Change_points

Locations of detected change points.

Bayes_Factors

Vector of calculated Bayes Factors for each middle points.

Selected_alpha

Optimal alpha value selected based on the method that controls the empirical FPR.

Window_size

Window size used for change point detection.

Examples


nws <- c(25, 60, 100)
alps <- seq(1,10,0.05)
## H0 data
mu1 <- rep(0,10)
sigma <- diag(10)
X <- mvrnorm_cpp(500, mu1, sigma)
res1 <- mxPBF_mean(X, nws, alps)

## H1 data
mu2 <- rep(1,10)
sigma <- diag(10)
Y <- rbind(mvrnorm_cpp(250,mu1,sigma), mvrnorm_cpp(250,mu2,sigma))
res2 <- mxPBF_mean(Y, nws, alps)



[Package hdbcp version 1.0.0 Index]