library("IsingSampler")
# Input:
P <- 5 # Number of nodes
nSample <- 250 # Number of samples
# Chain graph:
Graph <- matrix(0, P, P)
for (i in 1:P){
Graph[i,i%%P+1] <- Graph[i%%P+1,i] <- 0.5
}
# Thresholds:
Thresh <- rep(0, P)
# Response options (0,1 or -1,1):
Resp <- c(0L,1L)
# Simulate with metropolis:
Data <- IsingSampler(nSample, Graph, Thresh)
## Not run:
# # Estimate:
# Res <- elasticIsing(Data)
#
# # Optimal graph:
# optimalGraph(Res)
#
# # Plot result:
# plot(Res)
#
# # Cost plots:
# costPlots(Res)
# ## End(Not run)
Run the code above in your browser using DataLab