if (FALSE) {
### Small network ###
nVar <- 3
nPerson <- 25
nTime <- 25
# Simulate model and data:
Model <- mlVARsim(nPerson, nVar, nTime, beta_sparsity = 0.5)
# Run mlVAR0 (deprecated; see mlVAR() for the current implementation):
Res <- mlVAR0(Model$Data, vars = Model$vars, idvar = Model$idvar)
# Compare true temporal model with significant edges of the estimated model.
# Note that the simulated model is plotted by plot.mlVAR, which uses
# type = "temporal", while plot.mlVAR0 still uses the older type names
# ("fixed", "SD" and "subject"):
layout(t(1:2))
plot(Model, "temporal", title = "True model", layout = "circle", edge.labels = TRUE)
plot(Res, "fixed", title = "Estimated model", layout = "circle", onlySig = TRUE,
alpha = 0.05, edge.labels = TRUE)
# Compare temporal networks of subject 1:
layout(t(1:2))
plot(Model, "temporal", subject = 1, title = "True model", layout = "circle",
edge.labels = TRUE)
plot(Res, "subject", subject = 1, title = "Estimated model", layout = "circle",
edge.labels = TRUE)
}
Run the code above in your browser using DataLab