if (FALSE) {
### Jointly estimate the attachment function and node fitnesses
library("PAFit")
set.seed(1)
# a Bianconi-Barabasi network
# size of initial network = 100
# number of new nodes at each time-step = 100
# Ak = k; inverse variance of distribution of fitness: s = 10
net <- generate_BB(N = 1000 , m = 10 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
#Joint estimation of attachment function Ak and node fitness
result <- joint_estimate(net, net_stats)
summary(result)
# plot the estimated attachment function
plot(result, net_stats)
# true function
true_A <- pmax(result$estimate_result$center_k,1)
lines(result$estimate_result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
#plot distribution of estimated node fitnesses
plot(result, net_stats, plot = "f")
#plot the estimated node fitnesses and true node fitnesses
plot(result, net_stats, true = net$fitness, plot = "true_f")
}
Run the code above in your browser using DataLab