Learn R Programming

PAFit (version 0.9.6)

performCV:

Description

A function to perform cross validation to select r and s in PAFit.

Usage

performCV(cv_data,
                 r           = 10^c(-2,-1,0,1,2),
                 s           = 10^c(-1,1,2,3,4), 
                 stop_cond   = 10^-7, 
                 only_PAFit  = TRUE, 
                 silent      = FALSE, 
                 only_loglinear = FALSE,
                ...)

Arguments

cv_data
Cross-validation data. An object of class CV_Data.
r
Numeric vector. Specifying the values of the regularization parameter \(r\) of the PA function. Default value is the vector c(0.01,0.1,1,10,100).
s
Numeric vector. Specifying the values of the regularization parameter \(s\) of node fitness. Default value is the vector c(0.1,1,10,100,1000,10000).
stop_cond
Numeric. The iterative algorithm will halt if the relative difference of the objective function falls below this value. Default value is 10^-7.
only_PAFit
Logical. If TRUE then only perform the CV for PAFit full model. Default is TRUE.
silent
Logical. If TRUE then the progress is not printed out. Default is FALSE.
only_loglinear
Logical. If TRUE then only perform the CV assuming the linear functional form \(A_k = k^\alpha\). In this case, the search is one-dimensional, since we only have to find s (given s, \(\alpha\) and node fitnesses can be estimated). Default is FALSE.
Additional parameters (e.g. debug = TRUE) to pass onto the PAFit function.

Value

An object of class "CV_Result" containing the cross validation result. The important fields are:
r_optimal
Numeric. The optimal value of the r parameter chosen by the CV process.
s_optimal
Numeric. The optimal value of the s parameter chosen by the CV process.
One then uses \(PAFit\) function on the full data with the parameters \(r\) and \(s\) set to \(r_optimal\) and \(s_optimal\), respectively.

References

1. Pham, T., Sheridan, P. & Shimodaira, H. (2016). Nonparametric Estimation of the Preferential Attachment Function in Complex Networks: Evidence of Deviations from Log Linearity, Proceedings of ECCS 2014, 141-153 (Springer International Publishing) (http://dx.doi.org/10.1007/978-3-319-29228-1_13). 2. 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 (http://dx.doi.org/10.1371/journal.pone.0137796). 3. 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 (www.nature.com/articles/srep32558).

Examples

Run this code
library("PAFit")
net       <- GenerateNet(N = 100 , m = 5 , mode = 1 , alpha = 0.5 , shape = 10, rate = 10)
data_cv   <- CreateDataCV(net$graph) # create CV data
cv_result <- performCV(data_cv , r = c(0.1,1) , s = c(10) , only_PAFit = TRUE , stop_cond = 10^-2)
print(cv_result)

Run the code above in your browser using DataLab