1. Pham, T. and Sheridan, P. and Shimodaira, H. (2015). mcPAFit: Nonparametric Measurement of Preferential Attachment and Fitness from a Single Network Snapshot. Conference on Complex Systems 2015, September 2015, Arizona.
Examples
library(mcPAFit)
N <- 1000 #number of nodes in the network
M <- 500 #number of needed sample
lag <- 1
start <- 100
data <- create_sim_data(N = N, alpha = 1)
write.table(data$random[,1:2], row.names = FALSE,
col.names = FALSE, file = "input.txt")
system.time(mcPAFit(file_name = "input.txt",burn_in = 0, s = 5, skip = 1,
needed_sample = M, G = 20,only_active_node = 1, random = 0))
# plot log posterior
to.read = file("log_pos_network.binary","rb")
log_pos = readBin(to.read, numeric(),n = M);
plot(log_pos,type = "l",xlab = "Iteration", ylab = "Log Posterior",cex.axis = 1.5, cex.lab = 1.5);
########
########
#plot b
to.read = file("b_out_network.binary","rb")
b = readBin(to.read, numeric(),n = M);
used <- seq(start,M,1)
plot(b[used],type = "l", xlab = "Iteration", ylab = "b", cex.lab =2 , cex.axis =2);
acf(b[used])
mean(b[used])