Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PARROT

PARROT (Phase-Altering Regulatory Rewiring Over Time) is an R package for change point detection in dynamic networks using stochastic block models (SBM).

It supports:

  • unipartite weighted (Gaussian) networks
  • unipartite binary (Bernoulli) networks
  • bipartite weighted (Gaussian) networks
  • bipartite binary (Bernoulli) networks

Installation

Install directly from GitHub:

install.packages("remotes")
remotes::install_github("cchen22/PARROT")

Then load the package:

library(PARROT)

Quick Start: Single Change Point (Permutation P-value)

library(PARROT)

set.seed(42)

# Simulate a unipartite Bernoulli network with one change point at t=25
sim <- simulate_sbm_cp(
  N = 30,
  T_len = 50,
  cp_time = 25,
  Q = 2,
  type = "unipartite",
  distribution = "bernoulli",
  theta1 = list(prob = matrix(c(0.8, 0.2, 0.2, 0.8), 2, 2)),
  theta2 = list(prob = matrix(c(0.2, 0.8, 0.8, 0.2), 2, 2))
)

# Detect a single change point and compute permutation p-value
fit <- parrot(
  Y = sim$Y,
  Q = 2,
  multiple = FALSE,
  scan_method = "profile",
  compute_cis = FALSE,
  compute_pvalues = TRUE,
  pvalue_method = "permutation"
)

print(fit)

# Inspect permutation p-value for the detected change point
if (length(fit$pvalues) > 0) {
  fit$pvalues[[1]][c("cp", "pvalue_method", "pvalue_raw", "pvalue_bh", "pvalue_bonferroni")]
}

plot(fit)

Common Arguments

  • multiple: use FALSE for fast single-CP detection.
  • scan_method: candidate split scan ("profile" or faster "score").
  • compute_cis: compute confidence intervals.
  • compute_pvalues: compute p-values for detected change points.
  • pvalue_method: "wilks", "permutation", or "bootstrap".

Citation

If you use PARROT in your research, please cite the corresponding manuscript and repository:

About

Network Change Point Detection using SBM

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages