README.md

ntwk

codecov R-CMD-check

The goal of ntwk is to provide functions for the statistical modelling of network time series, especially with irregularly-spaced data and a Lévy-type driving noise.

Installation

SOON You can install the released version of ntwk from CRAN with:

# install.packages("ntwk")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("valcourgeau/ntwk")

Example

This is a basic example of the GrOU 2-parameter MLE after constructing a sample path driven by a Brownian motion:

library(ntwk)
set.seed(1)
n <- 10000
d <- 5
theta_1 <- 1
theta_2 <- 2
mesh_size <- 0.01

# Generate a graph adjacency matrix
adj <- polymer_network(d = d, theta_1 = theta_1, theta_2 = theta_2)

# Generate a path
times <- seq(from = 0, by = mesh_size, length.out = n) # time grid
noise <- matrix(rnorm(d * n, mean = 0, sd = sqrt(mesh_size)), ncol = d)
path <- construct_path(
  nw_topo = adj, noise = noise, y_init = rep(0, d), delta_time = mesh_size
)

# Fits the Theta-GrOU (2 parameters) process
fit <- grou_mle(times = times, data = path, mode = "network")
print(fit) # should be c(theta_1, theta_2) = c(1, 2)
#> [1] 1.077150 2.137579


Try the ntwk package in your browser

Any scripts or data that you put into this service are public.

ntwk documentation built on Sept. 13, 2021, 9:07 a.m.