R version 4.6.0 alpha (2026-04-02 r89777 ucrt) Copyright (C) 2026 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. > library(RSiena) > > # When new effects are added, the numbering of effects changes. > # This will have consequences for the output of set_interaction, > # and will require adaptation of parallel.Rout.save. > > ##test3 > mynet1 <- as_dependent_rsiena(array(c(tmp3, tmp4),dim=c(32, 32, 2))) > mydata <- make_data_rsiena(mynet1) > myeff<- make_specification(mydata) > print('test3') [1] "test3" > alg_alg <- set_algorithm_saom(cond=FALSE, seed=3, n3=50, nsub=2, findiff=TRUE) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 3.0740 ( 0.4229 ) 0.3149 2. eval outdegree (density) -1.1655 ( 0.1424 ) 0.0065 3. eval reciprocity 1.7954 ( 0.2956 ) -0.0069 Overall maximum convergence ratio: 0.3553 Total of 441 iteration steps. > (myeff <- set_effect(myeff, list(transTrip, cycle4))) effectNumber effectName shortName include fix test initialValue 1 20 transitive triplets transTrip TRUE FALSE FALSE 0 2 215 4 cycles (#) cycle4 TRUE FALSE FALSE 0 parm 1 0 2 1 effectName include fix test initialValue parm 1 basic rate parameter mynet1 TRUE FALSE FALSE 4.80941 0 2 outdegree (density) TRUE FALSE FALSE -0.56039 0 3 reciprocity TRUE FALSE FALSE 0.00000 0 4 transitive triplets TRUE FALSE FALSE 0.00000 0 5 4 cycles (#) TRUE FALSE FALSE 0.00000 1 > (myeff <- set_effect(myeff, cycle4, include=FALSE)) effectNumber effectName shortName include fix test initialValue parm 1 215 4 cycles (1) cycle4 FALSE FALSE FALSE 0 1 effectName include fix test initialValue parm 1 basic rate parameter mynet1 TRUE FALSE FALSE 4.80941 0 2 outdegree (density) TRUE FALSE FALSE -0.56039 0 3 reciprocity TRUE FALSE FALSE 0.00000 0 4 transitive triplets TRUE FALSE FALSE 0.00000 0 > ##test4 > print('test4') [1] "test4" > alg_alg <- set_algorithm_saom(cond=TRUE, condvarno=1, seed=3, n3=50, nsub=2, findiff=TRUE) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 3.1687 ( 0.4942 ) Other parameters: 1. eval outdegree (density) -1.7670 ( 0.3883 ) -0.0641 2. eval reciprocity 1.2846 ( 0.4058 ) -0.0064 3. eval transitive triplets 0.3319 ( 0.0845 ) 0.0180 Overall maximum convergence ratio: 0.1566 Total of 319 iteration steps. > ##test5 > mynet1 <- as_dependent_rsiena(array(c(tmp3,tmp4),dim=c(32,32,2))) > mydata <- make_data_rsiena(mynet1) > myeff<- make_specification(mydata) > print('test5') [1] "test5" > alg_alg <- set_algorithm_saom(cond=FALSE, seed=5, n3=50, nsub=2) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 3.0805 ( 0.6084 ) -0.1454 2. eval outdegree (density) -1.1473 ( 0.1609 ) -0.0251 3. eval reciprocity 1.7609 ( 0.3895 ) 0.1127 Overall maximum convergence ratio: 0.2373 Total of 569 iteration steps. > (myeff <- set_effect(myeff, list(recip, inPop))) effectNumber effectName shortName include fix test initialValue 1 14 reciprocity recip TRUE FALSE FALSE 0 2 77 indegree - popularity inPop TRUE FALSE FALSE 0 parm 1 0 2 0 effectName include fix test initialValue parm 1 basic rate parameter mynet1 TRUE FALSE FALSE 4.80941 0 2 outdegree (density) TRUE FALSE FALSE -0.56039 0 3 reciprocity TRUE FALSE FALSE 0.00000 0 4 indegree - popularity TRUE FALSE FALSE 0.00000 0 > (myeff <- set_effect(myeff, outAct, fix=TRUE, test=TRUE)) effectNumber effectName shortName include fix test initialValue 1 114 outdegree - activity outAct TRUE TRUE TRUE 0 parm 1 0 effectName include fix test initialValue parm 1 basic rate parameter mynet1 TRUE FALSE FALSE 4.80941 0 2 outdegree (density) TRUE FALSE FALSE -0.56039 0 3 reciprocity TRUE FALSE FALSE 0.00000 0 4 indegree - popularity TRUE FALSE FALSE 0.00000 0 5 outdegree - activity TRUE TRUE TRUE 0.00000 0 > (myeff <- set_interaction(myeff, list(recip, inPop), fix=TRUE, test=TRUE)) effectNumber effectName shortName include fix 1 14 reciprocity recip TRUE FALSE 2 77 indegree - popularity inPop TRUE FALSE 3 261 reciprocity x indegree - popularity unspInt TRUE TRUE test initialValue parm effect1 effect2 1 FALSE 0 0 0 0 2 FALSE 0 0 0 0 3 TRUE 0 0 14 77 effectName include fix test initialValue parm 1 basic rate parameter mynet1 TRUE FALSE FALSE 4.80941 0 2 outdegree (density) TRUE FALSE FALSE -0.56039 0 3 reciprocity TRUE FALSE FALSE 0.00000 0 4 indegree - popularity TRUE FALSE FALSE 0.00000 0 5 outdegree - activity TRUE TRUE TRUE 0.00000 0 6 reciprocity x indegree - popularity TRUE TRUE TRUE 0.00000 0 effect1 effect2 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 14 77 > alg_alg <- set_algorithm_saom(cond=FALSE, seed=5, n3=50, nsub=2) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg, returnDeps=TRUE) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 3.0683 ( 0.3886 ) 0.1642 2. eval outdegree (density) -1.4748 ( 0.4529 ) 0.1099 3. eval reciprocity 1.8375 ( 0.4070 ) 0.1469 4. eval indegree - popularity 0.0560 ( 0.0697 ) 0.1278 5. eval outdegree - activity 0.0000 ( NA ) -0.6803 6. eval reciprocity x indegree - popularity 0.0000 ( NA ) 0.5085 Overall maximum convergence ratio: 0.2187 Score test for 2 parameters: chi-squared = 10.01, p = 0.0067. Total of 382 iteration steps. > test_parameter(ans, method='score') Tested effects: outdegree - activity eval reciprocity x indegree - popularity eval chi-squared = 10.01, d.f. = 2; two-sided p = 0.007. > (goft <- test_gof(ans, IndegreeDistribution, verbose=TRUE, varName="mynet1", + test=NULL)) Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations Estimating test statistic for model including outdegree - activity Estimating test statistic for model including reciprocity x indegree - popularity Siena Goodness of Fit ( IndegreeDistribution ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 1 ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 3.21 ) for current model. > summary(goft) Siena Goodness of Fit ( IndegreeDistribution ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 1 ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 3.21 ) for current model. One-step estimates and predicted Mahalanobis distances for modified models. **Model including outdegree - activity one-step basic rate parameter mynet1 3.211 outdegree (density) -3.160 reciprocity 2.751 indegree - popularity -0.020 outdegree - activity 0.158 reciprocity x indegree - popularity 0.000 MHD 4.995 **Model including reciprocity x indegree - popularity one-step basic rate parameter mynet1 3.565 outdegree (density) -3.768 reciprocity 7.759 indegree - popularity 0.416 outdegree - activity 0.000 reciprocity x indegree - popularity -0.945 MHD -0.801 -----> ##test6 > mynet1 <- as_dependent_rsiena(array(c(tmp3,tmp4),dim=c(32,32,2))) > mydata <- make_data_rsiena(mynet1) > myeff<- make_specification(mydata) > print('test6') [1] "test6" > alg_alg <- set_algorithm_saom(cond=FALSE, seed=5, n3=50, nsub=2) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 3.0805 ( 0.6084 ) -0.1454 2. eval outdegree (density) -1.1473 ( 0.1609 ) -0.0251 3. eval reciprocity 1.7609 ( 0.3895 ) 0.1127 Overall maximum convergence ratio: 0.2373 Total of 569 iteration steps. > myeff <- set_effect(myeff, recip, include=FALSE) effectNumber effectName shortName include fix test initialValue parm 1 14 reciprocity recip FALSE FALSE FALSE 0 0 > myeff <- set_effect(myeff, recip, type="endow") effectNumber effectName shortName include fix test initialValue parm 1 15 reciprocity recip TRUE FALSE FALSE 0 0 type 1 endow > myeff <- set_effect(myeff, recip, type="creation") effectNumber effectName shortName include fix test initialValue parm 1 16 reciprocity recip TRUE FALSE FALSE 0 0 type 1 creation > alg_alg <- set_algorithm_saom(cond=FALSE, seed=5, n3=50, nsub=2) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 3.1863 ( 1.0020 ) -0.2689 2. eval outdegree (density) -1.1153 ( 0.2082 ) 0.0224 3. endow reciprocity 2.4674 ( 0.8198 ) -0.0121 4. creat reciprocity 0.9547 ( 0.7225 ) -0.1711 Overall maximum convergence ratio: 0.3736 Total of 595 iteration steps. > test_parameter(ans, method='same', tested=3, tested2=4) Tested effects: reciprocity endow == reciprocity creation chi-squared = 1.79, d.f. = 1; standard error of linear combination = 1.13; one-sided Z = 1.34; two-sided p = 0.181. > ##test7 > mynet1 <- as_dependent_rsiena(array(c(tmp3,tmp4),dim=c(32,32,2))) > mydata <- make_data_rsiena(mynet1) > myeff<- make_specification(mydata) > print('test7') [1] "test7" > alg_alg <- set_algorithm_saom(cond=FALSE, seed=5, n3=50, nsub=2, + diagonalize=0.5) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 3.0537 ( 1.1043 ) 0.1719 2. eval outdegree (density) -1.1479 ( 0.2592 ) -0.1018 3. eval reciprocity 1.7860 ( 0.3821 ) 0.0983 Overall maximum convergence ratio: 0.2958 Total of 537 iteration steps. > ##test8 > print('test8') [1] "test8" > alg_alg <- set_algorithm_saom(cond=TRUE, condvarno=1, seed=5, n3=50, nsub=1) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 3.1232 ( 0.5758 ) Other parameters: 1. eval outdegree (density) -1.1569 ( 0.1554 ) 0.1198 2. eval reciprocity 1.8304 ( 0.4047 ) 0.1841 Overall maximum convergence ratio: 0.1881 Total of 322 iteration steps. > ##test9 > mynet1 <- as_dependent_rsiena(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mynet2 <- as_dependent_rsiena(s50a,type='behavior') > mydata <- make_data_rsiena(mynet1, mynet2) > myeff <- make_specification(mydata) > myeff <- set_effect(myeff, linear, depvar="mynet2", initialValue=0.34699930338) effectNumber effectName shortName include fix test initialValue 1 501 mynet2 linear shape linear TRUE FALSE FALSE 0.347 parm 1 0 > myeff <- set_effect(myeff, avAlt, depvar="mynet2", covar1="mynet1") effectNumber effectName shortName include fix test initialValue 1 590 mynet2 average alter avAlt TRUE FALSE FALSE 0 parm 1 0 > ##test10 > print('test10') [1] "test10" > alg_alg <- set_algorithm_saom(cond=TRUE, condvarno=1, seed=5, n3=50, nsub=1) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > alg_alg2 <- set_algorithm_saom(cond=TRUE, condvarno=1, seed=5, n3=50, nsub=1, + splitDepvars=1) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg2) > ##, verbose=TRUE) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0.1 Rate parameter cond. variable period 1 5.8715 ( 0.9109 ) 0.2 Rate parameter cond. variable period 2 4.6876 ( 0.6945 ) Other parameters: Network Dynamics 1. eval outdegree (density) -2.3814 ( 0.1861 ) -0.0899 2. eval reciprocity 2.8547 ( 0.2796 ) -0.1773 Behavior Dynamics 3. rate rate mynet2 (period 1) 1.2908 ( 0.4995 ) 0.0651 4. rate rate mynet2 (period 2) 1.8263 ( 1.1275 ) 0.2198 5. eval mynet2 linear shape 0.4162 ( 0.3652 ) 0.0275 6. eval mynet2 quadratic shape -0.5562 ( 0.4516 ) -0.1204 7. eval mynet2 average alter 1.2961 ( 1.1875 ) -0.0742 Overall maximum convergence ratio: 0.4851 Total of 335 iteration steps. > ##test11 > print('test11') [1] "test11" > alg_model <- set_model_saom(behModelType=c(mynet2=2)) > alg_alg <- set_algorithm_saom(seed=6, n3=50, nsub=1) > (ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_model=alg_model, control_algo=alg_alg)) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Network Dynamics 1. rate constant mynet1 rate (period 1) 5.8862 ( 1.7412 ) -0.0875 2. rate constant mynet1 rate (period 2) 4.5183 ( 1.2772 ) 0.1575 3. eval outdegree (density) -2.3671 ( 0.1068 ) -0.0348 4. eval reciprocity 2.8201 ( 0.2726 ) 0.0175 Behavior Dynamics 5. rate rate mynet2 (period 1) 1.3051 ( 0.7125 ) -0.1583 6. rate rate mynet2 (period 2) 1.7674 ( 0.6500 ) -0.0774 7. eval mynet2 linear shape 0.3716 ( 0.3944 ) -0.0150 8. eval mynet2 quadratic shape -0.5753 ( 0.4137 ) -0.0412 9. eval mynet2 average alter 1.2104 ( 0.9551 ) 0.0625 Overall maximum convergence ratio: 0.3450 Behavioral Model Type: mynet2 : Boundary-absorbing behavior model Total of 340 iteration steps. > ##test12 > print('test12') [1] "test12" > use<- 1:30 > mynet1 <- as_dependent_rsiena(array(c(s501[use,], s502[use,], s503[use,]), + dim=c(length(use), 50,3)), type='bipartite', + nodeSet=c('Senders','receivers')) > receivers <- as_nodeset_rsiena(50,'receivers') > senders <- as_nodeset_rsiena(30,'Senders') > myvar1 <- as_covariate_rsiena(s50a[1:30,2], nodeSet='Senders') > mydata <- make_data_rsiena(mynet1, myvar1, nodeSets=list(senders, receivers)) > myeff <- make_specification(mydata) > myeff <- set_effect(myeff, inPop) effectNumber effectName shortName include fix test initialValue 1 18 indegree - popularity inPop TRUE FALSE FALSE 0 parm 1 0 > myeff <- set_effect(myeff, altInDist2, covar1="myvar1", parameter=1) effectNumber effectName shortName include fix test 1 119 myvar1 in-alter dist 2 altInDist2 TRUE FALSE FALSE initialValue parm 1 0 1 > alg_alg <- set_algorithm_saom(seed=1, n3=50, nsub=2) > ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0.1 Rate parameter period 1 3.6956 ( 0.5378 ) 0.2 Rate parameter period 2 2.8639 ( 0.5543 ) Other parameters: 1. eval outdegree (density) 2.5056 ( 2.1342 ) 0.5304 2. eval indegree - popularity -3.3120 ( 1.1266 ) 0.6913 3. eval myvar1 in-alter dist 2 31.4680 ( 11.4585 ) -2.1940 Overall maximum convergence ratio: 6.1667 Total of 588 iteration steps. > tt <- test_time(ans) > summary(tt) Joint significance test of time heterogeneity: chi-squared = 12.47, d.f. = 3, p= 0.0059, where H0: The following parameters are zero: (1) (*)Dummy2:outdegree (density) (2) (*)Dummy2:indegree - popularity (3) (*)Dummy2:myvar1 in-alter dist 2 Individual significance tests and one-step estimators: Initial Est. One Step Est. p-Value outdegree (density) 2.5056 -24.8109 0.2400 indegree - popularity -3.3120 26.6232 0.0030 myvar1 in-alter dist 2 31.4680 -290.8078 0.0060 (*)Dummy2:outdegree (density) 0.0000 43.0380 0.2480 (*)Dummy2:indegree - popularity 0.0000 -39.2011 0.5460 (*)Dummy2:myvar1 in-alter dist 2 0.0000 379.2771 0.0760 Effect-wise joint significance tests (i.e. each effect across all dummies): chi-sq. df p-value outdegree (density) 1.33 1 0.249 indegree - popularity 0.37 1 0.543 myvar1 in-alter dist 2 3.14 1 0.076 Period-wise joint significance tests (i.e. each period across all parameters): chi-sq. df p-value Period 1 12.47 3 0.006 Period 2 12.47 3 0.006 Use the following indices for plotting: (1) outdegree (density) (2) indegree - popularity (3) myvar1 in-alter dist 2 If you would like to fit time dummies to your model, use the includeTimeDummy function. Type "?test_time" for more information on this output. > ##test13 > print('test13') [1] "test13" > use<- 1:30 > mynet1 <- as_dependent_rsiena(array(c(s502[,use], s503[,use]), + dim=c(50, length(use), 2)), type='bipartite', + nodeSet=c('Senders','receivers')) > receivers <- as_nodeset_rsiena(30,'receivers') > senders <- as_nodeset_rsiena(50,'Senders') > myvar1 <- as_covariate_rsiena(s50a[1:50,2], nodeSet='Senders') > mydata <- make_data_rsiena(mynet1, myvar1, nodeSets=list(senders, receivers)) > myeff <- make_specification(mydata) > myeff <- set_effect(myeff, altInDist2, covar1="myvar1", parameter=1) effectNumber effectName shortName include fix test 1 118 myvar1 in-alter dist 2 altInDist2 TRUE FALSE FALSE initialValue parm 1 0 1 > myeff <- set_effect(myeff, egoX, covar1="myvar1") effectNumber effectName shortName include fix test initialValue parm 1 97 myvar1 ego egoX TRUE FALSE FALSE 0 0 > alg_alg <- set_algorithm_saom(seed=1, n3=50, nsub=2) > (ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 1.9481 ( 0.3096 ) Other parameters: 1. eval outdegree (density) -1.8277 ( 0.2233 ) -0.1497 2. eval myvar1 ego 0.2986 ( 0.1972 ) -0.0027 3. eval myvar1 in-alter dist 2 -0.0209 ( 0.3079 ) 0.0945 Overall maximum convergence ratio: 0.3041 Total of 535 iteration steps. > ##test14 > print('test14') [1] "test14" > net <- as_dependent_rsiena(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > dataset <- make_data_rsiena(net) > myeff <- make_specification(dataset) > myeff <- set_effect(myeff, inPop) effectNumber effectName shortName include fix test initialValue 1 77 indegree - popularity inPop TRUE FALSE FALSE 0 parm 1 0 > alg_alg <- set_algorithm_saom(maxlike=TRUE, cond=FALSE, seed=15, n3=20, nsub=1, + diagonalize=0, mult=1) > (ans <- siena(data=dataset, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) Estimated by Maximum Likelihood Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter net 3.7816 ( 0.4178 ) 0.6167 2. eval outdegree (density) -1.5840 ( 0.3353 ) 2.9602 3. eval reciprocity 1.8606 ( 0.2314 ) 1.4786 4. eval indegree - popularity 0.1082 ( 0.0440 ) 2.5318 Overall maximum convergence ratio: 4.7198 Total of 266 iteration steps. > ##test 15 > print('test15') [1] "test15" > mynet1 <- as_dependent_rsiena(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mynet2 <- as_dependent_rsiena(s50a,type='behavior') > mydata <- make_data_rsiena(mynet1, mynet2) > myeff <- make_specification(mydata) > (myeff <- set_effect(myeff, transTrip)) effectNumber effectName shortName include fix test initialValue 1 22 transitive triplets transTrip TRUE FALSE FALSE 0 parm 1 0 name effectName include fix test initialValue parm 1 mynet1 constant mynet1 rate (period 1) TRUE FALSE FALSE 4.69604 0 2 mynet1 constant mynet1 rate (period 2) TRUE FALSE FALSE 4.32885 0 3 mynet1 outdegree (density) TRUE FALSE FALSE -1.46770 0 4 mynet1 reciprocity TRUE FALSE FALSE 0.00000 0 5 mynet1 transitive triplets TRUE FALSE FALSE 0.00000 0 6 mynet2 rate mynet2 (period 1) TRUE FALSE FALSE 0.70571 0 7 mynet2 rate mynet2 (period 2) TRUE FALSE FALSE 0.84939 0 8 mynet2 mynet2 linear shape TRUE FALSE FALSE 0.32237 0 9 mynet2 mynet2 quadratic shape TRUE FALSE FALSE 0.00000 0 > (myeff <- set_effect(myeff, list(egoX, simX), covar1="mynet2")) effectNumber effectName shortName include fix test initialValue 1 278 mynet2 ego egoX TRUE FALSE FALSE 0 2 324 mynet2 similarity simX TRUE FALSE FALSE 0 parm 1 0 2 0 name effectName include fix test initialValue parm 1 mynet1 constant mynet1 rate (period 1) TRUE FALSE FALSE 4.69604 0 2 mynet1 constant mynet1 rate (period 2) TRUE FALSE FALSE 4.32885 0 3 mynet1 outdegree (density) TRUE FALSE FALSE -1.46770 0 4 mynet1 reciprocity TRUE FALSE FALSE 0.00000 0 5 mynet1 transitive triplets TRUE FALSE FALSE 0.00000 0 6 mynet1 mynet2 ego TRUE FALSE FALSE 0.00000 0 7 mynet1 mynet2 similarity TRUE FALSE FALSE 0.00000 0 8 mynet2 rate mynet2 (period 1) TRUE FALSE FALSE 0.70571 0 9 mynet2 rate mynet2 (period 2) TRUE FALSE FALSE 0.84939 0 10 mynet2 mynet2 linear shape TRUE FALSE FALSE 0.32237 0 11 mynet2 mynet2 quadratic shape TRUE FALSE FALSE 0.00000 0 > (myeff <- set_effect(myeff, avSim, depvar="mynet2", covar1="mynet1")) effectNumber effectName shortName include fix test 1 534 mynet2 average similarity avSim TRUE FALSE FALSE initialValue parm 1 0 0 name effectName include fix test initialValue parm 1 mynet1 constant mynet1 rate (period 1) TRUE FALSE FALSE 4.69604 0 2 mynet1 constant mynet1 rate (period 2) TRUE FALSE FALSE 4.32885 0 3 mynet1 outdegree (density) TRUE FALSE FALSE -1.46770 0 4 mynet1 reciprocity TRUE FALSE FALSE 0.00000 0 5 mynet1 transitive triplets TRUE FALSE FALSE 0.00000 0 6 mynet1 mynet2 ego TRUE FALSE FALSE 0.00000 0 7 mynet1 mynet2 similarity TRUE FALSE FALSE 0.00000 0 8 mynet2 rate mynet2 (period 1) TRUE FALSE FALSE 0.70571 0 9 mynet2 rate mynet2 (period 2) TRUE FALSE FALSE 0.84939 0 10 mynet2 mynet2 linear shape TRUE FALSE FALSE 0.32237 0 11 mynet2 mynet2 quadratic shape TRUE FALSE FALSE 0.00000 0 12 mynet2 mynet2 average similarity TRUE FALSE FALSE 0.00000 0 > (myeff <- includeGMoMStatistics(myeff, simX_gmm, covar1="mynet2")) name shortName type include 1 mynet1 simX_gmm gmm TRUE Effects and statistics for estimation by the Generalized Method of Moments Effects name effectName include fix test initialValue parm 1 mynet1 constant mynet1 rate (period 1) TRUE FALSE FALSE 4.69604 0 2 mynet1 constant mynet1 rate (period 2) TRUE FALSE FALSE 4.32885 0 3 mynet1 outdegree (density) TRUE FALSE FALSE -1.46770 0 4 mynet1 reciprocity TRUE FALSE FALSE 0.00000 0 5 mynet1 transitive triplets TRUE FALSE FALSE 0.00000 0 6 mynet1 mynet2 ego TRUE FALSE FALSE 0.00000 0 7 mynet1 mynet2 similarity TRUE FALSE FALSE 0.00000 0 8 mynet2 rate mynet2 (period 1) TRUE FALSE FALSE 0.70571 0 9 mynet2 rate mynet2 (period 2) TRUE FALSE FALSE 0.84939 0 10 mynet2 mynet2 linear shape TRUE FALSE FALSE 0.32237 0 11 mynet2 mynet2 quadratic shape TRUE FALSE FALSE 0.00000 0 12 mynet2 mynet2 average similarity TRUE FALSE FALSE 0.00000 0 type 1 rate 2 rate 3 eval 4 eval 5 eval 6 eval 7 eval 8 rate 9 rate 10 eval 11 eval 12 eval Regular and GMoM statistics name effectName Statistic 1 mynet1 constant mynet1 rate (period 1) Regular 2 mynet1 constant mynet1 rate (period 2) Regular 3 mynet1 outdegree (density) Regular 4 mynet1 reciprocity Regular 5 mynet1 transitive triplets Regular 6 mynet1 mynet2 ego Regular 7 mynet1 mynet2 similarity Regular 8 mynet2 rate mynet2 (period 1) Regular 9 mynet2 rate mynet2 (period 2) Regular 10 mynet2 mynet2 linear shape Regular 11 mynet2 mynet2 quadratic shape Regular 12 mynet2 mynet2 average similarity Regular 13 mynet1 mynet2 similarity GMoM > alg_alg <- set_algorithm_saom(gmm=TRUE, seed=6, n3=100, nsub=1) > (ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) Estimated by Generalized Method of Moments Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Network Dynamics 1. rate constant mynet1 rate (period 1) 5.5632 ( 1.2970 ) -1.0930 2. rate constant mynet1 rate (period 2) 4.3687 ( 0.6412 ) -1.6447 3. eval outdegree (density) -2.5981 ( 0.1535 ) 1.1781 4. eval reciprocity 2.6870 ( 0.2324 ) 1.8862 5. eval transitive triplets 0.3907 ( 0.0737 ) -2.3790 6. eval mynet2 ego 0.0371 ( 0.0979 ) 0.6639 7. eval mynet2 similarity 1.1255 ( 0.4169 ) 1.5314 Behavior Dynamics 8. rate rate mynet2 (period 1) 1.1603 ( 0.4551 ) 0.1277 9. rate rate mynet2 (period 2) 1.6443 ( 0.4689 ) 0.1219 10. eval mynet2 linear shape 0.4098 ( 0.1531 ) 0.4140 11. eval mynet2 quadratic shape -0.1597 ( 0.1557 ) 0.4469 12. eval mynet2 average similarity 0.7157 ( 2.2581 ) -0.6514 Overall maximum convergence ratio: 5.3403 Total of 605 iteration steps. > ##test16 > print('test16') [1] "test16" > set.seed(123) # simulate behavior data according to dZ(t) = [-0.1 Z + 1] dt + 1 dW(t) > y1 <- rnorm(50, 0,3) > y2 <- exp(-0.1) * y1 + (1-exp(-0.1)) * 1/ -0.1 + rnorm(50, 0, (exp(-0.2)- 1) / -0.2 * 1^2) > friend <- as_dependent_rsiena(array(c(s501, s502), dim = c(50,50,2))) > behavior <- as_dependent_rsiena(matrix(c(y1,y2), 50,2), type = "continuous") > (mydata <- make_data_rsiena(friend, behavior)) Dependent variables: friend, behavior Number of observations: 2 Nodeset Actors Number of nodes 50 Dependent variable friend Type oneMode Observations 2 Nodeset Actors Densities 0.046 0.047 Dependent variable behavior Type continuous Observations 2 Nodeset Actors Range -6.242 - 6.507 > (myeff <- make_specification(mydata, onePeriodSde = TRUE)) SDE init parameters: -0.1117176 -0.864023 0.8576913 SDE par stand errors: 0.04669358 0.1223113 0.08791327 name effectName include fix test initialValue parm 1 friend basic rate parameter friend TRUE FALSE FALSE 4.69604 0 2 friend outdegree (density) TRUE FALSE FALSE -1.48852 0 3 friend reciprocity TRUE FALSE FALSE 0.00000 0 4 sde scale parameter period 1 TRUE TRUE FALSE 1.00000 0 5 behavior wiener (behavior.behavior) TRUE FALSE FALSE 0.85769 0 6 behavior feedback from behavior TRUE FALSE FALSE -0.11172 0 7 behavior intercept TRUE FALSE FALSE -0.86402 0 > alg_alg <- set_algorithm_saom(seed=321, n3=20, nsub=1) > (ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) SDE init parameters: -0.1117176 -0.864023 0.8576913 SDE par stand errors: 0.04669358 0.1223113 0.08791327 Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Network Dynamics 1. rate basic rate parameter friend 5.5455 ( 1.3505 ) 0.1743 2. eval outdegree (density) -2.2776 ( 0.1270 ) -0.2121 3. eval reciprocity 2.4902 ( 0.2396 ) -0.1214 Continuous Behavior Dynamics 4. eval wiener (behavior.behavior) 0.8424 ( 0.0167 ) -0.2656 5. eval feedback from behavior -0.1108 ( 0.0941 ) 0.1166 6. eval intercept -0.8651 ( 0.1500 ) 0.2041 7. rate scale parameter period 1 1.0000 ( NA ) -0.2656 Overall maximum convergence ratio: 0.5077 Total of 305 iteration steps. > ##test17 > print('test17') [1] "test17" > mynet <- sienaNet(array(c(s501, s502), dim=c(50, 50, 2))) > sm1 <- 1*(s50s[,2] >= 2) > sm2 <- 1*(s50s[,3] >= 2) > sm2 <- pmax(sm1,sm2) > sm2[c(33,28,29,44)] <- 1 > mybeh <- as_dependent_rsiena(cbind(sm1,sm2), type="behavior") > (mydata <- make_data_rsiena(mynet, mybeh)) For dependent variable mybeh, in some periods, there are only increases, or only decreases. This will be respected in the simulations. If this is not desired, use allowOnly=FALSE when creating the dependent variable. Dependent variables: mynet, mybeh Number of observations: 2 Nodeset Actors Number of nodes 50 Dependent variable mynet Type oneMode Observations 2 Nodeset Actors Densities 0.046 0.047 Dependent variable mybeh Type behavior Observations 2 Nodeset Actors Range 0 - 1 "uponly": mybeh: all periods > myeff <- make_specification(mydata) > (myeff <- set_effect(myeff, avExposure, type="rate", depvar="mybeh", + covar1="mynet", parameter=2)) effectNumber effectName shortName include fix 1 489 average exposure effect on rate mybeh avExposure TRUE FALSE test initialValue parm 1 FALSE 0 2 name effectName include fix test initialValue 1 mynet basic rate parameter mynet TRUE FALSE FALSE 4.69604 2 mynet outdegree (density) TRUE FALSE FALSE -1.48852 3 mynet reciprocity TRUE FALSE FALSE 0.00000 4 mybeh rate mybeh period 1 TRUE FALSE FALSE 0.26000 5 mybeh average exposure effect on rate mybeh TRUE FALSE FALSE 0.00000 parm 1 0 2 0 3 0 4 0 5 2 > alg_alg <- set_algorithm_saom(seed=1234, n3=10, nsub=1, firstg=0.001) > (ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Network Dynamics 1. rate basic rate parameter mynet 5.0343 ( 2.6745 ) 2.9531 2. eval outdegree (density) -1.5767 ( 0.2534 ) 2.3103 3. eval reciprocity 0.4645 ( 0.5094 ) -6.9043 Behavior Dynamics 4. rate rate mybeh period 1 0.3748 ( 1.5645 ) -1.2179 5. rate average exposure effect on rate mybeh 0.4451 ( 0.3627 ) -3.4187 Overall maximum convergence ratio: 17.2538 Total of 290 iteration steps. > ##test18 > print('test18') [1] "test18" > mynet1 <- as_dependent_rsiena(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > cova <- as_covariate_rsiena(1:32) > cova2 <- as_covariate_rsiena(rep(0,32), warn=FALSE) > mydata <- make_data_rsiena(mynet1, cova) > mydata2 <- make_data_rsiena(mynet1, cova=cova2) > mygroup <- make_group_rsiena(list(mydata,mydata2)) > myeff <- make_specification(mygroup) > myeff <- set_effect(myeff, simX, covar1="cova") effectNumber effectName shortName include fix test initialValue parm 1 324 cova similarity simX TRUE FALSE FALSE 0 0 > alg_alg <- set_algorithm_saom(seed=1293, n3=10, nsub=1) > (ans <- siena(data=mygroup, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0.1 Rate parameter period 1 2.9223 ( 0.3564 ) 0.2 Rate parameter period 2 3.4189 ( 0.4703 ) Other parameters: 1. eval outdegree (density) -1.1282 ( 0.2481 ) 0.1531 2. eval reciprocity 1.8043 ( 0.5071 ) 0.1914 3. eval cova similarity -0.0338 ( 0.2107 ) 0.1075 Overall maximum convergence ratio: 0.2479 Total of 285 iteration steps. > ##test19 > print('test19') [1] "test19" > mynet <- as_dependent_rsiena(array(c(s501, s502), dim=c(50, 50, 2))) > alc <- as_covariate_rsiena(s50a[,1]) > smoke <- as_covariate_rsiena(s50s[,1]) > mydata <- make_data_rsiena(mynet, alc, smoke) > myeff <- make_specification(mydata) > myeff <- set_effect(myeff, gwespFF) effectNumber effectName shortName include fix test 1 55 GWESP I -> K -> J (69) gwespFF TRUE FALSE FALSE initialValue parm 1 0 69 > myeff <- set_effect(myeff, gwespFF, parameter=20) effectNumber effectName shortName include fix test 1 55 GWESP I -> K -> J (20) gwespFF TRUE FALSE FALSE initialValue parm 1 0 20 > myeff <- set_effect(myeff, outTrunc, parameter=2, include=FALSE) effectNumber effectName shortName include fix test initialValue 1 132 outdegree-trunc(2) outTrunc FALSE FALSE FALSE 0 parm 1 2 > myeff <- set_interaction(myeff, list(outTrunc, egoX, egoX), covar1=c("", + "smoke", "alc")) effectNumber effectName shortName include fix 1 132 outdegree-trunc(2) outTrunc FALSE FALSE 2 278 alc ego egoX FALSE FALSE 3 462 smoke ego egoX FALSE FALSE 4 631 smoke ego x alc ego x outdegree-trunc(2) unspInt TRUE FALSE test initialValue parm effect1 effect2 effect3 1 FALSE 0 2 0 0 0 2 FALSE 0 0 0 0 0 3 FALSE 0 0 0 0 0 4 FALSE 0 0 132 462 278 > alg_alg <- set_algorithm_saom(seed=1943, n3=20, nsub=1) > (ans <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 6.3459 ( 1.1706 ) Other parameters: 1. eval outdegree (density) -2.8004 ( 0.2537 ) -0.3334 2. eval reciprocity 2.2810 ( 0.4770 ) -0.2645 3. eval GWESP I -> K -> J (20) 1.7122 ( 0.5923 ) -0.3894 4. eval smoke ego x alc ego x outdegree-trunc(2) 0.5763 ( 0.5052 ) -0.1619 Overall maximum convergence ratio: 0.5173 Total of 297 iteration steps. > ##test20 > print('test20') [1] "test20" > mynet1 <- as_dependent_rsiena(array(c(s501, s502), dim=c(50, 50, 2))) > mynet2 <- as_dependent_rsiena(array(c(s503, s502), dim=c(50, 50, 2))) > mydata <- make_data_rsiena(mynet1, mynet2) > myeff <- make_specification(mydata) > myeff <- set_effect(myeff, crprod, depvar="mynet2", covar1="mynet1") effectNumber effectName shortName include fix test initialValue parm 1 754 mynet2: mynet1 crprod TRUE FALSE FALSE 0 0 > myeff <- set_effect(myeff, from, depvar="mynet1", covar1="mynet2") effectNumber effectName shortName include fix test 1 367 mynet1: from mynet2 agreement (0) from TRUE FALSE FALSE initialValue parm 1 0 0 > (myeff <- includeGMoMStatistics(myeff, from_gmm, depvar='mynet1', + covar1='mynet2')) name shortName type include 1 mynet1 from_gmm gmm TRUE Effects and statistics for estimation by the Generalized Method of Moments Effects name effectName include fix test initialValue 1 mynet1 basic rate parameter mynet1 TRUE FALSE FALSE 4.69604 2 mynet1 mynet1: outdegree (density) TRUE FALSE FALSE -1.48852 3 mynet1 mynet1: reciprocity TRUE FALSE FALSE 0.00000 4 mynet1 mynet1: from mynet2 agreement (0) TRUE FALSE FALSE 0.00000 5 mynet2 basic rate parameter mynet2 TRUE FALSE FALSE 4.32885 6 mynet2 mynet2: outdegree (density) TRUE FALSE FALSE -1.53104 7 mynet2 mynet2: reciprocity TRUE FALSE FALSE 0.00000 8 mynet2 mynet2: mynet1 TRUE FALSE FALSE 0.00000 parm type 1 0 rate 2 0 eval 3 0 eval 4 0 eval 5 0 rate 6 0 eval 7 0 eval 8 0 eval Regular and GMoM statistics name effectName Statistic 1 mynet1 basic rate parameter mynet1 Regular 2 mynet1 mynet1: outdegree (density) Regular 3 mynet1 mynet1: reciprocity Regular 4 mynet1 mynet1: from mynet2 agreement (0) Regular 5 mynet2 basic rate parameter mynet2 Regular 6 mynet2 mynet2: outdegree (density) Regular 7 mynet2 mynet2: reciprocity Regular 8 mynet2 mynet2: mynet1 Regular 9 mynet1 mynet1: from mynet2 agreement (#) GMoM > alg_alg <- set_algorithm_saom(seed=1293, n3=50, nsub=2) > (ans <- siena(data=mydata, effects=myeff[myeff$type != "gmm", ], batch=TRUE, + silent=TRUE, control_algo=alg_alg)) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 5.5596 ( 2.5822 ) 0.0653 2. eval mynet1: outdegree (density) -2.5572 ( 0.2501 ) 0.0435 3. eval mynet1: reciprocity 2.0302 ( 0.8754 ) 0.1185 4. eval mynet1: from mynet2 agreement (0) 1.3237 ( 0.2420 ) 0.0714 5. rate basic rate parameter mynet2 4.6888 ( 2.8648 ) 0.0094 6. eval mynet2: outdegree (density) -2.8217 ( 0.3759 ) 0.1110 7. eval mynet2: reciprocity 1.8266 ( 0.4459 ) 0.1225 8. eval mynet2: mynet1 3.2305 ( 0.5184 ) 0.0690 Overall maximum convergence ratio: 0.2416 Total of 593 iteration steps. > alg_alg <- set_algorithm_saom(gmm=TRUE, seed=1293, n3=50, nsub=2) > (ans1 <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + control_algo=alg_alg)) Estimated by Generalized Method of Moments Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 5.4255 ( 1.0817 ) -0.2549 2. eval mynet1: outdegree (density) -2.5970 ( 0.2717 ) 0.1179 3. eval mynet1: reciprocity 1.9354 ( 0.4496 ) 0.4581 4. eval mynet1: from mynet2 agreement (0) 1.4695 ( 0.2798 ) 0.5470 5. rate basic rate parameter mynet2 4.4444 ( 1.3604 ) -0.1299 6. eval mynet2: outdegree (density) -2.9751 ( 0.4063 ) -0.1273 7. eval mynet2: reciprocity 1.9088 ( 0.6160 ) 0.2121 8. eval mynet2: mynet1 3.5549 ( 0.8794 ) -0.0522 Overall maximum convergence ratio: 1.3483 Total of 405 iteration steps. > alg_alg <- set_algorithm_saom(gmm=TRUE, seed=1293, n3=50, nsub=2) > (ans2 <- siena(data=mydata, effects=myeff, batch=TRUE, silent=TRUE, + prevAns=ans1, control_algo=alg_alg)) Estimated by Generalized Method of Moments Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter mynet1 5.0506 ( 1.2471 ) 0.3424 2. eval mynet1: outdegree (density) -2.4559 ( 0.1976 ) 0.4815 3. eval mynet1: reciprocity 1.6352 ( 0.3341 ) -0.0907 4. eval mynet1: from mynet2 agreement (0) 1.4281 ( 0.3039 ) -0.1970 5. rate basic rate parameter mynet2 4.3001 ( 1.2688 ) -0.2889 6. eval mynet2: outdegree (density) -2.6547 ( 0.4704 ) 0.0031 7. eval mynet2: reciprocity 1.4674 ( 0.2944 ) -0.7729 8. eval mynet2: mynet1 3.2960 ( 0.9690 ) -0.3996 Overall maximum convergence ratio: 2.2389 Total of 590 iteration steps. > > ##test21 > # Run simple test model ---- > mynet <- as_dependent_rsiena(array(c(s501, s502, s503), dim = c(50, 50, 3))) > mydata <- make_data_rsiena(mynet) > mymodel <- make_specification(mydata) > ## TransitiveTriplets model > mymodel <- set_effect(mymodel, transTrip, depvar="mynet") effectNumber effectName shortName include fix test initialValue 1 21 transitive triplets transTrip TRUE FALSE FALSE 0 parm 1 0 > # Test returnChangeContributions when running siena directly ---- > > print('test21') [1] "test21" > alg_out <- set_output_saom(returnChangeContributions=TRUE) > alg_alg <- set_algorithm_saom(cond=FALSE, seed=42, n3=60, nsub=1) > ans <- siena(data=mydata, effects=mymodel, batch=TRUE, silent=TRUE, + control_algo=alg_alg, control_out=alg_out) > length(ans$changeContributions) # 60 as expected [1] 60 > head(ans$changeContributions[[1]][[1]][[1]]) [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 -1 1 1 1 1 0 -1 -1 1 1 1 [2,] 0 -1 0 0 0 0 0 -1 0 0 0 0 [3,] 0 -3 0 0 0 0 0 -2 -1 1 2 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 -1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 1 0 [3,] 0 0 1 0 0 0 -1 3 0 1 2 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 -1 0 1 1 1 1 -1 1 [2,] 0 0 0 0 -1 0 0 0 0 0 -1 0 [3,] 0 0 0 0 -2 0 0 3 0 0 -1 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[3]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 -1 1 -1 0 1 [2,] 0 0 0 0 0 0 0 -1 0 -1 0 0 [3,] 0 2 0 0 0 0 2 -1 0 -1 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[4]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 0 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 1 0 1 0 1 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 -1 1 1 1 1 1 1 [2,] 0 0 0 0 0 -1 0 0 0 0 0 0 [3,] 0 0 0 0 2 0 0 0 0 0 2 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[5]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 -1 1 1 0 1 [2,] 0 0 0 0 0 0 0 -1 0 1 0 0 [3,] 0 2 0 0 0 0 2 0 0 1 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[6]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 1 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 0 -1 1 1 1 1 1 1 1 [2,] 0 0 1 0 0 0 0 0 0 0 0 0 [3,] 0 0 1 0 0 0 0 0 0 2 0 1 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 -1 1 1 1 [2,] 0 0 0 0 0 0 0 0 -1 0 0 0 [3,] 0 0 0 1 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" > dim(ans$changeContributions[[1]][[1]][[1]][[1]]) # 3 x 50 as expected [1] 3 50 > > # Test returnChangeContributions when setting nsub = 0 and prevAns = ans, > #using batch mode > alg_out <- set_output_saom(returnChangeContributions=TRUE) > alg_alg <- set_algorithm_saom(cond=FALSE, seed=42, n3=60, nsub=1) > ans2 <- siena(data=mydata, effects=mymodel, batch=TRUE, prevAns=ans, + control_algo=alg_alg, control_out=alg_out) > length(ans$changeContributions) # 60 chains as expected [1] 60 > head(ans$changeContributions[[1]][[1]][[1]]) [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 -1 1 1 1 1 0 -1 -1 1 1 1 [2,] 0 -1 0 0 0 0 0 -1 0 0 0 0 [3,] 0 -3 0 0 0 0 0 -2 -1 1 2 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 -1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 1 0 [3,] 0 0 1 0 0 0 -1 3 0 1 2 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 -1 0 1 1 1 1 -1 1 [2,] 0 0 0 0 -1 0 0 0 0 0 -1 0 [3,] 0 0 0 0 -2 0 0 3 0 0 -1 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[3]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 -1 1 -1 0 1 [2,] 0 0 0 0 0 0 0 -1 0 -1 0 0 [3,] 0 2 0 0 0 0 2 -1 0 -1 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[4]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 0 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 1 0 1 0 1 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 -1 1 1 1 1 1 1 [2,] 0 0 0 0 0 -1 0 0 0 0 0 0 [3,] 0 0 0 0 2 0 0 0 0 0 2 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[5]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 -1 1 1 0 1 [2,] 0 0 0 0 0 0 0 -1 0 1 0 0 [3,] 0 2 0 0 0 0 2 0 0 1 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" [[6]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 1 0 0 0 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 1 1 1 0 -1 1 1 1 1 1 1 1 [2,] 0 0 1 0 0 0 0 0 0 0 0 0 [3,] 0 0 1 0 0 0 0 0 0 2 0 1 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [1,] 1 1 1 1 1 1 1 1 -1 1 1 1 [2,] 0 0 0 0 0 0 0 0 -1 0 0 0 [3,] 0 0 0 1 0 0 0 0 0 0 0 0 [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 1 1 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 0 0 attr(,"effectNames") [1] "density" "recip" "transTrip" attr(,"effectTypes") [1] "eval" "eval" "eval" attr(,"networkName") [1] "mynet" attr(,"networkType") [1] "oneMode" > ##test22 > # Test interpret_size_dynamics ---- > ## Unconditional Estimation ---- > ### Use changeContributions from ans ---- > print('test22') [1] "test22" > RIDynamics1 <- interpret_size_dynamics(data=mydata, + ans=ans, + useChangeContributions=TRUE, + intervalsPerPeriod=10) > RIDynamics1 Relative importance of effects in micro-steps of dependent variable 'mynet'. Periods between observations are divided into 10 intervals. Displayed results are aggregations over intervals: Period 1: int 1 int 2 int 3 int 4 int 5 1. eval outdegree (density) 0.4705 0.5033 0.5113 0.5328 0.5386 2. eval reciprocity 0.3707 0.3499 0.3502 0.3347 0.3307 3. eval transitive triplets 0.1588 0.1468 0.1386 0.1326 0.1307 int 6 int 7 int 8 int 9 int 10 1. eval outdegree (density) 0.5473 0.5573 0.5646 0.5636 0.5668 2. eval reciprocity 0.3257 0.3132 0.3059 0.3076 0.3005 3. eval transitive triplets 0.1270 0.1295 0.1295 0.1289 0.1327 Period 2: int 1 int 2 int 3 int 4 int 5 1. eval outdegree (density) 0.5161 0.5468 0.5436 0.5633 0.5574 2. eval reciprocity 0.3212 0.3076 0.3141 0.3018 0.3079 3. eval transitive triplets 0.1627 0.1455 0.1423 0.1349 0.1346 int 6 int 7 int 8 int 9 int 10 1. eval outdegree (density) 0.5779 0.5746 0.5763 0.5658 0.5808 2. eval reciprocity 0.2922 0.2971 0.2953 0.3024 0.2937 3. eval transitive triplets 0.1299 0.1284 0.1285 0.1317 0.1254 > ### Unconditional Estimation with model rerun > mycontrols2 <- sienaAlgorithmCreate(nsub=2, n3=60, cond=FALSE, seed = 84) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > mynet2 <- as_dependent_rsiena(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > mydata2 <- make_data_rsiena(mynet2) > mymodel2 <- make_specification(mydata2) > mymodel2 <- set_effect(mymodel2, list(density, recip, transTies)) effectNumber effectName shortName include fix test initialValue 1 11 outdegree (density) density TRUE FALSE FALSE -0.56039 2 14 reciprocity recip TRUE FALSE FALSE 0.00000 3 43 transitive ties transTies TRUE FALSE FALSE 0.00000 parm 1 0 2 0 3 0 > alg_alg <- set_algorithm_saom(cond=FALSE, seed=84, n3=60, nsub=2) > ans2 <- siena(data=mydata2, effects=mymodel2, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > RIDynamics2 <- interpret_size_dynamics(mydata2, ans=ans2) > RIDynamics2 Relative importance of effects in micro-steps of dependent variable 'mynet2'. Periods between observations are divided into 10 intervals. Displayed results are aggregations over intervals: Period 1: int 1 int 2 int 3 int 4 int 5 1. eval outdegree (density) 0.4117 0.4017 0.3978 0.3826 0.3863 2. eval reciprocity 0.2372 0.2324 0.2188 0.2228 0.2069 3. eval transitive ties 0.3295 0.3442 0.3618 0.3729 0.3851 int 6 int 7 int 8 int 9 int 10 1. eval outdegree (density) 0.3853 0.4056 0.3896 0.3743 0.3798 2. eval reciprocity 0.1936 0.1882 0.1897 0.1950 0.1876 3. eval transitive ties 0.3994 0.3845 0.3990 0.4090 0.4110 > ### Don't use ans but previously estimated coefficients ---- > RIDynamics3 <- interpret_size_dynamics(data=mydata2, theta=c(ans2$rate,ans2$theta), + algorithm=mycontrols2, effects=mymodel2, intervalsPerPeriod=10) > RIDynamics3 Relative importance of effects in micro-steps of dependent variable 'mynet2'. Periods between observations are divided into 10 intervals. Displayed results are aggregations over intervals: Period 1: int 1 int 2 int 3 int 4 int 5 1. eval outdegree (density) 0.4117 0.4017 0.3978 0.3826 0.3863 2. eval reciprocity 0.2372 0.2324 0.2188 0.2228 0.2069 3. eval transitive ties 0.3295 0.3442 0.3618 0.3729 0.3851 int 6 int 7 int 8 int 9 int 10 1. eval outdegree (density) 0.3853 0.4056 0.3896 0.3743 0.3798 2. eval reciprocity 0.1936 0.1882 0.1897 0.1950 0.1876 3. eval transitive ties 0.3994 0.3845 0.3990 0.4090 0.4110 > ## Conditional Estimation ---- > alg_alg <- set_algorithm_saom(cond=TRUE, condvarno=1, seed=4242, n3=60, nsub=2) > ans3 <- siena(data=mydata2, effects=mymodel2, batch=TRUE, silent=TRUE, + control_algo=alg_alg) > RIDynamics4 <- interpret_size_dynamics(mydata2, ans=ans3, effects = mymodel2) > RIDynamics4 Relative importance of effects in micro-steps of dependent variable 'mynet2'. Periods between observations are divided into 10 intervals. Displayed results are aggregations over intervals: Period 1: int 1 int 2 int 3 int 4 int 5 1. eval outdegree (density) 0.4002 0.3957 0.3974 0.3907 0.3949 2. eval reciprocity 0.2330 0.2196 0.2110 0.2029 0.1959 3. eval transitive ties 0.3352 0.3530 0.3599 0.3747 0.3775 int 6 int 7 int 8 int 9 int 10 1. eval outdegree (density) 0.3975 0.3807 0.3836 0.3722 0.3679 2. eval reciprocity 0.1896 0.1864 0.1853 0.1934 0.1889 3. eval transitive ties 0.3812 0.4012 0.3994 0.4027 0.4116 > ##test23 > ## Test interpret_size_dynamics with behavior variable ---- > mynet3 <- as_dependent_rsiena(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- as_dependent_rsiena(s50a, type="behavior") > mydata3 <- make_data_rsiena(mynet3, mybeh) > mymodel3 <- make_specification(mydata3) > mymodel3 <- set_effect(mymodel3, list(density, recip, transTies, transTrip)) effectNumber effectName shortName include fix test initialValue 1 13 outdegree (density) density TRUE FALSE FALSE -1.4677 2 16 reciprocity recip TRUE FALSE FALSE 0.0000 3 22 transitive triplets transTrip TRUE FALSE FALSE 0.0000 4 45 transitive ties transTies TRUE FALSE FALSE 0.0000 parm 1 0 2 0 3 0 4 0 > print('test23') [1] "test23" > alg_out <- set_output_saom(returnChangeContributions=TRUE) > alg_alg <- set_algorithm_saom(seed=8484, n3=60, nsub=2) > ans4 <- siena(data=mydata3, effects=mymodel3, batch=TRUE, silent=TRUE, + control_algo=alg_alg, control_out=alg_out) > length(ans4$changeContributions) # 60 chains as expected [1] 60 > length(ans4$changeContributions[[1]][[1]]) # 2 periods as expected [1] 2 > beh_steps <- sapply(ans4$changeContributions[[1]][[1]][[2]], + function(ministep) attr(ministep, "networkName")) %in% "mybeh" > any(beh_steps) # TRUE as expected [1] TRUE > ministeps <- ans4$changeContributions[[1]][[1]][[1]] > getDepvarName <- function(ministep) attr(ministep, "networkName") > beh_steps <- Filter(function(ministep) getDepvarName(ministep) == "mybeh", + ans4$changeContributions[[1]][[1]][[1]]) # 1st period, 1st group, 1st chain, behavior steps > RIDynamics5 <- interpret_size_dynamics(mydata3, ans=ans4, depvar="mybeh", + useChangeContributions=TRUE) > RIDynamics5 Relative importance of effects in micro-steps of dependent variable 'mybeh'. Periods between observations are divided into 10 intervals. Displayed results are aggregations over intervals: Period 1: int 1 int 2 int 3 int 4 int 5 1. eval mybeh linear shape 0.3252 0.3885 0.4204 0.4365 0.4429 2. eval mybeh quadratic shape 0.2865 0.3365 0.3579 0.3752 0.3837 int 6 int 7 int 8 int 9 int 10 1. eval mybeh linear shape 0.4588 0.4762 0.4847 0.4898 0.4943 2. eval mybeh quadratic shape 0.3879 0.3988 0.3987 0.4085 0.4124 Period 2: int 1 int 2 int 3 int 4 int 5 1. eval mybeh linear shape 0.4237 0.4856 0.5204 0.5258 0.5273 2. eval mybeh quadratic shape 0.3696 0.3994 0.4129 0.4376 0.4427 int 6 int 7 int 8 int 9 int 10 1. eval mybeh linear shape 0.5395 0.5441 0.5406 0.5496 0.5406 2. eval mybeh quadratic shape 0.4355 0.4393 0.4444 0.4404 0.4544 > net_steps <- Filter(function(ministep) getDepvarName(ministep) == "mynet3", + ans4$changeContributions[[1]][[1]][[1]]) # 1st period, 1st group, 1st chain, network steps > RIDynamics6 <- interpret_size_dynamics(mydata3, ans=ans4, depvar="mynet3") > RIDynamics6 Relative importance of effects in micro-steps of dependent variable 'mynet3'. Periods between observations are divided into 10 intervals. Displayed results are aggregations over intervals: Period 1: int 1 int 2 int 3 int 4 int 5 1. eval outdegree (density) 0.4638 0.4948 0.5201 0.5273 0.5468 2. eval reciprocity 0.3194 0.2992 0.2810 0.2813 0.2683 3. eval transitive triplets 0.0774 0.0741 0.0728 0.0708 0.0691 4. eval transitive ties 0.1395 0.1319 0.1260 0.1205 0.1157 int 6 int 7 int 8 int 9 int 10 1. eval outdegree (density) 0.5591 0.5578 0.5648 0.5555 0.5711 2. eval reciprocity 0.2615 0.2641 0.2589 0.2576 0.2490 3. eval transitive triplets 0.0677 0.0677 0.0681 0.0725 0.0714 4. eval transitive ties 0.1117 0.1104 0.1082 0.1144 0.1085 Period 2: int 1 int 2 int 3 int 4 int 5 1. eval outdegree (density) 0.5168 0.5428 0.5453 0.5636 0.5662 2. eval reciprocity 0.2792 0.2656 0.2687 0.2584 0.2579 3. eval transitive triplets 0.0790 0.0753 0.0728 0.0702 0.0696 4. eval transitive ties 0.1250 0.1163 0.1133 0.1078 0.1063 int 6 int 7 int 8 int 9 int 10 1. eval outdegree (density) 0.5730 0.5886 0.5691 0.5759 0.5784 2. eval reciprocity 0.2512 0.2438 0.2536 0.2484 0.2492 3. eval transitive triplets 0.0702 0.0673 0.0721 0.0710 0.0698 4. eval transitive ties 0.1056 0.1004 0.1051 0.1047 0.1026 > ##test24 > mynet1 <- as_dependent_rsiena(array(c(tmp3,tmp4),dim=c(32,32,2))) > mydata <- make_data_rsiena(mynet1) > myeff<- make_specification(mydata) > myeff <- set_effect(myeff, list(recip, inPop, outAct)) effectNumber effectName shortName include fix test initialValue 1 14 reciprocity recip TRUE FALSE FALSE 0 2 77 indegree - popularity inPop TRUE FALSE FALSE 0 3 114 outdegree - activity outAct TRUE FALSE FALSE 0 parm 1 0 2 0 3 0 > thv <- matrix(NA, 10, 5) > thv[,1] <- 3 +0.1*(1:10) > thv[,2] <- c(-2, -2.4, -2.3, -2.5, -2 + (1:6)*0.15) > thv[,3] <- rep(2, 10) > thv[,4] <- 0.02 * (1:10) > thv[,5] <- 0.02 * (10:1) > myalg <- set_algorithm_saom(nsub=2, n3=50, cond=FALSE, seed=5, simOnly=TRUE, + thetaValue=thv) > print('test24') [1] "test24" > (ans <- siena(mymodel, data=mydata, effects=myeff, control_algo=myalg, batch=TRUE, silent=TRUE)) Parameter values used for simulations Mean Standard value Deviation 1. rate basic rate parameter mynet1 3.910 ( 0.2234 ) 2. eval outdegree (density) -1.241 ( 0.3541 ) 3. eval reciprocity 2.000 ( 0.0000 ) 4. eval indegree - popularity 0.182 ( 0.0447 ) 5. eval outdegree - activity 0.038 ( 0.0447 ) Simulated means and standard deviations 1. Amount of network change 81.080 10.038 2. Number of ties 195.920 10.785 3. Number of reciprocated ties 90.240 8.625 4. Sum of squared indegrees 1508.600 209.350 5. Sum of squared outdegrees 2142.840 208.244 Simulated statistics are in x$sf, where x is the created object. Total of 605 iteration steps. > ## delete output files > if (file.exists('mydata_out.txt')){unlink('mydata_out.txt')} > > proc.time() user system elapsed 99.93 3.31 103.28