simnet: Simulate data from a network

Description Usage Arguments Examples

View source: R/ludwig_functions.R

Description

This function is intended to simulate data from a binary network given a user defined or randomly generated starting state and a vector of coefficients. Two methods of simulating states from the conditional distributions are provided: random updating or sequential updating. A burn-in parameter is provided to allow for running the update process a desired number of iterations before the actual sampling process starts.

Usage

1
simnet(k_sim, coef, n_burnin, n_rep, start_state, order = "random")

Arguments

k_sim

the number of nodes.

coef

a vector containing the coefficients of the network to simulate from. The first parameters in the vector are the thresholds. The remainig parameters are the upper diagonal of a weight matrix in sequential, row-wise order.

n_burnin

the number of burn-in cycles.

n_rep

the desired number of sampled states.

start_state

provide a binary verctor as a starting state. If omitted, a random state will be generated as a starting state.

order

either random (default) for randomly updating the network one node at a time or sequential for sequential updating. With random updating, each new state will be returned. If sequential is used, a state is returned after all k_sim nodes have been updated.

Examples

1
2
3
# Simulates two negatively coupled nodes
# using random updating
simnet(2, c(1,1,-2), 1000, 1000)

ghosoya/ludwig documentation built on Sept. 20, 2020, 3:48 p.m.