R Under development (unstable) (2024-02-18 r85939 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # File tests/nofixed.R in package latentnet, part of the > # Statnet suite of packages for network analysis, https://statnet.org . > # > # This software is distributed under the GPL-3 license. It is free, > # open source, and has the attribution requirements (GPL Section 7) at > # https://statnet.org/attribution . > # > # Copyright 2003-2024 Statnet Commons > ################################################################################ > library(latentnet) Loading required package: network 'network' 1.18.2 (2023-12-04), part of the Statnet Project * 'news(package="network")' for changes since last version * 'citation("network")' for citation information * 'https://statnet.org' for help, support, and other information Loading required package: ergm 'ergm' 4.6.0 (2023-12-17), part of the Statnet Project * 'news(package="ergm")' for changes since last version * 'citation("ergm")' for citation information * 'https://statnet.org' for help, support, and other information 'ergm' 4 is a major update that introduces some backwards-incompatible changes. Please type 'news(package="ergm")' for a list of major changes. 'latentnet' 2.11.0 (2024-02-19), part of the Statnet Project * 'news(package="latentnet")' for changes since last version * 'citation("latentnet")' for citation information * 'https://statnet.org' for help, support, and other information NOTE: BIC calculation prior to latentnet 2.7.0 had a bug in the calculation of the effective number of parameters. See help(summary.ergmm) for details. NOTE: Prior to version 2.8.0, handling of fixed effects for directed networks had a bug: the covariate matrix was transposed. > > data(sampson) > > monks.nf<-ergmm(samplike~euclidean(d=2)+rreceiver-1) > mcmc.diagnostics(monks.nf) Chain 1 Lag 0 lpY Z.1.1 Z.1.2 receiver.1 lpY 1.00000000 0.08373411 0.16003448 0.5036685 Z.1.1 0.08373411 1.00000000 0.02769892 0.1871120 Z.1.2 0.16003448 0.02769892 1.00000000 0.3136545 receiver.1 0.50366850 0.18711196 0.31365447 1.0000000 Lag 10 lpY Z.1.1 Z.1.2 receiver.1 lpY 0.57631274 0.080249091 0.13118034 0.4153255 Z.1.1 0.08491372 0.424995750 -0.01674358 0.1326702 Z.1.2 0.13863187 0.008605952 0.41987416 0.1914347 receiver.1 0.43077205 0.124815577 0.18017439 0.5280696 [[1]] Quantile (q) = 0.025 Accuracy (r) = +/- 0.0125 Probability (s) = 0.95 Burn-in Total Lower bound Dependence (M) (N) (Nmin) factor (I) lpY 100 19040 600 31.7 Z.1.1 50 9860 600 16.4 Z.1.2 50 8670 600 14.4 receiver.1 50 9860 600 16.4 > plot(gof(monks.nf)) > predict(monks.nf) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.9001085 0.7624617 0.17256972 0.17450645 0.3659160 0.07519785 0.5161123 [2,] 0.7499298 0.9009766 0.15736585 0.09840655 0.2304768 0.04060473 0.5756726 [3,] 0.5094139 0.4885161 0.61688560 0.09415814 0.2373911 0.03814168 0.2680472 [4,] 0.3725954 0.2437945 0.05356234 0.75103352 0.6671111 0.29594590 0.1173078 [5,] 0.4728981 0.3268322 0.08675039 0.53315401 0.8483865 0.25124113 0.1654850 [6,] 0.3956087 0.2645844 0.05980453 0.54758204 0.6318467 0.49792081 0.1313453 [7,] 0.7328175 0.7850445 0.16092623 0.11232465 0.2527457 0.04705341 0.7652358 [8,] 0.5508023 0.4105562 0.08361527 0.47075362 0.6235273 0.23746061 0.2225244 [9,] 0.4798497 0.3456571 0.07326791 0.46145332 0.6438841 0.24655810 0.1810226 [10,] 0.4662667 0.3288011 0.08095793 0.53285226 0.6594345 0.24592780 0.1673956 [11,] 0.5065298 0.3768984 0.07415947 0.49473371 0.6526849 0.21207871 0.1964855 [12,] 0.7320217 0.7789226 0.10907104 0.10640199 0.2348326 0.04435572 0.5439593 [13,] 0.4383405 0.3742897 0.33381866 0.14889585 0.3333957 0.06125108 0.2020653 [14,] 0.7504199 0.7408508 0.10696333 0.15817315 0.3160665 0.06633134 0.4648049 [15,] 0.7492987 0.7810729 0.12214535 0.13051120 0.2809705 0.05553712 0.5291389 [16,] 0.7220634 0.7292692 0.12563702 0.15055286 0.3071343 0.06461355 0.5457341 [17,] 0.4447256 0.4297581 0.43432499 0.08487506 0.2132543 0.03442539 0.2276623 [18,] 0.5035276 0.4802798 0.45186583 0.09731406 0.2444318 0.03947985 0.2676819 [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 0.25692332 0.17508808 0.08762882 0.14697502 0.6007231 0.2428485 0.5326307 [2,] 0.15650327 0.10307629 0.04827612 0.08765323 0.6470783 0.1927974 0.5078828 [3,] 0.11428171 0.08342136 0.04771467 0.06103762 0.2440309 0.5067702 0.1807857 [4,] 0.40763177 0.35458523 0.26068743 0.31244635 0.1496318 0.1650405 0.1618365 [5,] 0.41704239 0.39626488 0.25012812 0.33086962 0.2006634 0.2444256 0.2100254 [6,] 0.41236026 0.37852279 0.22677378 0.26588744 0.1670731 0.1740783 0.1744887 [7,] 0.17382423 0.11743462 0.05486195 0.09594293 0.6245482 0.2131571 0.4564725 [8,] 0.70043755 0.44042420 0.27418159 0.30304959 0.2742315 0.2061745 0.2799501 [9,] 0.48730603 0.65555066 0.25140793 0.27060854 0.2284459 0.1946074 0.2298250 [10,] 0.48917847 0.41188020 0.46993507 0.28758359 0.2057567 0.2230832 0.2135833 [11,] 0.42368844 0.34105237 0.21334708 0.57293476 0.2554503 0.1857130 0.2817226 [12,] 0.16616324 0.11366019 0.05089919 0.09826014 0.8188026 0.1446175 0.5398765 [13,] 0.15071927 0.11985801 0.07439186 0.08438701 0.1785496 0.7750036 0.1437832 [14,] 0.22679618 0.15699041 0.07464346 0.15169189 0.6282840 0.1573518 0.7582379 [15,] 0.19750501 0.13508449 0.06292527 0.11951289 0.6404515 0.1701433 0.5695377 [16,] 0.22051884 0.16059998 0.07287168 0.13514552 0.5938640 0.1844292 0.4719187 [17,] 0.09824378 0.07315683 0.04191481 0.05228185 0.2017779 0.5102021 0.1464383 [18,] 0.11600111 0.08569135 0.04884145 0.06219805 0.2366868 0.5418728 0.1756712 [,15] [,16] [,17] [,18] [1,] 0.31407223 0.29050001 0.10763245 0.16840845 [2,] 0.34609196 0.29304824 0.10101766 0.15211309 [3,] 0.09664135 0.09926000 0.36480234 0.45355203 [4,] 0.06037353 0.07006044 0.03651581 0.05624781 [5,] 0.08487175 0.09682648 0.05895239 0.09055613 [6,] 0.06766764 0.07923602 0.04097883 0.06276959 [7,] 0.30931795 0.32994345 0.10371058 0.16076575 [8,] 0.11830228 0.13540729 0.05523852 0.08644506 [9,] 0.09473265 0.11463527 0.04904753 0.07603860 [10,] 0.08490876 0.09889643 0.05451461 0.08409905 [11,] 0.11173504 0.12723830 0.04879676 0.07559572 [12,] 0.33680681 0.30042466 0.06805441 0.10584357 [13,] 0.07254679 0.07877644 0.27704917 0.36607061 [14,] 0.35267307 0.27277075 0.06595511 0.10408416 [15,] 0.55558659 0.30965566 0.07674367 0.11966794 [16,] 0.30675283 0.55998541 0.07978262 0.12452894 [17,] 0.07767752 0.08148173 0.54481918 0.44516542 [18,] 0.09421501 0.09848835 0.37342280 0.62030007 > simulate(monks.nf) Network attributes: vertices = 18 directed = TRUE hyper = FALSE loops = FALSE multiple = FALSE bipartite = FALSE total edges= 80 missing edges= 0 non-missing edges= 80 Vertex attribute names: vertex.names No edge attributes > print(summary(monks.nf)) NOTE: It is not certain whether it is appropriate to use latentnet's BIC to select latent space dimension, whether or not to include actor-specific random effects, and to compare clustered models with the unclustered model. ========================== Summary of model fit ========================== Formula: samplike ~ euclidean(d = 2) + rreceiver - 1 Attribute: edges Model: Bernoulli MCMC sample of size 4000, draws are 10 iterations apart, after burnin of 10000 iterations. Receiver effect variance: 2.121137. Overall BIC: 384.2325 Likelihood BIC: 242.9112 Latent space/clustering BIC: 99.60677 Receiver effect BIC: 41.71457 > > proc.time() user system elapsed 16.18 0.60 16.78