Type: | Package |
Title: | Generative Mechanism Estimation in Temporal Complex Networks |
Version: | 1.2.10 |
Date: | 2024-03-28 |
Author: | Thong Pham, Paul Sheridan, Hidetoshi Shimodaira |
Maintainer: | Thong Pham <thongphamthe@gmail.com> |
Description: | Statistical methods for estimating preferential attachment and node fitness generative mechanisms in temporal complex networks are provided. Thong Pham et al. (2015) <doi:10.1371/journal.pone.0137796>. Thong Pham et al. (2016) <doi:10.1038/srep32558>. Thong Pham et al. (2020) <doi:10.18637/jss.v092.i03>. Thong Pham et al. (2021) <doi:10.1093/comnet/cnab024>. |
URL: | https://github.com/thongphamthe/PAFit |
BugReports: | https://github.com/thongphamthe/PAFit/issues |
License: | GPL-3 |
Depends: | R(≥ 2.10.0) |
Imports: | Rcpp (≥ 0.11.3) , grDevices, graphics, stats, RColorBrewer, VGAM, MASS, magicaxis, networkDynamic, network, plyr, igraph, mapproj, knitr, methods, ggplot2 |
LinkingTo: | Rcpp |
LazyData: | True |
Encoding: | UTF-8 |
NeedsCompilation: | yes |
Suggests: | R.rsp |
VignetteBuilder: | R.rsp |
Packaged: | 2024-03-27 17:02:13 UTC; thong |
Repository: | CRAN |
Date/Publication: | 2024-03-28 10:30:02 UTC |
Generative Mechanism Estimation in Temporal Complex Networks
Description
A package for estimating preferential attachment and node fitness generative mechanisms in temporal complex networks. References: Thong Pham et al. (2015) <10.1371/journal.pone.0137796>, Thong Pham et al. (2016) <doi:10.1038/srep32558>, Thong Pham et al. (2020) <doi:10.18637/jss.v092.i03>, Thong Pham et al. (2021) <doi:10.1093/comnet/cnab024>.
Details
Package: | PAFit |
Type: | Package |
Version: | 1.2.10 |
Authors: | Thong Pham, Paul Sheridan, Hidetoshi Shimodaira |
Maintainer: | Thong Pham thongphamthe@gmail.com |
Date: | 2024-03-28 |
License: | GPL-3 |
The PAFit package provides a comprehensive framework to deal with growth mechanisms of temporal complex networks. In particular, it implements functions to simulate various temporal network models, gather essential network statistics from raw input data, and use these summarized statistics in the estimation of the attachment function A_k
and node fitnesses \eta_i
. The heavy computational parts of the package are implemented in C++
through the use of the Rcpp package. Furthermore, users with a multi-core machine can enjoy a hassle-free speed up through OpenMP parallelization mechanisms implemented in the code. Apart from the main functions, the package also includes a real-world collaboration network dataset between scientists in the field of complex networks (coauthor.net
). The main package functionalities are as follows.
Firstly, most well-known temporal network models based on the preferential attachment (PA) and node fitness mechanisms can be easily simulated using the package. PAFit implements generate_BA
for the Barabási-Albert (BA) model, generate_ER
for the growing Erdős–Rényi (ER) model, generate_BB
for the Bianconi-Barabási (BB) model and generate_fit_only
for the Caldarelli model. These functions have many customizable options, for example the number of new edges at each time-step are tunable stochastic variables. They are actually wrappers of the more powerful generate_net
function, which simulates networks with more flexible attachment function and node fitness settings.
Secondly, the function get_statistics
efficiently collects all temporal network summary statistics. We note that get_statistics
automatically handles both directed and undirected networks. It returns a list containing many statistics that can be used to characterize the network growth process. Notable fields are m_tk
containing the number of new edges that connect to a degree-k
node at time-step t
, and node_degree
containing the degree sequence, i.e., the degree of each node at each time-step.
The most important functionality of the package is estimating the attachment function and node fitnesses of a temporal network. This is implemented through various methods. There are three usages: estimation of the attachment function in isolation, estimation of the node fitnesses in isolation, and the joint estimation of the attachment function and node fitnesses.
The functions for estimating the attachment function in isolation are:
Jeong
for Jeong's method (Ref. 1),Newman
for Newman's method (Ref. 2), andonly_A_estimate
for the PAFit method (Ref. 3).For estimation of node fitnesses in isolation,
only_F_estimate
implements a variant of the PAFit method (Ref. 4).For the joint estimation of the attachment function and node fitnesses, we implement the full version of the PAFit method in
joint_estimate
(Ref. 4).For estimating the nonparametric attachment function from a single snapshot, use
PAFit_oneshot
(Ref. 6).
Excluding PAFit_oneshot
, the input of the remaining functions is the output object of the function get_statistics
. The output object of these functions contains the estimation results as well as some additional information pertaining to the estimation process. The estimated attachment function and/or node fitnesses can be plotted by using the plot
command directly on this output object. This will visualize not only the estimated results but also the remaining uncertainties when possible.
Author(s)
Thong Pham thongphamthe@gmail.com, Paul Sheridan, and Hidetoshi Shimodaira.
References
1. Jeong, H., Néda, Z. & Barabási, A. (2003). Measuring Preferential Attachment in Evolving Networks. Europhysics Letters 61(61):567-572. (doi:10.1209/epl/i2003-00166-9).
2. Newman, M. (2001). Clustering and Preferential Attachment in Growing Networks. Physical Review E 64(2):025102. (doi:10.1103/PhysRevE.64.025102).
3. Pham, T., Sheridan, P. & Shimodaira, H. (2015). PAFit: A Statistical Method for Measuring Preferential Attachment in Temporal Complex Networks. PLOS ONE 10(9):e0137796. (doi:10.1371/journal.pone.0137796).
4. Pham, T., Sheridan, P. & Shimodaira, H. (2016). Joint Estimation of Preferential Attachment and Node Fitness in Growing Complex Networks. Scientific Reports 6, Article number: 32558. (doi:10.1038/srep32558).
5. Pham, T., Sheridan, P. & Shimodaira, H. (2020). PAFit: An R Package for the Non-Parametric Estimation of Preferential Attachment and Node Fitness in Temporal Complex Networks. Journal of Statistical Software 92 (3). (doi:10.18637/jss.v092.i03)
6. Pham, T., Sheridan, P. & Shimodaira, H. (2021). Non-parametric estimation of the preferential attachment function from one network snapshot. Journal of Complex Networks 9(5): cnab024. (doi:10.1093/comnet/cnab024).
See Also
See the accompanying vignette for a tutorial.
See also the GitHub page.
Examples
## Not run:
### 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")
## End(Not run)
A collaboration network between authors of papers in the field of complex networks with article time-stamps
Description
The dataset is collaboration network of authors of network science articles with article time-stamps. An edge between two authors represents an article in common. Time stamps denote article publication dates. The network without time-stamps was compiled by Mark Newman in May 2006 from the bibliographies of two review articles on networks, M. E. J. Newman, SIAM Review 45, 167-256 (2003) and S. Boccaletti et al., Physics Reports 424, 175-308 (2006), with a few additional references added by hand. Paul Sheridan independently supplemented the network with time-stamps and some basic metadata in June 2015. The network is undirected with monthly resolution, and contains no duplicated edges. coauthor.net
contains the network. coauthor.truetime
contains the real times of processed time-stamps. Finally coauthor.author_id
contains author names.
Reference: M. E. J. Newman, Finding community structure in networks using the eigenvectors of matrices, Preprint physics/0605087 (2006).
Usage
data(ComplexNetCoauthor)
Format
coauthor.net
is a matrix with 2849 rows and 3 columns. Each row is an edge with the format (author id 1, author id 2, time_stamp). coauthor.truetime
is a two-column matrix whose each row is (time_stamp, real time). coauthor.author_id
is a two-column matrix whose each row is (author id, author name).
Source
https://www.paulsheridan.net/files/collabnet.zip
Jeong's method for estimating the preferential attachment function
Description
This function estimates the preferential attachment function by Jeong's method.
Usage
Jeong(net_object ,
net_stat = get_statistics(net_object) ,
T_0_start = 0 ,
T_0_end = round(net_stat$T * 0.75) ,
T_1_start = T_0_end + 1 ,
T_1_end = net_stat$T ,
interpolate = FALSE)
Arguments
net_object |
an object of class |
net_stat |
An object of class |
T_0_start |
Positive integer. The starting time-step of the |
T_0_end |
Positive integer. The ending time-step of |
T_1_start |
Positive integer. The starting time-step of the |
T_1_end |
Positive integer. The ending time-step of |
interpolate |
Logical. If |
Value
Outputs an PA_result
object which contains the estimated attachment function. In particular, it contains the following field:
-
k
andA
: a degree vector and the estimated PA function. -
center_k
andtheta
: when we perform binning, these are the centers of the bins and the estimated PA values for those bins. -
g
: the number of bins used. -
alpha
andci
:alpha
is the estimated attachment exponenet\alpha
(when assumeA_k = k^\alpha
), whileci
is the confidence interval. -
loglinear_fit
: this is the fitting result when we estimate\alpha
.
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Jeong, H., Néda, Z. & Barabási, A. . Measuring preferential attachment in evolving networks. Europhysics Letters. 2003;61(61):567–572. (doi:10.1209/epl/i2003-00166-9).
See Also
See get_statistics
for how to create summerized statistics needed in this function.
See Newman
and only_A_estimate
for other methods to estimate the attachment function in isolation.
Examples
library("PAFit")
net <- generate_net(N = 1000 , m = 1 , mode = 1 , alpha = 1 , s = 0)
net_stats <- get_statistics(net)
result <- Jeong(net, net_stats)
# true function
true_A <- result$center_k
#plot the estimated attachment function
plot(result , net_stats)
lines(result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
Corrected Newman's method for estimating the preferential attachment function
Description
This function implements a correction proposed in [1] of the original Newman's method in [2] to estimate the preferential attachment function.
Usage
Newman(net_object ,
net_stat = get_statistics(net_object),
start = 1 ,
interpolate = FALSE)
Arguments
net_object |
an object of class |
net_stat |
An object of class |
start |
Positive integer. The starting time from which the method is applied. Default value is |
interpolate |
Logical. If |
Value
Outputs an PA_result
object which contains the estimated attachment function. In particular, it contains the following field:
-
k
andA
: a degree vector and the estimated PA function. -
center_k
andtheta
: when we perform binning, these are the centers of the bins and the estimated PA values for those bins. -
g
: the number of bins used. -
alpha
andci
:alpha
is the estimated attachment exponenet\alpha
(when assumeA_k = k^\alpha
), whileci
is the mean plus/minus two-standard-deviation interval. -
loglinear_fit
: this is the fitting result when we estimate\alpha
.
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Pham, T., Sheridan, P. & Shimodaira, H. (2015). PAFit: A Statistical Method for Measuring Preferential Attachment in Temporal Complex Networks. PLoS ONE 10(9): e0137796. (doi:10.1371/journal.pone.0137796).
2. Newman, M.. Clustering and preferential attachment in growing networks. Physical Review E. 2001;64(2):025102 (doi:10.1103/PhysRevE.64.025102).
See Also
See get_statistics
for how to create summerized statistics needed in this function.
See Jeong
, only_A_estimate
for other methods to estimate the attachment function in isolation.
Examples
library("PAFit")
net <- generate_net(N = 1000 , m = 1 , mode = 1 , alpha = 1 , s = 0)
net_stats <- get_statistics(net)
result <- Newman(net, net_stats)
summary(result)
# true function
true_A <- result$center_k
#plot the estimated attachment function
plot(result , net_stats)
lines(result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
Estimating the nonparametric preferential attachment function from one single snapshot.
Description
This function estimates the attachment function A_k
from one snapshot.
Usage
PAFit_oneshot(net_object,
M = 10,
S = 5,
loop = 5,
G = 1000)
Arguments
net_object |
an object of class |
M |
Integer. Number of simulated networks in each iteration. Default is |
S |
Integer. Number of iterations inside each loop. Default is |
loop |
Integer. Number of loops of the whole process. Default is |
G |
Integer. Number of bins for the PA function. Default is |
Value
Outputs a PAFit_result
object.
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Pham, T., Sheridan, P. & Shimodaira, H. (2021). Non-parametric estimation of the preferential attachment function from one network snapshot. Journal of Complex Networks 9(5): cnab024. (doi:10.1093/comnet/cnab024).
Examples
## Not run:
library("PAFit")
net_1 <- generate_BA(N = 10000, alpha = 1) # true attachment exponent = 1.0
result_1 <- PAFit_oneshot(net_1)
print(result_1)
net_2 <- generate_BA(N = 10000, alpha = 0.5) # true attachment exponent = 0.5
result_2 <- PAFit_oneshot(net_2)
print(result_2)
## End(Not run)
Converting an edgelist matrix to a PAFit_net object
Description
This function converts a graph stored in an edgelist matrix format to a PAFit_net
object.
Usage
as.PAFit_net(graph, type = "directed", PA = NULL, fitness = NULL)
Arguments
graph |
An edgelist matrix. Each row is assumed to be of the form ( To register a new node
|
type |
String. Indicates whether the network is |
PA |
Numeric vector. Contains the PA function. Default value is |
fitness |
Numeric vector. Contains node fitnesses. Default value is |
Value
An object of class PAFit_net
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
as.PAFit_net(net$graph)
Convert an igraph object to a PAFit_net object
Description
This function converts an igraph
object (of package igraph) to a PAFit_net
object.
Usage
from_igraph(net)
Arguments
net |
An object of class |
Value
The function returns a PAFit_net
object.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
igraph_graph <- to_igraph(net)
back <- from_igraph(igraph_graph)
Convert a networkDynamic object to a PAFit_net object
Description
This function converts a networkDynamic
object (of package networkDynamic) to a PAFit_net
object.
Usage
from_networkDynamic(net)
Arguments
net |
An object of class |
Value
The function returns a PAFit_net
object.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
nD_graph <- to_networkDynamic(net)
back <- from_networkDynamic(nD_graph)
Simulating networks from the generalized Barabasi-Albert model
Description
This function generates networks from the generalized Barabási-Albert model. In this model, the preferential attachment function is power-law, i.e. A_k = k^\alpha
, and node fitnesses are all equal to 1
. It is a wrapper of the more powerful function generate_net
.
Usage
generate_BA(N = 1000,
num_seed = 2 ,
multiple_node = 1 ,
m = 1 ,
alpha = 1)
Arguments
N |
Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is |
num_seed |
Integer. The number of nodes of the seed graph (the initial state of the network). The seed graph is a cycle. Default value is |
multiple_node |
Positive integer. The number of new nodes at each time-step. Default value is |
m |
Positive integer. The number of edges of each new node. Default value is |
alpha |
Numeric. This is the attachment exponent in the attachment function |
Value
The output is a PAFit_net
object, which is a List contains the following four fields:
graph |
a three-column matrix, where each row contains information of one edge, in the form of |
type |
a string indicates whether the network is |
PA |
a numeric vector contains the true PA function. |
fitness |
fitness values of nodes in the network. The fitnesses are all equal to |
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Albert, R. & Barabási, A. (1999). Emergence of scaling in random networks. Science, 286,509–512 (https://www.science.org/doi/10.1126/science.286.5439.509).
See Also
For subsequent estimation procedures, see get_statistics
.
For other functions to generate networks, see generate_net
, generate_ER
, generate_BB
and generate_fit_only
.
Examples
library("PAFit")
# generate a network from the BA model with alpha = 1, N = 100, m = 1
net <- generate_BA(N = 100)
str(net)
plot(net)
Simulating networks from the Bianconi-Barabasi model
Description
This function generates networks from the Bianconi-Barabási model. It is a ‘preferential attachment with fitness’ model. In this model, the preferential attachment function is linear, i.e. A_k = k
, and node fitnesses are sampled from some probability distribution.
Usage
generate_BB(N = 1000 ,
num_seed = 2 ,
multiple_node = 1 ,
m = 1 ,
mode_f = "gamma",
s = 10 )
Arguments
The parameters can be divided into two groups.
The first group specifies basic properties of the network:
N |
Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is |
num_seed |
Integer. The number of nodes of the seed graph (the initial state of the network). The seed graph is a cycle. Default value is |
multiple_node |
Positive integer. The number of new nodes at each time-step. Default value is |
m |
Positive integer. The number of edges of each new node. Default value is |
The final group of parameters specifies the distribution from which node fitnesses are generated:
mode_f |
String. Possible values: |
s |
Non-negative numeric. The inverse variance parameter. The mean of the distribution is kept at |
Value
The output is a PAFit_net
object, which is a List contains the following four fields:
graph |
a three-column matrix, where each row contains information of one edge, in the form of |
type |
a string indicates whether the network is |
PA |
a numeric vector contains the true PA function. |
fitness |
fitness values of nodes in the network. The name of each value is the ID of the node. |
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Bianconni, G. & Barabási, A. (2001). Competition and multiscaling in evolving networks. Europhys. Lett., 54, 436 (doi:10.1209/epl/i2001-00260-6).
See Also
For subsequent estimation procedures, see get_statistics
.
For other functions to generate networks, see generate_net
, generate_BA
, generate_ER
and generate_fit_only
.
Examples
library("PAFit")
# generate a network from the BB model with alpha = 1, N = 100, m = 1
# The inverse variance of the Gamma distribution of node fitnesses is s = 10
net <- generate_BB(N = 100,m = 1,mode = 1, s = 10)
str(net)
plot(net)
Simulating networks from the Erdos-Renyi model
Description
This function generates networks from the Erdős–Rényi model. In this model, the preferential attachment function is a constant function, i.e. A_k = 1
, and node fitnesses are all equal to 1
. It is a wrapper of the more powerful function generate_net
.
Usage
generate_ER(N = 1000,
num_seed = 2 ,
multiple_node = 1 ,
m = 1)
Arguments
N |
Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is |
num_seed |
Integer. The number of nodes of the seed graph (the initial state of the network). The seed graph is a cycle. Default value is |
multiple_node |
Positive integer. The number of new nodes at each time-step. Default value is |
m |
Positive integer. The number of edges of each new node. Default value is |
Value
The output is a PAFit_net
object, which is a List contains the following four fields:
graph |
a three-column matrix, where each row contains information of one edge, in the form of |
type |
a string indicates whether the network is |
PA |
a numeric vector contains the true PA function. |
fitness |
fitness values of nodes in the network. The fitnesses are all equal to |
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Erdös P. & Rényi A.. On random graphs. Publicationes Mathematicae Debrecen. 1959;6:290–297 (https://snap.stanford.edu/class/cs224w-readings/erdos59random.pdf).
See Also
For subsequent estimation procedures, see get_statistics
.
For other functions to generate networks, see generate_net
, generate_BA
, generate_BB
and generate_fit_only
.
Examples
library("PAFit")
# generate a network from the ER model with N = 1000 nodes
net <- generate_ER(N = 1000)
str(net)
plot(net)
Simulating networks from the Caldarelli model
Description
This function generates networks from the Caldarelli model. In this model, the preferential attachment function is constant, i.e. A_k = 1
, and node fitnesses are sampled from some probability distribution.
Usage
generate_fit_only(N = 1000 ,
num_seed = 2 ,
multiple_node = 1 ,
m = 1 ,
mode_f = "gamma",
s = 10 )
Arguments
The parameters can be divided into two groups.
The first group specifies basic properties of the network:
N |
Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is |
num_seed |
Integer. The number of nodes of the seed graph (the initial state of the network). The seed graph is a cycle. Default value is |
multiple_node |
Positive integer. The number of new nodes at each time-step. Default value is |
m |
Positive integer. The number of edges of each new node. Default value is |
The final group of parameters specifies the distribution from which node fitnesses are generated:
mode_f |
String. Possible values: |
s |
Non-negative numeric. The inverse variance parameter. The mean of the distribution is kept at |
Value
The output is a PAFit_net
object, which is a List contains the following four fields:
graph |
a three-column matrix, where each row contains information of one edge, in the form of |
type |
a string indicates whether the network is |
PA |
a numeric vector contains the true PA function. |
fitness |
fitness values of nodes in the network. The name of each value is the ID of the node. |
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Caldarelli, G., Capocci, A. , De Los Rios, P. & Muñoz, M.A. (2002). Scale-Free Networks from Varying Vertex Intrinsic Fitness. Phys. Rev. Lett., 89, 258702 (doi:10.1103/PhysRevLett.89.258702).
See Also
For subsequent estimation procedures, see get_statistics
.
For other functions to generate networks, see generate_net
, generate_BA
, generate_ER
and generate_BB
.
Examples
library("PAFit")
# generate a network from the Caldarelli model with alpha = 1, N = 100, m = 1
# the inverse variance of distribution of node fitnesses is s = 10
net <- generate_fit_only(N = 100,m = 1,mode = 1, s = 10)
str(net)
plot(net)
Simulating networks from preferential attachment and fitness mechanisms
Description
This function generates networks from the General Temporal model, a generative temporal network model that includes many well-known models such as the Erdős–Rényi model, the Barabási-Albert model or the Bianconi-Barabási model as special cases. This function also includes some flexible mechanisms to vary the number of new nodes and new edges at each time-step in order to generate realistic networks.
Usage
generate_net (N = 1000 ,
num_seed = 2 ,
multiple_node = 1 ,
specific_start = NULL ,
m = 1 ,
prob_m = FALSE ,
increase = FALSE ,
log = FALSE ,
no_new_node_step = 0 ,
m_no_new_node_step = m ,
custom_PA = NULL ,
mode = 1 ,
alpha = 1 ,
beta = 2 ,
sat_at = 100 ,
offset = 1 ,
mode_f = "gamma",
s = 10 )
Arguments
The parameters can be divided into four groups.
The first group specifies basic properties of the network:
N |
Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is |
num_seed |
Integer. The number of nodes of the seed graph (the initial state of the network). The seed graph is a cycle. Default value is |
multiple_node |
Positive integer. The number of new nodes at each time-step. Default value is |
specific_start |
Positive Integer. If |
The second group specifies the number of new edges at each time-step:
m |
Positive integer. The number of edges of each new node. Default value is |
prob_m |
Logical. Indicates whether we fix the number of edges of each new node as a constant, or let it follows a Poisson distribution. If |
increase |
Logical. Indicates whether we increase the mean of the Poisson distribution over time. If |
log |
Logical. Indicates how to increase the mean of the Poisson distribution. If |
no_new_node_step |
Non-negative integer. The number of time-steps in which no new node is added, while new edges are added between existing nodes. Default value is |
m_no_new_node_step |
Positive integer. The number of new edges in the no-new-node steps. Default value is equal to |
The third group of parameters specifies the preferential attachment function:
custom_PA |
Numeric vector. This is the user-input PA function: |
mode |
Integer. Indicates the parametric attachment function to be used in generating the network. If |
alpha |
Numeric. If |
beta |
Numeric. This is the beta in the attachment function |
sat_at |
Integer. This is the saturation position |
offset |
Numeric. The attachment value of degree |
The final group of parameters specifies the distribution from which node fitnesses are generated:
mode_f |
String. Possible values: |
s |
Non-negative numeric. The inverse variance parameter. The mean of the distribution is kept at |
Value
The output is a PAFit_net
object, which is a List contains the following four fields:
graph |
a three-column matrix, where each row contains information of one edge, in the form of |
type |
a string indicates whether the network is |
PA |
a numeric vector contains the true PA function. |
fitness |
fitness values of nodes in the network. The name of each value is the ID of the node. |
Author(s)
Thong Pham thongphamthe@gmail.com
See Also
For subsequent estimation procedures, see get_statistics
.
For simpler functions to generate networks from well-known models, see generate_BA
, generate_ER
, generate_BB
and generate_fit_only
.
Examples
library("PAFit")
#Generate a network from the original BA model with alpha = 1, N = 100, m = 1
net <- generate_net(N = 100,m = 1,mode = 1, alpha = 1, s = 0)
str(net)
plot(net)
Generating simulated data from a fitted model
Description
This function generates simulated networks from a fitted model and performs estimations on these simulated networks with the same setting used in the original estimation. Each simulated network is generated using parameters of the fitted model, while keeping other aspects of the growth process as faithfully as possible to the original observed network.
Usage
generate_simulated_data_from_estimated_model(net_object, net_stat, result, M = 5)
Arguments
net_object |
an object of class |
net_stat |
An object of class |
result |
An object of class |
M |
integer. The number of simulated networks. Default value is |
Value
Outputs a Simulated_Data_From_Fitted_Model
object, which is a list containing the following fields:
-
graph_list
: a list containingM
simulated graphs. -
stats_list
: a list containingM
objects of classPAFit_data
, which are the results of applyingget_statistics
on the simulated graphs. -
result_list
: a list containingM
objects of classFull_PAFit_result
, which are the results of applyingjoint_estimate
on the simulated graphs.
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Pham, T., Sheridan, P. & Shimodaira, H. (2015). PAFit: A Statistical Method for Measuring Preferential Attachment in Temporal Complex Networks. PLoS ONE 10(9): e0137796. (doi:10.1371/journal.pone.0137796).
2. Pham, T., Sheridan, P. & Shimodaira, H. (2016). Joint Estimation of Preferential Attachment and Node Fitness in Growing Complex Networks. Scientific Reports 6, Article number: 32558. (doi:10.1038/srep32558).
3. Pham, T., Sheridan, P. & Shimodaira, H. (2020). PAFit: An R Package for the Non-Parametric Estimation of Preferential Attachment and Node Fitness in Temporal Complex Networks. Journal of Statistical Software 92 (3). (doi:10.18637/jss.v092.i03).
4. Inoue, M., Pham, T. & Shimodaira, H. (2020). Joint Estimation of Non-parametric Transitivity and Preferential Attachment Functions in Scientific Co-authorship Networks. Journal of Informetrics 14(3). (doi:10.1016/j.joi.2020.101042).
See Also
get_statistics
, joint_estimate
, plot_contribution
Examples
## Not run:
library("PAFit")
net_object <- generate_net(N = 500, m = 10, s = 10, alpha = 0.5)
net_stat <- get_statistics(net_object)
result <- joint_estimate(net_object, net_stat)
simulated_data <- generate_simulated_data_from_estimated_model(net_object, net_stat, result)
plot_contribution(simulated_data, result, which_plot = "PA")
plot_contribution(simulated_data, result, which_plot = "fit")
## End(Not run)
Getting summarized statistics from input data
Description
The function summarizes input data into sufficient statistics for estimating the attachment function and node fitness, together with additional information about the data, such as total number of nodes, number of time-steps, maximum degree, and the final degree of the network, etc. . It also provides mechanisms to automatically deal with very large datasets by binning the degree, setting a degree threshold, or grouping time-steps.
Usage
get_statistics(net_object, only_PA = FALSE ,
only_true_deg_matrix = FALSE ,
binning = TRUE , g = 50 ,
deg_threshold = 0 ,
compress_mode = 0 , compress_ratio = 0.5 ,
custom_time = NULL)
Arguments
The parameters can be divided into four groups. The first group specifies input data and how the data will be summarized:
net_object |
An object of class |
only_PA |
Logical. Indicates whether only the statistics for estimating |
only_true_deg_matrix |
Logical. Return only the true degree matrix (without binning), and no other statistics is returned. The result cannot be used in |
Second group of parameters specifies how to bin the degrees:
binning |
Logical. Indicates whether the degree should be binned together. Default value is |
g |
Positive integer. Number of bins. Should be at least |
Third group contains a single parameter specifying how to reduce the number of node fitnesses:
deg_threshold |
Integer. We only estimate the fitnesses of nodes whose number of new edges acquired is at least |
Last group of parameters specifies how to group the time-stamps:
compress_mode |
Integer. Indicates whether the timeline should be compressed. The value of CompressMode:
Default value is |
compress_ratio |
Numeric. Indicates how much we should compress if CompressMode is |
custom_time |
Vector. Custom time stamps. This vector is a subset of the vector that contains all time-stamps. Only effective if |
Value
An object of class PAFit_data
, which is a list. Some important fields are:
offset_tk |
A matrix where the |
n_tk |
A matrix where the |
m_tk |
A matrix where the |
sum_m_k |
A vector where the |
node_degree |
A matrix recording the degree of all nodes (that satisfy |
m_t |
A vector where the |
z_j |
A vector where the |
N |
Numeric. The number of nodes in the network |
T |
Numeric. The number of time steps |
deg_max |
Numeric. The maximum degree in the final network |
node_id |
A vector contains the id of all nodes |
final_deg |
A vector contains the final degree of all nodes (including those that do not satisfy the |
deg_thresh |
Integer. The specified degree threshold. |
f_position |
Numeric vector. The index in the |
start_deg |
Integer. The specified degree at which we start binning. |
begin_deg |
Numeric vector contains the beginning degree of each bin |
end_deg |
Numeric vector contains the ending degree of each bin |
interval_length |
Numeric vector contains the length of each bin. |
binning |
Logical. Indicates whether binning was applied or not. |
g |
Integer. Number of bins |
time_compress_mode |
Integer. The mode of time compression. |
t_compressed |
Integer. The number of time stamps actually used |
compressed_unique_time |
The time stamps that are actually used |
compress_ratio |
Numeric. |
custom_time |
Vector. The time stamps specified by user. |
Author(s)
Thong Pham thongphamthe@gmail.com
See Also
For creating the needed input for this function (a PAFit_net
object), see as.PAFit_net
, from_igraph
, from_networkDynamic
, and graph_from_file
.
For the next step, see Newman
, Jeong
or only_A_estimate
for estimating the attachment function in isolation, only_F_estimate
for estimating node fitnesses in isolation, and joint_estimate
for joint estimation of the attachment function and node fitnesses.
Examples
library("PAFit")
net <- generate_BA(N = 100 , m = 1)
net_stats <- get_statistics(net)
summary(net_stats)
Read file to a PAFit_net object
Description
This function reads an input file to a PAFit_net
object. Accepted formats are the edgelist format or the gml
format.
Usage
graph_from_file(file_name, format = "edgelist", type = "directed")
Arguments
file_name |
A string indicates the file name. |
format |
String. Possible values are If To register a new node
If |
type |
String. Indicates whether the network is |
Value
An object of class PAFit_net
containing the network.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
#graph_to_file(net, file_name = "test.gml", format = "gml")
#reread <- graph_from_file(file_name = "test.gml", format = "gml")
Write the graph in a PAFit_net object to file
Description
This function writes a graph in a PAFit_net
object to an output file. Accepted file formats are the edgelist format or the gml
format.
Usage
graph_to_file(net_object, file_name, format = "edgelist")
Arguments
net_object |
An object of class |
file_name |
A string indicates the file name. |
format |
String. Possible values are If If |
Value
The function writes directly to the output file.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
#graph_to_file(net, file_name = "test.gml", format = "gml")
Joint inference of attachment function and node fitnesses
Description
This function jointly estimates the attachment function A_k
and node fitnesses \eta_i
. It first performs a cross-validation to select the optimal parameters r
and s
, then estimates A_k
and eta_i
using that optimal pair with the full data (Ref. 2).
Usage
joint_estimate(net_object ,
net_stat = get_statistics(net_object),
p = 0.75 ,
stop_cond = 10^-8 ,
mode_reg_A = 0 ,
...)
Arguments
net_object |
an object of class |
net_stat |
An object of class |
p |
Numeric. This is the ratio of the number of new edges in the learning data to that of the full data. The data is then divided into two parts: learning data and testing data based on |
stop_cond |
Numeric. The iterative algorithm stops when |
mode_reg_A |
Binary. Indicates which regularization term is used for
|
... |
Other arguments to pass to the underlying algorithm. |
Value
Outputs a Full_PAFit_result
object, which is a list containing the following fields:
-
cv_data
: aCV_Data
object which contains the cross-validation data. This is the testing data. -
cv_result
: aCV_Result
object which contains the cross-validation result. Normally the user does not need to pay attention to this data. -
estimate_result
: this is aPAFit_result
object which contains the estimated attachment functionA_k
, the estimated fitnesses\eta_i
and their confidence intervals. In particular, the important fields are:-
ratio
: this is the selected value for the hyper-parameterr
. -
shape
: this is the selected value for the hyper-parameters
. -
k
andA
: a degree vector and the estimated PA function. -
var_A
: the estimated variance ofA
. -
var_logA
: the estimated variance oflog A
. -
upper_A
: the upper value of the interval of two standard deviations aroundA
. -
lower_A
: the lower value of the interval of two standard deviations aroundA
. -
center_k
andtheta
: when we perform binning, these are the centers of the bins and the estimated PA values for those bins.theta
is similar toA
but with duplicated values removed. -
var_bin
: the variance oftheta
. Same asvar_A
but with duplicated values removed. -
upper_bin
: the upper value of the interval of two standard deviations aroundtheta
. Same asupper_A
but with duplicated values removed. -
lower_bin
: the lower value of the interval of two standard deviations aroundtheta
. Same aslower_A
but with duplicated values removed. -
g
: the number of bins used. -
alpha
andci
:alpha
is the estimated attachment exponent\alpha
(when assumeA_k = k^\alpha
), whileci
is the confidence interval. -
loglinear_fit
: this is the fitting result when we estimate\alpha
. -
f
: the estimated node fitnesses. -
var_f
: the estimated variance of\eta_i
. -
upper_f
: the estimated upper value of the interval of two standard deviations around\eta_i
. -
lower_f
: the estimated lower value of the interval of two standard deviations around\eta_i
. -
objective_value
: values of the objective function over iterations in the final run with the full data. -
diverge_zero
: logical value indicates whether the algorithm diverged in the final run with the full data.
-
-
contribution
: a list containing an estimate of the contributions of preferential attachment and fitness mechanisms in the growth process of the network. The calculation adapts a quantification method proposed in Section 3 of Ref. 4, which is for preferential attachment and transitivity, to preferential attachment and fitness.-
PA_contribution
: an array containing the contributions of preferential attachment at each time-step -
fit_contribution
: an array containing the contributions of the fitness mechanism at each time-step -
mean_PA_contrib
: the average contribution of preferential attachment through the whole growth process -
mean_fit_contrib
: the average contribution of the fitness mechanism through the whole growth process
-
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Pham, T., Sheridan, P. & Shimodaira, H. (2015). PAFit: A Statistical Method for Measuring Preferential Attachment in Temporal Complex Networks. PLoS ONE 10(9): e0137796. (doi:10.1371/journal.pone.0137796).
2. Pham, T., Sheridan, P. & Shimodaira, H. (2016). Joint Estimation of Preferential Attachment and Node Fitness in Growing Complex Networks. Scientific Reports 6, Article number: 32558. (doi:10.1038/srep32558).
3. Pham, T., Sheridan, P. & Shimodaira, H. (2020). PAFit: An R Package for the Non-Parametric Estimation of Preferential Attachment and Node Fitness in Temporal Complex Networks. Journal of Statistical Software 92 (3). (doi:10.18637/jss.v092.i03).
4. Inoue, M., Pham, T. & Shimodaira, H. (2020). Joint Estimation of Non-parametric Transitivity and Preferential Attachment Functions in Scientific Co-authorship Networks. Journal of Informetrics 14(3). (doi:10.1016/j.joi.2020.101042).
See Also
See get_statistics
for how to create summarized statistics needed in this function.
See Jeong
, Newman
and only_A_estimate
for functions to estimate the attachment function in isolation.
See only_F_estimate
for a function to estimate node fitnesses in isolation.
Examples
## Not run:
library("PAFit")
#### Example 1: a linear preferential attachment kernel, i.e., A_k = k ############
set.seed(1)
# size of initial network = 100
# number of new nodes at each time-step = 100
# Ak = k; inverse variance of the distribution of node fitnesse = 5
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 5)
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
true_A <- pmax(result$estimate_result$center_k,1) # true function
plot(result , net_stats, max_A = max(true_A,result$estimate_result$theta))
lines(result$estimate_result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
# plot the estimated node fitnesses and true node fitnesses
plot(result, net_stats, true = net$fitness, plot = "true_f")
#############################################################################
#### Example 2: a non-log-linear preferential attachment kernel ############
set.seed(1)
# size of initial network = 100
# number of new nodes at each time-step = 100
# A_k = alpha* log (max(k,1))^beta + 1, with alpha = 2, and beta = 2
# inverse variance of the distribution of node fitnesse = 10
net <- generate_net(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10 , mode = 3, alpha = 2, beta = 2)
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
true_A <- 2 * log(pmax(result$estimate_result$center_k,1))^2 + 1 # true function
plot(result , net_stats, max_A = max(true_A,result$estimate_result$theta))
lines(result$estimate_result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
# plot the estimated node fitnesses and true node fitnesses
plot(result, net_stats, true = net$fitness, plot = "true_f")
#############################################################################
#### Example 3: another non-log-linear preferential attachment kernel ############
set.seed(1)
# size of initial network = 100
# number of new nodes at each time-step = 100
# A_k = min(max(k,1),sat_at)^alpha, with alpha = 1, and sat_at = 100
# inverse variance of the distribution of node fitnesse = 10
net <- generate_net(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10 , mode = 2, alpha = 1, sat_at = 100)
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
true_A <- pmin(pmax(result$estimate_result$center_k,1),100)^1 # true function
plot(result , net_stats, max_A = max(true_A,result$estimate_result$theta))
lines(result$estimate_result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
# plot the estimated node fitnesses and true node fitnesses
plot(result, net_stats, true = net$fitness, plot = "true_f")
## End(Not run)
Estimating the attachment function in isolation by PAFit method
Description
This function estimates the attachment function A_k
by PAFit method. The method has a hyper-parameter r
. It first performs a cross-validation step to select the optimal parameter r
for the regularization of A_k
, then uses that r
to estimate the attachment function with the full data.
Usage
only_A_estimate(net_object ,
net_stat = get_statistics(net_object),
p = 0.75 ,
stop_cond = 10^-8 ,
mode_reg_A = 0 ,
MLE = FALSE ,
...)
Arguments
net_object |
an object of class |
net_stat |
An object of class |
p |
Numeric. This is the ratio of the number of new edges in the learning data to that of the full data. The data is then divided into two parts: learning data and testing data based on |
stop_cond |
Numeric. The iterative algorithm stops when |
mode_reg_A |
Binary. Indicates which regularization term is used for
|
MLE |
Logical. If |
... |
Other arguments to pass to the underlying algorithm. |
Value
Outputs a Full_PAFit_result
object, which is a list containing the following fields:
-
cv_data
: aCV_Data
object which contains the cross-validation data. This is the final Normally the user does not need to pay attention to this data.NULL
ifMLE = TRUE
. -
cv_result
: aCV_Result
object which contains the cross-validation result. Normally the user does not need to pay attention to this data.NULL
ifMLE = TRUE
. -
estimate_result
: this is aPAFit_result
object which contains the estimated PA function and its confidence interval. It also includes the estimated attachment exponenent\alpha
(assuming the modelA_k = k^\alpha
) in the fieldalpha
, and the confidence interval of\alpha
(in the fieldci
) when possible. In particular, the important fields are:-
ratio
: this is the selected value for the hyper-parameterr
. -
k
andA
: a degree vector and the estimated PA function. -
var_A
: the estimated variance ofA
. -
var_logA
: the estimated variance oflog A
. -
upper_A
: the upper value of the interval of two standard deviations aroundA
. -
lower_A
: the lower value of the interval of two standard deviations aroundA
. -
center_k
andtheta
: when we perform binning, these are the centers of the bins and the estimated PA values for those bins.theta
is similar toA
but with duplicated values removed. -
var_bin
: the variance oftheta
. Same asvar_A
but with duplicated values removed. -
upper_bin
: the upper value of the interval of two standard deviations aroundtheta
. Same asupper_A
but with duplicated values removed. -
lower_lower
: the lower value of the interval of two standard deviations aroundtheta
. Same aslower_A
but with duplicated values removed. -
g
: the number of bins used. -
alpha
andci
:alpha
is the estimated attachment exponenet\alpha
(when assumeA_k = k^\alpha
), whileci
is the confidence interval. -
loglinear_fit
: this is the fitting result when we estimate\alpha
. -
objective_value
: values of the objective function over iterations in the final run with the full data. -
diverge_zero
: logical value indicates whether the algorithm diverged in the final run with the full data.
-
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Pham, T., Sheridan, P. & Shimodaira, H. (2015). PAFit: A Statistical Method for Measuring Preferential Attachment in Temporal Complex Networks. PLoS ONE 10(9): e0137796. (doi:10.1371/journal.pone.0137796).
2. Pham, T., Sheridan, P. & Shimodaira, H. (2016). Joint Estimation of Preferential Attachment and Node Fitness in Growing Complex Networks. Scientific Reports 6, Article number: 32558. (doi:10.1038/srep32558).
See Also
See get_statistics
for how to create summerized statistics needed in this function.
See Newman
and Jeong
for other methods to estimate the attachment function A_k
in isolation.
Examples
## Not run:
library("PAFit")
set.seed(1)
#### Example 1: Linear preferential attachment #########
# a network from BA model
net <- generate_net(N = 1000 , m = 50 , mode = 1, alpha = 1, s = 0)
net_stats <- get_statistics(net, only_PA = TRUE)
result <- only_A_estimate(net, net_stats)
# plot the estimated attachment function
plot(result, net_stats)
# true function
true_A <- result$estimate_result$center_k
lines(result$estimate_result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
#### Example 2: a non-log-linear preferential attachment #########
# A_k = alpha* log (max(k,1))^beta + 1, with alpha = 2, and beta = 2
set.seed(1)
net <- generate_net(N = 1000 , m = 50 , mode = 3, alpha = 2, beta = 2, s = 0)
net_stats <- get_statistics(net,only_PA = TRUE)
result <- only_A_estimate(net, net_stats)
# plot the estimated attachment function
plot(result, net_stats)
# true function
true_A <- 2 * log(pmax(result$estimate_result$center_k,1))^2 + 1 # true function
lines(result$estimate_result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
#############################################################################
#### Example 3: another non-log-linear preferential attachment kernel ############
set.seed(1)
# A_k = min(max(k,1),sat_at)^alpha, with alpha = 1, and sat_at = 200
# inverse variance of the distribution of node fitnesse = 10
net <- generate_net(N = 1000 , m = 50 , mode = 2, alpha = 1, sat_at = 200, s = 0)
net_stats <- get_statistics(net, only_PA = TRUE)
result <- only_A_estimate(net, net_stats)
# plot the estimated attachment function
true_A <- pmin(pmax(result$estimate_result$center_k,1),200)^1 # true function
plot(result , net_stats, max_A = max(true_A,result$estimate_result$theta))
lines(result$estimate_result$center_k, true_A, col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
## End(Not run)
Estimating node fitnesses in isolation
Description
This function estimates node fitnesses \eta_i
assusming either A_k = k
(i.e. linear preferential attachment) or A_k = 1
(i.e. no preferential attachment). The method has a hyper-parameter s
. It first performs a cross-validation to select the optimal parameter s
for the prior of \eta_i
, then estimates eta_i
with the full data (Ref. 1).
Usage
only_F_estimate(net_object ,
net_stat = get_statistics(net_object),
p = 0.75 ,
stop_cond = 10^-8 ,
model_A = "Linear" ,
...)
Arguments
net_object |
an object of class |
net_stat |
An object of class |
p |
Numeric. This is the ratio of the number of new edges in the learning data to that of the full data. The data is then divided into two parts: learning data and testing data based on |
stop_cond |
Numeric. The iterative algorithm stops when |
model_A |
String. Indicates which attachment function
|
... |
Other arguments to pass to the underlying algorithm. |
Value
Outputs a Full_PAFit_result
object, which is a list containing the following fields:
-
cv_data
: aCV_Data
object which contains the cross-validation data. Normally the user does not need to pay attention to this data. -
cv_result
: aCV_Result
object which contains the cross-validation result. Normally the user does not need to pay attention to this data. -
estimate_result
: this is aPAFit_result
object which contains the estimated node fitnesses and their confidence intervals. In particular, the important fields are:-
shape
: this is the selected value for the hyper-parameters
. -
g
: the number of bins used. -
f
: the estimated node fitnesses. -
var_f
: the estimated variance of\eta_i
. -
upper_f
: the estimated upper value of the interval of two standard deviations around\eta_i
. -
lower_f
: the estimated lower value of the interval of two standard deviations around\eta_i
. -
objective_value
: values of the objective function over iterations in the final run with the full data. -
diverge_zero
: logical value indicates whether the algorithm diverged in the final run with the full data.
-
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Pham, T., Sheridan, P. & Shimodaira, H. (2016). Joint Estimation of Preferential Attachment and Node Fitness in Growing Complex Networks. Scientific Reports 6, Article number: 32558. (doi:10.1038/srep32558).
2. Bianconni, G. & Barabási, A. (2001). Competition and multiscaling in evolving networks. Europhys. Lett., 54, 436 (doi:10.1209/epl/i2001-00260-6).
3. Caldarelli, G., Capocci, A. , De Los Rios, P. & Muñoz, M.A. (2002). Scale-Free Networks from Varying Vertex Intrinsic Fitness. Phys. Rev. Lett., 89, 258702 (doi:10.1103/PhysRevLett.89.258702).
See Also
See get_statistics
for how to create summerized statistics needed in this function.
See joint_estimate
for the method to jointly estimate the attachment function A_k
and node fitnesses \eta_i
.
Examples
## Not run:
library("PAFit")
set.seed(1)
# size of initial network = 100
# number of new nodes at each time-step = 100
# Ak = k; inverse variance of the distribution of node fitnesse = 10
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
# estimate node fitnesses in isolation, assuming Ak = k
result <- only_F_estimate(net, net_stats)
# plot the estimated node fitnesses and true node fitnesses
plot(result, net_stats, true = net$fitness, plot = "true_f")
## End(Not run)
Plotting the estimated attachment function and node fitness
Description
This function plots the estimated attachment function A_k
and node fitness eta_i
, together with additional information such as their confidence intervals or the estimated attachment exponent (\alpha
when assuming A_k = k^\alpha
).
Usage
## S3 method for class 'Full_PAFit_result'
plot(x,
net_stat ,
true_f = NULL , plot = "A" , plot_bin = TRUE ,
line = FALSE , confidence = TRUE , high_deg_A = 1 ,
high_deg_f = 5 ,
shade_point = 0.5 , col_point = "grey25" , pch = 16 ,
shade_interval = 0.5 , col_interval = "lightsteelblue" , label_x = NULL ,
label_y = NULL ,
max_A = NULL , min_A = NULL , f_min = NULL ,
f_max = NULL , plot_true_degree = FALSE ,
...)
Arguments
x |
An object of class |
net_stat |
An object of class |
true_f |
Vector. Optional parameter for the true value of node fitnesses (only available in simulated datasets). If this parameter is specified and |
plot |
String. Indicates which plot is produced.
Default value is |
plot_bin |
Logical. If |
line |
Logical. Indicates whether to plot the line fitted from the log-linear model or not. Default value is |
confidence |
Logical. Indicates whether to plot the confidence intervals of |
high_deg_A |
Integer. The estimated PA function is plotted starting from |
high_deg_f |
Integer. If |
col_point |
String. The name of the color of the points. Default value is |
shade_point |
Numeric. Value between 0 and 1. This is the transparency level of the points. Default value is |
pch |
Numeric. The plot symbol. Default value is |
shade_interval |
Numeric. Value between 0 and 1. This is the transparency level of the confidence intervals. Default value is |
max_A |
Numeric. Specify the maximum of the axis of PA. |
min_A |
Numeric. Specify the minimum of the axis of PA. |
f_min |
Numeric. Specify the minimum of the axis of fitness. |
f_max |
Numeric. Specify the maximum of the axis of fitness. |
plot_true_degree |
Logical. The degree of each node is plotted or not. |
label_x |
String. The label of x-axis. |
label_y |
String. The label of y-axis. |
col_interval |
String. The name of the color of the confidence intervals. Default value is |
... |
Other arguments to pass to the underlying plotting function. |
Value
Outputs the desired plot.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
#plot A
plot(result , net_stats , plot = "A")
true_A <- c(1,result$estimate_result$center_k[-1])
lines(result$estimate_result$center_k + 1 , true_A , col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
#plot true_f
plot(result, net_stats , net$fitness, plot = "true_f")
## End(Not run)
Plot a PAFit_net
object
Description
This function plots a PAFit_net
object. There are four options of plot
to specify the type of plot.
The first two concern plotting the graph in $graph
of the PAFit_net
object. Option plot = "graph"
plots the graph, while plot = "degree"
plots the degree distribution. Option slice
allows selection of the time-step at which the temporal graph is plotted.
The last two options concern plotting the PA function and node fitnesses (if they are not NULL
).
Usage
## S3 method for class 'PAFit_net'
plot(x,
plot = "graph" ,
slice = length(unique(x$graph[,3])) - 1,
...)
Arguments
x |
An object of class |
plot |
String. Possible values are |
slice |
Integer. Ignored when |
... |
Other arguments to pass to the underlying plotting function. |
Value
Outputs the desired plot.
Author(s)
Thong Pham thongphamthe@gmail.com. When plot = "graph"
, the function uses plot.network.default
in the network package.
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
plot(net, plot = "graph")
plot(net, plot = "degree")
plot(net, plot = "PA")
plot(net, plot = "fit")
Plotting the estimated attachment function and node fitness of a PAFit_result
object
Description
This function plots the estimated attachment function A_k
and node fitness eta_i
, together with additional information such as their confidence intervals or the estimated attachment exponent (\alpha
when assuming A_k = k^\alpha
) of a PAFit_result
object. This object is stored in the field $estimate_result
of a Full_PAFit_result
object, which in turn is the returning value of only_A_estimate
, only_F_estimate
or joint_estimate
.
Usage
## S3 method for class 'PAFit_result'
plot(x,
net_stat = NULL ,
true_f = NULL , plot = "A" , plot_bin = TRUE ,
line = FALSE , confidence = TRUE , high_deg_A = 1 ,
high_deg_f = 5 ,
shade_point = 0.5 , col_point = "grey25" , pch = 16 ,
shade_interval = 0.5 , col_interval = "lightsteelblue" , label_x = NULL ,
label_y = NULL ,
max_A = NULL , min_A = NULL , f_min = NULL ,
f_max = NULL , plot_true_degree = FALSE ,
...)
Arguments
x |
An object of class |
net_stat |
An object of class |
true_f |
Vector. Optional parameter for the true value of node fitnesses (only available in simulated datasets). If this parameter is specified and |
plot |
String. Indicates which plot is produced.
Default value is |
plot_bin |
Logical. If |
line |
Logical. Indicates whether to plot the line fitted from the log-linear model or not. Default value is |
confidence |
Logical. Indicates whether to plot the confidence intervals of |
high_deg_A |
Integer. The estimated PA function is plotted starting from |
high_deg_f |
Integer. If |
col_point |
String. The name of the color of the points. Default value is |
shade_point |
Numeric. Value between 0 and 1. This is the transparency level of the points. Default value is |
pch |
Numeric. The plot symbol. Default value is |
shade_interval |
Numeric. Value between 0 and 1. This is the transparency level of the confidence intervals. Default value is |
max_A |
Numeric. Specify the maximum of the axis of PA. |
min_A |
Numeric. Specify the minimum of the axis of PA. |
f_min |
Numeric. Specify the minimum of the axis of fitness. |
f_max |
Numeric. Specify the maximum of the axis of fitness. |
plot_true_degree |
Logical. The degree of each node is plotted or not. |
label_x |
String. The label of x-axis. |
label_y |
String. The label of y-axis. |
col_interval |
String. The name of the color of the confidence intervals. Default value is |
... |
Other arguments to pass to the underlying plotting function. |
Value
Outputs the desired plot.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
#plot A
plot(result$estimate_result , net_stats , plot = "A")
true_A <- c(1,result$estimate_result$center_k[-1])
lines(result$estimate_result$center_k + 1 , true_A , col = "red") # true line
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
#plot true_f
plot(result, net_stats , net$fitness, plot = "true_f")
## End(Not run)
Plotting the estimated attachment function
Description
This function plots the estimated attachment function from the corrected Newman's method or the Jeong's method. Its also plots additional information such as the estimated attachment exponenent (\alpha
when assuming A_k = k^\alpha
).
Usage
## S3 method for class 'PA_result'
plot(x,
net_stat = NULL,
plot_bin = TRUE ,
high_deg = 1 ,
line = FALSE ,
col_point = "black",
shade_point = 0.5 ,
pch = 16 ,
max_A = NULL ,
min_A = NULL ,
label_x = NULL ,
label_y = NULL ,
...)
Arguments
x |
An object of class |
net_stat |
An object of class |
plot_bin |
Logical. If |
high_deg |
Integer. Specifies the starting degree from which |
line |
Logical. Indicates whether to plot the line fitted from the log-linear model or not. Default value is |
col_point |
String. The name of the color of the points. Default value is |
shade_point |
Numeric. Value between |
pch |
Numeric. The plot symbol. Default value is |
max_A |
Numeric. Specify the maximum of the horizontal axis. |
min_A |
Numeric. Specify the minimum of the horizontal axis. |
label_x |
String. The label of x-axis. If |
label_y |
String. The label of y-axis. If |
... |
Other arguments to pass to the underlying plotting function. |
Value
Outputs the desired plot.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
net <- generate_net(N = 1000 , m = 1 , mode = 1 , alpha = 1 , s = 0)
net_stats <- get_statistics(net)
result <- Newman(net, net_stats)
# true function
true_A <- result$center_k
# plot the estimated attachment function
plot(result , net_stats)
lines(result$center_k, true_A, col = "red") # true attachment function
legend("topleft" , legend = "True function" , col = "red" , lty = 1 , bty = "n")
Plotting contributions calculated from the observed data and contributions calculated from simulated data
Description
This function extracts from a Simulated_Data_From_Fitted_Model
object contributions of rich-get-richer and fit-get-richer effects calculated using simulated networks and plots these contributions versus the contributions calculated from the original observed network. See joint_estimate
for a description of how the contributions are calculated.
Usage
plot_contribution(simulated_object,
original_result,
which_plot = "PA",
y_label = ifelse("PA" == which_plot,
"Contribution of the rich-get-richer effect",
"Contribution of the fit-get-richer effect"),
legend_pos_x = 0.75,
legend_pos_y = 0.9)
Arguments
simulated_object |
an object of class |
original_result |
an object of class |
which_plot |
String. “PA": plots contributions of rich-get-richer effect, “fit": plots contribution of fit-get-richer effect. Default is “PA". |
y_label |
String. The label for y-axis. Default is "Contribution of rich-get-richer effect". |
legend_pos_x |
Numeric. The horizontal position, between (0,1), of the legend. Default value is |
legend_pos_y |
Numeric. The vertical position, between (0,1), of the legend. Default value is |
Value
Output a plot.
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Pham, T., Sheridan, P. & Shimodaira, H. (2015). PAFit: A Statistical Method for Measuring Preferential Attachment in Temporal Complex Networks. PLoS ONE 10(9): e0137796. (doi:10.1371/journal.pone.0137796).
2. Pham, T., Sheridan, P. & Shimodaira, H. (2016). Joint Estimation of Preferential Attachment and Node Fitness in Growing Complex Networks. Scientific Reports 6, Article number: 32558. (doi:10.1038/srep32558).
3. Pham, T., Sheridan, P. & Shimodaira, H. (2020). PAFit: An R Package for the Non-Parametric Estimation of Preferential Attachment and Node Fitness in Temporal Complex Networks. Journal of Statistical Software 92 (3). (doi:10.18637/jss.v092.i03).
4. Inoue, M., Pham, T. & Shimodaira, H. (2020). Joint Estimation of Non-parametric Transitivity and Preferential Attachment Functions in Scientific Co-authorship Networks. Journal of Informetrics 14(3). (doi:10.1016/j.joi.2020.101042).
See Also
joint_estimate
, plot_contribution
Examples
## Not run:
library("PAFit")
net_object <- generate_net(N = 500, m = 10, s = 10, alpha = 0.5)
net_stat <- get_statistics(net_object)
result <- joint_estimate(net_object, net_stat)
simulated_data <- generate_simulated_data_from_estimated_model(net_object, net_stat, result)
plot_contribution(simulated_data, result, which_plot = "PA")
plot_contribution(simulated_data, result, which_plot = "fit")
## End(Not run)
Printing simple information of the cross-validation data
Description
This function prints simple information of the cross-validation data stored in a CV_Data
object. This object is the field $cv_data
of a Full_PAFit_result
object, which in turn is the returning value of only_A_estimate
, only_F_estimate
or joint_estimate
.
Usage
## S3 method for class 'CV_Data'
print(x,...)
Arguments
x |
An object of class |
... |
Other arguments to pass. |
Value
Prints simple information of the cross-validation data.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
print(result$cv_data)
## End(Not run)
Printing simple information of the cross-validation result
Description
This function prints simple information of the cross-validation result stored in a CV_Result
object. This object is the field $cv_result
of a Full_PAFit_result
object, which in turn is the returning value of only_A_estimate
, only_F_estimate
or joint_estimate
.
Usage
## S3 method for class 'CV_Result'
print(x,...)
Arguments
x |
An object of class |
... |
Other arguments to pass. |
Value
Prints simple information of the cross-validation result.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
print(result$cv_result)
## End(Not run)
printing information on the estimation result
Description
This function outputs simple information of the estimation result.
Usage
## S3 method for class 'Full_PAFit_result'
print(x,...)
Arguments
x |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information on the estimation result.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
print(result)
## End(Not run)
Printing simple information on the statistics of the network stored in a PAFit_data
object
Description
This function prints simple information of the statistics stored in a PAFit_data
object. This object is the returning value of get_statistics
.
Usage
## S3 method for class 'PAFit_data'
print(x,...)
Arguments
x |
An object of class |
... |
Other arguments to pass. |
Value
Prints simple information of the network statistics.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
print(net_stats)
## End(Not run)
Printing simple information of a PAFit_net
object
Description
This function outputs simple information of a PAFit_net
object.
Usage
## S3 method for class 'PAFit_net'
print(x,
...)
Arguments
x |
An object of class |
... |
Other arguments to pass. |
Value
Outputs simple information of the network.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
print(net)
printing information on the estimation result stored in a PAFit_result
object
Description
This function outputs simple information of the estimation result stored in a PAFit_result
object. This object is stored in the field $estimate_result
of a Full_PAFit_result
object, which in turn is the returning value of only_A_estimate
, only_F_estimate
or joint_estimate
.
Usage
## S3 method for class 'PAFit_result'
print(x,...)
Arguments
x |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information on the estimation result.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
print(result$estimate_result)
## End(Not run)
Printing information of the estimated attachment function
Description
This function outputs simple information of the estimated attachment function from the corrected Newman's method or the Jeong's method.
Usage
## S3 method for class 'PA_result'
print(x,
...)
Arguments
x |
An object of class |
... |
Additional parameters to pass. |
Value
Simple information of the estimated attachment function.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
net <- generate_net(N = 1000 , m = 1 , mode = 1 , alpha = 1 , s = 0)
net_stats <- get_statistics(net)
result <- Newman(net, net_stats)
print(result)
Printing summary information of the cross-validation data
Description
This function outputs summary information of the cross-validation data stored in a CV_Data
object. This object is the field $cv_data
of a Full_PAFit_result
object, which in turn is the returning value of only_A_estimate
, only_F_estimate
or joint_estimate
.
Usage
## S3 method for class 'CV_Data'
summary(object,...)
Arguments
object |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information of the cross-validation data.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
summary(result$cv_data)
## End(Not run)
Output summary information of the cross-validation result
Description
This function outputs summary information of the cross-validation result stored in a CV_Result
object. This object is the field $cv_result
of a Full_PAFit_result
object, which in turn is the returning value of only_A_estimate
, only_F_estimate
or joint_estimate
.
Usage
## S3 method for class 'CV_Result'
summary(object,...)
Arguments
object |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information of the cross-validation result.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
summary(result$cv_result)
## End(Not run)
Summary information on the estimation result
Description
This function outputs a summary on the estimation result.
Usage
## S3 method for class 'Full_PAFit_result'
summary(object,...)
Arguments
object |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information on the estimation result.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
summary(result)
## End(Not run)
Output summary information on the statistics of the network stored in a PAFit_data
object
Description
This function outputs summary information of the statistics stored in a PAFit_data
object. This object is the returning value of get_statistics
.
Usage
## S3 method for class 'PAFit_data'
summary(object,...)
Arguments
object |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information of the network statistics.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
summary(net_stats)
## End(Not run)
Summary information of a PAFit_net
object
Description
This function outputs summary information of a PAFit_net
object.
Usage
## S3 method for class 'PAFit_net'
summary(object,
...)
Arguments
object |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information of the network.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
summary(net)
Output summary information on the estimation result stored in a PAFit_result
object
Description
This function outputs summary information of the estimation result stored in a PAFit_result
object. This object is stored in the field $estimate_result
of a Full_PAFit_result
object, which in turn is the returning value of only_A_estimate
, only_F_estimate
or joint_estimate
.
Usage
## S3 method for class 'PAFit_result'
summary(object,...)
Arguments
object |
An object of class |
... |
Other arguments to pass. |
Value
Outputs summary information on the estimation result.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
## Since the runtime is long, we do not let this example run on CRAN
## Not run:
library("PAFit")
set.seed(1)
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 1000 , m = 50 ,
num_seed = 100 , multiple_node = 100,
s = 10)
net_stats <- get_statistics(net)
result <- joint_estimate(net, net_stats)
summary(result$estimate_result)
## End(Not run)
Summary of the estimated attachment function
Description
This function outputs summary information of the estimated attachment function from the corrected Newman's method or the Jeong's method.
Usage
## S3 method for class 'PA_result'
summary(object,
...)
Arguments
object |
An object of class |
... |
Additional parameters to pass. |
Value
Summary information of the estimated attachment function.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
net <- generate_net(N = 1000 , m = 1 , mode = 1 , alpha = 1 , s = 0)
net_stats <- get_statistics(net)
result <- Newman(net, net_stats)
summary(result)
Fitting various distributions to a degree vector
Description
This function implements the method in Handcock and Jones (2004) to fit various distributions to a degree vector. The implemented distributions are Yule, Waring, Poisson, geometric and negative binomial. The Yule and Waring distributions correspond to a preferential attachment situation. In particular, the two distributions correspond to the case of A_k = k
for k \ge 1
and \eta_i = 1
for all i
(note that, the number of new edges and new nodes at each time-step are implicitly assumed to be 1
).
Thus, if the best fitted distribution, which is chosen by either the Akaike Information Criterion (AIC) or the Bayesian Information Criterion (BIC), is NOT Yule or Waring, then the case of A_k = k
for k \ge 1
and \eta_i = 1
for all i
is NOT consistent with the observed degree vector.
The method allows the low-tail probabilities to NOT follow the parametric distribution, i.e., P(K = k) = \pi_k
for all k \le k_{min}
and P(K = k) = f(k,\theta)
for all k > k_{min}
. Here k_{min}
is the degree threshold above which the parametric distribution holds, \pi_k
are probabilities of the low-tail, f(.,\theta)
is the parametric distribution with parameter vector \theta
.
For fixed k_{min}
and f
, \pi_k
and \theta
can be estimated by Maximum Likelihood Estimation. We can choose the best k_{min}
for each f
by comparing the AIC (or BIC). More details can be founded in Handcock and Jones (2004).
Usage
test_linear_PA(degree_vector)
Arguments
degree_vector |
a degree vector |
Value
Outputs a Linear_PA_test_result
object which contains the fitting of five distributions to the degree vector: Yule (yule
), Waring (waring
), Poisson (pois
), geometric (geom
) and negative binomial (nb
). In particular, for each distribution, the AIC and BIC are calcualted for each k_min
.
Author(s)
Thong Pham thongphamthe@gmail.com
References
1. Handcock MS, Jones JH (2004). “Likelihood-based inference for stochastic models of sexual network formation.” Theoretical Population Biology, 65(4), 413 – 422. ISSN 0040-5809. doi:10.1016/j.tpb.2003.09.006. Demography in the 21st Century, https://www.sciencedirect.com/science/article/pii/S0040580904000310.
Examples
## Not run:
library("PAFit")
set.seed(1)
net <- generate_BA(n = 1000)
stats <- get_statistics(net, only_PA = TRUE)
u <- test_linear_PA(stats$final_deg)
print(u)
## End(Not run)
Convert a PAFit_net object to an igraph object
Description
This function converts a PAFit_net
object to an igraph
object (of package igraph).
Usage
to_igraph(net_object)
Arguments
net_object |
An object of class |
Value
The function returns an igraph
object.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
igraph_graph <- to_igraph(net)
Convert a PAFit_net object to a networkDynamic object
Description
This function converts a PAFit_net
object to a networkDynamic
object (of package networkDynamic).
Usage
to_networkDynamic(net_object)
Arguments
net_object |
An object of class |
Value
The function returns a networkDynamic
object.
Author(s)
Thong Pham thongphamthe@gmail.com
Examples
library("PAFit")
# a network from Bianconi-Barabasi model
net <- generate_BB(N = 50 , m = 10 , s = 10)
nD_graph <- to_networkDynamic(net)