Learn R Programming

lvm4net (version 0.3)

simulateLSM: Simulate from LSM model

Description

Function to simulate networks from the LSM model

Usage

simulateLSM(object, Y = NULL, nsim = 100, seed, directed = NULL)

Arguments

object

object of class 'lsm'

Y

(N x N) binary adjacency matrix

nsim

number of simulations. Default nsim = 100

seed

for simulations

directed

if the network is directed or not. Default directed = NULL

Examples

Run this code
# NOT RUN {
n <- 20
Y <- network(n, directed = FALSE)[,]

modLSM <- lsm(Y, D = 2) 

Ysim <- simulateLSM(modLSM, Y = Y, nsim = 8)
# store EZ, to keep the nodes in the same positions 
# and compare the networks
EZ <- modLSM$lsmEZ
par(mfrow = c(3,3))
plotY(Y, EZ = EZ, main = "Original Data")
for(i in 1:8) plotY(Ysim[[i]], EZ = EZ, main = paste("Simulation" , i))
par(mfrow = c(1,1))
# }

Run the code above in your browser using DataLab