R Under development (unstable) (2025-09-10 r88809 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 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-2025 Statnet Commons > ################################################################################ > library(latentnet) Loading required package: network 'network' 1.19.0 (2024-12-08), 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.10.1 (2025-08-26), 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.12.0 (2025-09-11), 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.0000000 -0.10053851 0.12181542 0.5666762 Z.1.1 -0.1005385 1.00000000 0.05489565 -0.1483714 Z.1.2 0.1218154 0.05489565 1.00000000 0.2292130 receiver.1 0.5666762 -0.14837138 0.22921298 1.0000000 Lag 10 lpY Z.1.1 Z.1.2 receiver.1 lpY 0.62349306 -0.08488813 0.10394471 0.49791413 Z.1.1 -0.07815591 0.43025952 0.02102943 -0.09538029 Z.1.2 0.09739314 0.04416654 0.42336918 0.15496048 receiver.1 0.48051712 -0.08276416 0.13786483 0.57571393 [[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 18740 600 31.2 Z.1.1 40 8480 600 14.1 Z.1.2 50 8670 600 14.4 receiver.1 60 11010 600 18.4 > plot(gof(monks.nf)) > predict(monks.nf) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.8964804 0.7582516 0.17426352 0.17226591 0.3646562 0.07546791 0.5047863 [2,] 0.7483405 0.8959861 0.15682677 0.10055476 0.2334445 0.04283632 0.5617429 [3,] 0.5056608 0.4792834 0.61851014 0.09352666 0.2288232 0.03891499 0.2587244 [4,] 0.3680971 0.2444175 0.05522499 0.74404061 0.6611560 0.28904327 0.1167658 [5,] 0.4720652 0.3304137 0.08665297 0.52787902 0.8427703 0.24989139 0.1651344 [6,] 0.3946202 0.2686050 0.06144415 0.53616963 0.6258016 0.49464010 0.1319175 [7,] 0.7247921 0.7742997 0.15995707 0.11438650 0.2531684 0.04866362 0.7570375 [8,] 0.5492613 0.4106063 0.08594145 0.46847898 0.6231085 0.23743213 0.2218298 [9,] 0.4783206 0.3457749 0.07463854 0.45710025 0.6407861 0.24546760 0.1812122 [10,] 0.4637671 0.3283695 0.08317097 0.53210624 0.6585222 0.24425516 0.1653093 [11,] 0.4988931 0.3734663 0.07316973 0.49205092 0.6492077 0.21143203 0.1943317 [12,] 0.7309203 0.7748385 0.11248241 0.10682511 0.2359237 0.04557930 0.5393923 [13,] 0.4362866 0.3668563 0.33438389 0.15255743 0.3294814 0.06284146 0.1932211 [14,] 0.7476793 0.7397605 0.11095706 0.15578544 0.3135416 0.06612024 0.4540538 [15,] 0.7440333 0.7762897 0.12048951 0.13010749 0.2802855 0.05484518 0.5184303 [16,] 0.7133597 0.7159214 0.12453704 0.15467859 0.3133742 0.06808440 0.5334721 [17,] 0.4409180 0.4172715 0.43951815 0.08596654 0.2082831 0.03562884 0.2174596 [18,] 0.4993981 0.4715150 0.45252822 0.09803023 0.2362257 0.04028409 0.2578530 [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 0.25563952 0.17310917 0.08804447 0.13946403 0.5968389 0.2443195 0.5358019 [2,] 0.15864690 0.10331003 0.05016166 0.08617208 0.6431056 0.1893275 0.5150290 [3,] 0.11431762 0.08199134 0.04850792 0.05889691 0.2454040 0.5026169 0.1854320 [4,] 0.40689537 0.34665004 0.26184520 0.30627257 0.1479296 0.1704106 0.1621088 [5,] 0.41975864 0.39117946 0.25167331 0.32360105 0.2024689 0.2450181 0.2141709 [6,] 0.41311486 0.37036092 0.22451589 0.25892793 0.1669433 0.1766529 0.1766957 [7,] 0.17601688 0.11914552 0.05723798 0.09409376 0.6204042 0.2078906 0.4547260 [8,] 0.69519996 0.43257149 0.27182142 0.29602671 0.2734576 0.2116338 0.2797772 [9,] 0.48571636 0.64551081 0.24733174 0.26548909 0.2281650 0.1960512 0.2292499 [10,] 0.48704160 0.40037272 0.46439104 0.28048917 0.2035620 0.2294725 0.2161737 [11,] 0.42247510 0.33622623 0.21338911 0.56188710 0.2514478 0.1876561 0.2764224 [12,] 0.16702880 0.11330048 0.05180909 0.09435993 0.8127167 0.1460096 0.5400206 [13,] 0.15515420 0.11889905 0.07817674 0.08480827 0.1799084 0.7704901 0.1487781 [14,] 0.22362756 0.15152688 0.07546893 0.14177031 0.6207457 0.1595704 0.7574217 [15,] 0.19390111 0.13196479 0.06338403 0.11520587 0.6373473 0.1647952 0.5712390 [16,] 0.22674250 0.16334734 0.07639569 0.13438374 0.5815380 0.1805406 0.4639950 [17,] 0.09977362 0.07186455 0.04415277 0.05097442 0.2015531 0.5051115 0.1507904 [18,] 0.11693574 0.08352074 0.05061806 0.06067882 0.2392293 0.5334997 0.1802196 [,15] [,16] [,17] [,18] [1,] 0.31163328 0.28532181 0.10660069 0.17020284 [2,] 0.34489579 0.28596957 0.09504579 0.15047279 [3,] 0.09449077 0.09844055 0.36165734 0.45173277 [4,] 0.06110019 0.07471003 0.03862941 0.05754972 [5,] 0.08642274 0.10289815 0.05929639 0.09063575 [6,] 0.06909140 0.08502535 0.04266530 0.06389216 [7,] 0.30492941 0.32518047 0.09931140 0.15829865 [8,] 0.11820257 0.14232393 0.05646698 0.08821420 [9,] 0.09470590 0.12063099 0.04931711 0.07587730 [10,] 0.08600582 0.10335074 0.05706871 0.08620856 [11,] 0.11157593 0.13258133 0.04833929 0.07656547 [12,] 0.33861253 0.29619743 0.06765239 0.10854557 [13,] 0.07056414 0.07831663 0.27264176 0.36074000 [14,] 0.35171370 0.26520547 0.06652185 0.10761504 [15,] 0.55243640 0.30667424 0.07291564 0.11722457 [16,] 0.30171706 0.55680463 0.07670084 0.12283734 [17,] 0.07620823 0.07962989 0.53761875 0.44404630 [18,] 0.09207046 0.09729641 0.36667851 0.61728665 > simulate(monks.nf) Network attributes: vertices = 18 directed = TRUE hyper = FALSE loops = FALSE multiple = FALSE bipartite = FALSE total edges= 78 missing edges= 0 non-missing edges= 78 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.078437. Overall BIC: 383.6823 Likelihood BIC: 243.2058 Latent space/clustering BIC: 98.97344 Receiver effect BIC: 41.50308 > > proc.time() user system elapsed 10.98 0.20 11.17