Learn R Programming

EDISON (version 1.1.1)

generateNetwork: Generate a random network.

Description

This function generates a random network with changepoints for structure changes, for simulating synthetic data.

Usage

generateNetwork(lambda_2 = 0.45, q = 10, min_phase_length = 1, k_bar = 5, l = 10, lambda_3 = 2, spacing = 1, gauss_weights = TRUE, same = FALSE, change_method = "sequential", fixed = FALSE, cps = NULL)

Arguments

lambda_2
Average number of parents for each node in the network (parameter for a Poisson distribution).
q
Number of nodes.
min_phase_length
Minimum segment length.
k_bar
Maximum number of changepoints. If fixed=TRUE, this is equal to the number of changepoints.
l
Length of the time series.
lambda_3
Average number of structure changes between two segments (parameter for a Poisson distribution).
spacing
1 if segments are equally spaced, 0 if they are spaced randomly (subject to the constraints of min_phase_length).
gauss_weights
1 if edge weights in the network are drawn from N(0, 1), 0 if they are fixed to be 1.
same
1 if all segments have the same network structure (no changes), 0 otherwise.
change_method
'sequential' if the changes happen sequentially (i.e. changes at segment i are applied to segment i-1), 'hierarchical' if the changes happen with respect to a hypernetwork (i.e. changes at segment i are applied to segment 0).
fixed
T if the changepoint locations are fixed, F if they should be sampled.
cps
Changepoint locations (if they are fixed).

Value

A list with the following elements:
network
The network, a list of length NumSegs, where each element is a NumNodes by NumNodes matrix.
epsilon
The vector of changepoint locations.
k
The number of changepoint.
changes
The number of changes among segments.

See Also

simulateNetwork

Examples

Run this code

# Generate random network with default parameters
network = generateNetwork()

# Simulate data using generated network
dataset = simulateNetwork(net=network)

# Generate random network with 4 changepoints and 15 nodes, 
# with changepoints distributed over a timeseries of length 50
network = generateNetwork(l=50, q=15, fixed=TRUE, k_bar=4)

# Simulate data of length 50 using generated network
dataset = simulateNetwork(net=network)

Run the code above in your browser using DataLab