==2826240== Memcheck, a memory error detector ==2826240== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==2826240== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info ==2826240== Command: /data/blackswan/ripley/R/R-devel-vg/bin/exec/R --vanilla ==2826240== R Under development (unstable) (2024-04-14 r86416) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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. Natural language support but running in an English locale 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. > pkgname <- "RSiena" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('RSiena') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("RSiena-package") > ### * RSiena-package > > flush(stderr()); flush(stdout()) > > ### Name: RSiena-package > ### Title: Simulation Investigation for Empirical Network Analysis > ### Aliases: RSiena-package RSiena > ### Keywords: package > > ### ** Examples > > mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > mydata <- sienaDataCreate(mynet1) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 > myeff 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 > myalgorithm <- sienaAlgorithmCreate(nsub=3, n3=200) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) Start phase 0 theta: -0.56 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 0% Phase 1 Iteration 5 Progress: 0% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 1% Phase 1 Iteration 20 Progress: 2% Phase 1 Iteration 25 Progress: 2% Phase 1 Iteration 30 Progress: 2% Phase 1 Iteration 35 Progress: 3% Phase 1 Iteration 40 Progress: 3% Phase 1 Iteration 45 Progress: 4% Phase 1 Iteration 50 Progress: 4% theta: -0.7268 0.1413 0.0495 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 16% Phase 2 Subphase 1 Iteration 2 Progress: 16% theta -0.8828 0.3223 0.0989 ac 1.13 1.43 1.59 Phase 2 Subphase 1 Iteration 3 Progress: 16% Phase 2 Subphase 1 Iteration 4 Progress: 16% theta -1.305 0.858 0.227 ac 0.581 1.821 1.937 Phase 2 Subphase 1 Iteration 5 Progress: 16% Phase 2 Subphase 1 Iteration 6 Progress: 17% theta -1.583 1.223 0.297 ac 0.592 1.563 1.948 Phase 2 Subphase 1 Iteration 7 Progress: 17% Phase 2 Subphase 1 Iteration 8 Progress: 17% theta -1.651 1.340 0.284 ac -0.283 1.018 0.578 Phase 2 Subphase 1 Iteration 9 Progress: 17% Phase 2 Subphase 1 Iteration 10 Progress: 17% theta -1.75 1.47 0.29 ac -0.935 1.037 0.343 theta -1.74 1.37 0.31 ac -0.26451 -0.00803 -0.20912 theta: -1.74 1.37 0.31 Start phase 2.2 Phase 2 Subphase 2 Iteration 1 Progress: 34% Phase 2 Subphase 2 Iteration 2 Progress: 34% Phase 2 Subphase 2 Iteration 3 Progress: 34% Phase 2 Subphase 2 Iteration 4 Progress: 34% Phase 2 Subphase 2 Iteration 5 Progress: 35% Phase 2 Subphase 2 Iteration 6 Progress: 35% Phase 2 Subphase 2 Iteration 7 Progress: 35% Phase 2 Subphase 2 Iteration 8 Progress: 35% Phase 2 Subphase 2 Iteration 9 Progress: 35% Phase 2 Subphase 2 Iteration 10 Progress: 35% theta -1.715 1.377 0.303 ac -0.23088 -0.00553 -0.06274 theta: -1.715 1.377 0.303 Start phase 2.3 Phase 2 Subphase 3 Iteration 1 Progress: 55% Phase 2 Subphase 3 Iteration 2 Progress: 55% Phase 2 Subphase 3 Iteration 3 Progress: 55% Phase 2 Subphase 3 Iteration 4 Progress: 56% Phase 2 Subphase 3 Iteration 5 Progress: 56% Phase 2 Subphase 3 Iteration 6 Progress: 56% Phase 2 Subphase 3 Iteration 7 Progress: 56% Phase 2 Subphase 3 Iteration 8 Progress: 56% Phase 2 Subphase 3 Iteration 9 Progress: 56% Phase 2 Subphase 3 Iteration 10 Progress: 56% theta -1.76 1.36 0.32 ac -0.1029 -0.1500 -0.0668 theta: -1.76 1.36 0.32 Start phase 3 Phase 3 Iteration 100 Progress 92% Phase 3 Iteration 200 Progress 100% > summary(ans) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 3.1486 ( 0.5157 ) Other parameters: 1. eval outdegree (density) -1.7563 ( 0.2983 ) -0.0917 2. eval reciprocity 1.3553 ( 0.3946 ) -0.0582 3. eval transitive triplets 0.3200 ( 0.0731 ) -0.0147 Overall maximum convergence ratio: 0.1454 Total of 602 iteration steps. Covariance matrix of estimates (correlations below diagonal) 0.089 -0.053 -0.017 -0.450 0.156 0.002 -0.764 0.080 0.005 Derivative matrix of expected statistics X by parameters: 50.999 21.384 181.178 18.591 19.648 72.361 158.666 78.743 846.688 Covariance matrix of X (correlations below diagonal): 63.404 33.739 240.468 0.666 40.486 164.302 0.822 0.703 1351.013 > > > > cleanEx() > nameEx("Wald") > ### * Wald > > flush(stderr()); flush(stdout()) > > ### Name: Wald > ### Title: Wald and score tests for RSiena results > ### Aliases: Wald.RSiena Multipar.RSiena score.Test scoreTest sienaTest > ### testSame.RSiena > ### Keywords: tests > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > mydata <- sienaDataCreate(mynet) > myeff <- getEffects(mydata) > myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=40, seed=1777, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > # nsub=1 and n3=40 is used here for having a brief computation, > # not for practice. > myeff <- includeEffects(myeff, transTrip, transTies) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 2 transitive ties TRUE FALSE FALSE 0 0 > myeff <- includeEffects(myeff, outAct, outPop, fix=TRUE, test=TRUE) effectName include fix test initialValue parm 1 outdegree - popularity TRUE TRUE TRUE 0 0 2 outdegree - activity TRUE TRUE TRUE 0 0 > (ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE)) Start phase 0 theta: -1.49 0.00 0.00 0.00 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 4% Phase 1 Iteration 30 Progress: 5% Phase 1 Iteration 35 Progress: 6% Phase 1 Iteration 40 Progress: 6% Phase 1 Iteration 45 Progress: 7% Phase 1 Iteration 50 Progress: 8% theta: -1.750 0.437 0.650 -0.477 0.000 0.000 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 56% Phase 2 Subphase 1 Iteration 2 Progress: 57% theta -1.874 0.671 0.830 -0.362 0.000 0.000 ac 0.00378 3.79486 -1.06273 -3.09687 -0.05719 0.12148 Phase 2 Subphase 1 Iteration 3 Progress: 57% Phase 2 Subphase 1 Iteration 4 Progress: 57% theta -2.1545 1.2009 0.6376 0.0483 0.0000 0.0000 ac 0.235 2.246 -1.056 -2.625 0.220 0.408 Phase 2 Subphase 1 Iteration 5 Progress: 57% Phase 2 Subphase 1 Iteration 6 Progress: 57% theta -2.454 1.711 0.230 0.637 0.000 0.000 ac 0.225 1.826 -1.110 -2.672 0.246 0.472 Phase 2 Subphase 1 Iteration 7 Progress: 57% Phase 2 Subphase 1 Iteration 8 Progress: 58% theta -2.621 1.956 0.115 0.669 0.000 0.000 ac -0.2214 0.0523 -1.0209 -1.1194 -0.0999 0.2100 Phase 2 Subphase 1 Iteration 9 Progress: 58% Phase 2 Subphase 1 Iteration 10 Progress: 58% theta -2.6549 2.1076 0.0503 0.6892 0.0000 0.0000 ac -0.298 -0.225 -1.081 -1.250 -0.230 0.104 theta -2.620 2.096 0.307 0.540 0.000 0.000 ac -0.4355 -0.5384 -0.7333 -0.9225 -0.1641 -0.0898 theta: -2.620 2.096 0.307 0.540 0.000 0.000 Start phase 3 Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 6.6977 ( 1.0182 ) Other parameters: 1. eval outdegree (density) -2.6200 ( 0.1514 ) -0.4627 2. eval reciprocity 2.0958 ( 0.2976 ) -0.5244 3. eval transitive triplets 0.3066 ( 0.2922 ) -0.8100 4. eval transitive ties 0.5397 ( 0.4471 ) -0.6856 5. eval outdegree - popularity 0.0000 ( NA ) 0.1821 6. eval outdegree - activity 0.0000 ( NA ) 0.1142 Overall maximum convergence ratio: 0.9363 Score test for 2 parameters: chi-squared = 6.33, p = 0.0422. Total of 122 iteration steps. > A <- matrix(0, 2, 6) > A[1, 3] <- 1 > A[2, 4] <- 1 > wa <- Wald.RSiena(A, ans) > wa chi-squared = 25.49, d.f. = 2; p < 0.001. > # A shortcut for the above is: > Multipar.RSiena(ans, 3, 4) Tested effects: transitive triplets transitive ties chi-squared = 25.49, d.f. = 2; p < 0.001. > # The following two are equivalent: > sct <- score.Test(ans, c(FALSE, FALSE, FALSE, FALSE, FALSE, TRUE)) > sct <- score.Test(ans,6) > print(sct) Tested effects: outdegree - activity chi-squared = 3.56, d.f. = 1; one-sided Z = -1.89; two-sided p = 0.059. > # Getting all 1-df score tests separately: > for (i in which(ans$test)){ + sct <- score.Test(ans,i) + print(sct)} Tested effects: outdegree - popularity chi-squared = 6.10, d.f. = 1; one-sided Z = -2.47; two-sided p = 0.014. Tested effects: outdegree - activity chi-squared = 3.56, d.f. = 1; one-sided Z = -1.89; two-sided p = 0.059. > # Testing that endowment and creation effects are identical: > myeff1 <- getEffects(mydata) > myeff1 <- includeEffects(myeff1, recip, include=FALSE) [1] effectName include fix test initialValue [6] parm <0 rows> (or 0-length row.names) > myeff1 <- includeEffects(myeff1, recip, type='creation') effectName include fix test initialValue parm type 1 reciprocity TRUE FALSE FALSE 0 0 creation > (myeff1 <- includeEffects(myeff1, recip, type='endow')) effectName include fix test initialValue parm type 1 reciprocity TRUE FALSE FALSE 0 0 endow effectName include fix test initialValue parm type 1 basic rate parameter mynet TRUE FALSE FALSE 4.69604 0 rate 2 outdegree (density) TRUE FALSE FALSE -1.48852 0 eval 3 reciprocity TRUE FALSE FALSE 0.00000 0 endow 4 reciprocity TRUE FALSE FALSE 0.00000 0 creation > (ans1 <- siena07(myalgorithm, data=mydata, effects=myeff1, batch=TRUE)) Start phase 0 theta: -1.49 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 1% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 3% Phase 1 Iteration 20 Progress: 4% Phase 1 Iteration 25 Progress: 5% Phase 1 Iteration 30 Progress: 6% Phase 1 Iteration 35 Progress: 8% Phase 1 Iteration 40 Progress: 9% Phase 1 Iteration 45 Progress: 10% Phase 1 Iteration 50 Progress: 11% theta: -1.5212 -0.0961 1.0000 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 43% Phase 2 Subphase 1 Iteration 2 Progress: 43% theta -1.568 -0.177 2.396 ac 0.579 6.448 2.755 Phase 2 Subphase 1 Iteration 3 Progress: 44% Phase 2 Subphase 1 Iteration 4 Progress: 44% theta -1.767 -0.109 4.356 ac 0.836 0.913 1.358 Phase 2 Subphase 1 Iteration 5 Progress: 44% Phase 2 Subphase 1 Iteration 6 Progress: 44% theta -1.977 0.129 4.282 ac 0.895 -0.346 1.139 Phase 2 Subphase 1 Iteration 7 Progress: 45% Phase 2 Subphase 1 Iteration 8 Progress: 45% theta -2.080 0.569 2.915 ac 0.770 0.148 0.443 Phase 2 Subphase 1 Iteration 9 Progress: 45% Phase 2 Subphase 1 Iteration 10 Progress: 45% theta -2.102 0.581 4.549 ac 0.8067 0.1411 0.0306 theta -2.066 0.971 3.478 ac -0.192 -0.012 -0.608 theta: -2.066 0.971 3.478 Start phase 3 Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 4.3298 ( 0.4866 ) Other parameters: 1. eval outdegree (density) -2.0655 ( 0.2415 ) 0.1263 2. endow reciprocity 0.9706 ( 1.0712 ) 0.0339 3. creat reciprocity 3.4778 ( 0.4926 ) 0.0876 Overall maximum convergence ratio: 0.1794 Total of 218 iteration steps. > testSame.RSiena(ans1, 2, 3) Tested effects: reciprocity endow == reciprocity creation chi-squared = 4.24, d.f. = 1; one-sided Z = -2.06; two-sided p = 0.039. > > > > cleanEx() > nameEx("coCovar") > ### * coCovar > > flush(stderr()); flush(stdout()) > > ### Name: coCovar > ### Title: Function to create a constant covariate object > ### Aliases: coCovar > ### Keywords: classes > > ### ** Examples > > > myconstCovar <- coCovar(s50a[,1]) > senders <- sienaNodeSet(50, nodeSetName="senders") > receivers <- sienaNodeSet(30, nodeSetName="receivers") > senders.attribute <- coCovar(rep(1:10, each=5), nodeSet="senders") > receivers.attribute <- coCovar(rep(1:5, each=6), nodeSet="receivers") > > > > cleanEx() > nameEx("coDyadCovar") > ### * coDyadCovar > > flush(stderr()); flush(stdout()) > > ### Name: coDyadCovar > ### Title: Function to create a constant dyadic covariate object. > ### Aliases: coDyadCovar > ### Keywords: classes > > ### ** Examples > > mydyadvar <- coDyadCovar(s503) > > > > cleanEx() > nameEx("edit.sienaEffects") > ### * edit.sienaEffects > > flush(stderr()); flush(stdout()) > > ### Name: edit.sienaEffects > ### Title: Allow editing of a sienaEffects object if a gui is available. > ### Aliases: edit.sienaEffects > ### Keywords: methods > > ### ** Examples > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mycovar <- coCovar(rnorm(50)) > mydyadcovar <- coDyadCovar(matrix(as.numeric(rnorm(2500) > 2), nrow=50)) > mydata <- sienaDataCreate(mynet1, mybeh, mycovar, mydyadcovar) > myeff <- getEffects(mydata) > ## Not run: > ##D fix(myeff) > ## End(Not run) > > > > cleanEx() > nameEx("effectsDocumentation") > ### * effectsDocumentation > > flush(stderr()); flush(stdout()) > > ### Name: effectsDocumentation > ### Title: Function to create a table of documentation of effect names, > ### short names etc. > ### Aliases: effectsDocumentation > ### Keywords: print > > ### ** Examples > > ## Not run: effectsDocumentation() > > > > cleanEx() > nameEx("funnelPlot") > ### * funnelPlot > > flush(stderr()); flush(stdout()) > > ### Name: funnelPlot > ### Title: Plot function for a list of sienaFit objects > ### Aliases: funnelPlot > ### Keywords: plot > > ### ** Examples > > # A meta-analysis for three groups does not make much sense. > # But using three groups shows the idea. > > Group1 <- sienaDependent(array(c(N3401, HN3401), dim=c(45, 45, 2))) > Group3 <- sienaDependent(array(c(N3403, HN3403), dim=c(37, 37, 2))) > Group4 <- sienaDependent(array(c(N3404, HN3404), dim=c(33, 33, 2))) > dataset.1 <- sienaDataCreate(Friends = Group1) > dataset.3 <- sienaDataCreate(Friends = Group3) > dataset.4 <- sienaDataCreate(Friends = Group4) > OneAlgorithm <- sienaAlgorithmCreate(projname = NULL, nsub=1, n3=50, seed=123) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > effects.1 <- getEffects(dataset.1) > effects.3 <- getEffects(dataset.3) > effects.4 <- getEffects(dataset.4) > ans.1 <- siena07(OneAlgorithm, data=dataset.1, effects=effects.1, batch=TRUE) Start phase 0 theta: -1.11 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 1% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 4% Phase 1 Iteration 20 Progress: 5% Phase 1 Iteration 25 Progress: 6% Phase 1 Iteration 30 Progress: 7% Phase 1 Iteration 35 Progress: 8% Phase 1 Iteration 40 Progress: 9% Phase 1 Iteration 45 Progress: 11% Phase 1 Iteration 50 Progress: 12% theta: -1.172 0.279 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 36% Phase 2 Subphase 1 Iteration 2 Progress: 36% theta -1.241 0.652 ac 0.626 1.112 Phase 2 Subphase 1 Iteration 3 Progress: 36% Phase 2 Subphase 1 Iteration 4 Progress: 36% theta -1.48 1.66 ac 0.731 1.141 Phase 2 Subphase 1 Iteration 5 Progress: 37% Phase 2 Subphase 1 Iteration 6 Progress: 37% theta -1.71 2.26 ac 0.763 1.076 Phase 2 Subphase 1 Iteration 7 Progress: 37% Phase 2 Subphase 1 Iteration 8 Progress: 37% theta -1.87 2.49 ac 0.782 1.085 Phase 2 Subphase 1 Iteration 9 Progress: 38% Phase 2 Subphase 1 Iteration 10 Progress: 38% theta -2.00 2.65 ac 0.731 1.009 Phase 2 Subphase 1 Iteration 200 Progress: 85% theta -1.93 2.36 ac 0.120 0.391 theta -1.85 2.27 ac 0.0863 0.3716 theta: -1.85 2.27 Start phase 3 > ans.3 <- siena07(OneAlgorithm, data=dataset.3, effects=effects.3, batch=TRUE) Start phase 0 theta: -1.24 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 1% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 4% Phase 1 Iteration 20 Progress: 5% Phase 1 Iteration 25 Progress: 6% Phase 1 Iteration 30 Progress: 7% Phase 1 Iteration 35 Progress: 8% Phase 1 Iteration 40 Progress: 9% Phase 1 Iteration 45 Progress: 11% Phase 1 Iteration 50 Progress: 12% theta: -1.292 0.466 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 36% Phase 2 Subphase 1 Iteration 2 Progress: 36% theta -1.35 1.15 ac 0.504 1.490 Phase 2 Subphase 1 Iteration 3 Progress: 36% Phase 2 Subphase 1 Iteration 4 Progress: 36% theta -1.54 2.63 ac 0.831 1.430 Phase 2 Subphase 1 Iteration 5 Progress: 37% Phase 2 Subphase 1 Iteration 6 Progress: 37% theta -1.74 3.26 ac 0.925 1.262 Phase 2 Subphase 1 Iteration 7 Progress: 37% Phase 2 Subphase 1 Iteration 8 Progress: 37% theta -1.87 3.19 ac 0.797 1.111 Phase 2 Subphase 1 Iteration 9 Progress: 38% Phase 2 Subphase 1 Iteration 10 Progress: 38% theta -2.02 3.00 ac 0.868 1.093 Phase 2 Subphase 1 Iteration 200 Progress: 85% theta -2.04 2.87 ac 0.2564 0.0917 theta -2.04 2.80 ac 0.253 0.086 theta: -2.04 2.80 Start phase 3 > ans.4 <- siena07(OneAlgorithm, data=dataset.4, effects=effects.4, batch=TRUE) Start phase 0 theta: -1.62 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 1% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 4% Phase 1 Iteration 20 Progress: 5% Phase 1 Iteration 25 Progress: 6% Phase 1 Iteration 30 Progress: 7% Phase 1 Iteration 35 Progress: 8% Phase 1 Iteration 40 Progress: 9% Phase 1 Iteration 45 Progress: 11% Phase 1 Iteration 50 Progress: 12% theta: -1.76 0.40 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 36% Phase 2 Subphase 1 Iteration 2 Progress: 36% theta -1.893 0.839 ac 0.638 1.702 Phase 2 Subphase 1 Iteration 3 Progress: 36% Phase 2 Subphase 1 Iteration 4 Progress: 36% theta -2.29 1.78 ac 0.666 1.478 Phase 2 Subphase 1 Iteration 5 Progress: 37% Phase 2 Subphase 1 Iteration 6 Progress: 37% theta -2.66 2.44 ac 0.732 1.466 Phase 2 Subphase 1 Iteration 7 Progress: 37% Phase 2 Subphase 1 Iteration 8 Progress: 37% theta -2.89 2.86 ac 0.645 0.304 Phase 2 Subphase 1 Iteration 9 Progress: 38% Phase 2 Subphase 1 Iteration 10 Progress: 38% theta -3.10 2.93 ac 0.6926 0.0823 Phase 2 Subphase 1 Iteration 200 Progress: 85% theta -3.03 2.80 ac 0.128 -0.179 theta -3.12 2.96 ac 0.0981 -0.1837 theta: -3.12 2.96 Start phase 3 > funnelPlot(list(ans.1, ans.3, ans.4), k=2) > funnelPlot(list(ans.1, ans.3, ans.4), k=2, origin=FALSE) > > > > cleanEx() > nameEx("getEffects") > ### * getEffects > > flush(stderr()); flush(stdout()) > > ### Name: getEffects > ### Title: Function to create a Siena effects object > ### Aliases: getEffects sienaEffects sienaGroupEffects > ### Keywords: classes > > ### ** Examples > > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mycovar <- coCovar(rnorm(50)) > mydyadcovar <- coDyadCovar(matrix(as.numeric(rnorm(2500) > 2), nrow=50)) > mydata <- sienaDataCreate(mynet1, mybeh, mycovar, mydyadcovar) > myeff <- getEffects(mydata) > myeff 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 mybeh rate mybeh (period 1) TRUE FALSE FALSE 0.70571 0 6 mybeh rate mybeh (period 2) TRUE FALSE FALSE 0.84939 0 7 mybeh mybeh linear shape TRUE FALSE FALSE 0.32237 0 8 mybeh mybeh quadratic shape TRUE FALSE FALSE 0.00000 0 > > > > cleanEx() > nameEx("hn3401") > ### * hn3401 > > flush(stderr()); flush(stdout()) > > ### Name: hn3401 > ### Title: Network data: excerpt from "Dutch Social Behavior Data Set" of > ### Chris Baerveldt. > ### Aliases: hn3401 HN3401 HN3403 HN3404 HN3406 > ### Keywords: datasets > > ### ** Examples > > mynet <- sienaDependent(array(c(N3401, HN3401), dim=c(45, 45, 2))) > mydata <- sienaDataCreate(mynet) > > > > cleanEx() > nameEx("includeEffects") > ### * includeEffects > > flush(stderr()); flush(stdout()) > > ### Name: includeEffects > ### Title: Function to include effects in a Siena model > ### Aliases: includeEffects > ### Keywords: classes > > ### ** Examples > > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mydata <- sienaDataCreate(mynet1, mybeh) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip, balance) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 2 balance TRUE FALSE FALSE 0 0 > myeff <- includeEffects(myeff, avAlt, name="mybeh", interaction1="mynet1") effectName include fix test initialValue parm 1 mybeh average alter TRUE FALSE FALSE 0 0 > myeff 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 balance TRUE FALSE FALSE 0.00000 0 7 mybeh rate mybeh (period 1) TRUE FALSE FALSE 0.70571 0 8 mybeh rate mybeh (period 2) TRUE FALSE FALSE 0.84939 0 9 mybeh mybeh linear shape TRUE FALSE FALSE 0.32237 0 10 mybeh mybeh quadratic shape TRUE FALSE FALSE 0.00000 0 11 mybeh mybeh average alter TRUE FALSE FALSE 0.00000 0 > > > > cleanEx() > nameEx("includeGMoMStatistics") > ### * includeGMoMStatistics > > flush(stderr()); flush(stdout()) > > ### Name: includeGMoMStatistics > ### Title: Function to include GMoM statistics in a Siena model > ### Aliases: includeGMoMStatistics > ### Keywords: classes > > ### ** Examples > > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mydata <- sienaDataCreate(mynet1, mybeh) > myeff <- getEffects(mydata) > myeff <- includeGMoMStatistics(myeff, egoX_gmm, interaction1="mybeh") name shortName type include 1 mynet1 egoX_gmm gmm TRUE > myeff 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 mybeh rate mybeh (period 1) TRUE FALSE FALSE 0.70571 0 6 mybeh rate mybeh (period 2) TRUE FALSE FALSE 0.84939 0 7 mybeh mybeh linear shape TRUE FALSE FALSE 0.32237 0 8 mybeh mybeh quadratic shape TRUE FALSE FALSE 0.00000 0 type 1 rate 2 rate 3 eval 4 eval 5 rate 6 rate 7 eval 8 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 mybeh rate mybeh (period 1) Regular 6 mybeh rate mybeh (period 2) Regular 7 mybeh mybeh linear shape Regular 8 mybeh mybeh quadratic shape Regular 9 mynet1 mybeh ego GMoM > > > > cleanEx() > nameEx("includeInteraction") > ### * includeInteraction > > flush(stderr()); flush(stdout()) > > ### Name: includeInteraction > ### Title: Function to create user-specified interactions for a Siena > ### model. > ### Aliases: includeInteraction > ### Keywords: classes > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > alc <- varCovar(s50a) > mydata <- sienaDataCreate(mynet, alc) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 > myeff <- includeInteraction(myeff, recip, inPop) effectName include fix test initialValue parm 1 reciprocity x indegree - popularity TRUE FALSE FALSE 0 0 effect1 effect2 1 16 79 > myeff <- includeEffects(myeff, egoX, altX, simX, interaction1="alc") effectName include fix test initialValue parm 1 alc alter TRUE FALSE FALSE 0 0 2 alc ego TRUE FALSE FALSE 0 0 3 alc similarity TRUE FALSE FALSE 0 0 > myeff <- includeInteraction(myeff, recip, simX, interaction1=c("", "alc")) effectName include fix test initialValue parm effect1 1 reciprocity x alc similarity TRUE FALSE FALSE 0 0 16 effect2 1 288 > myeff effectName include fix test initialValue parm 1 constant mynet rate (period 1) TRUE FALSE FALSE 4.69604 0 2 constant mynet rate (period 2) TRUE FALSE FALSE 4.32885 0 3 outdegree (density) TRUE FALSE FALSE -1.46770 0 4 reciprocity TRUE FALSE FALSE 0.00000 0 5 transitive triplets TRUE FALSE FALSE 0.00000 0 6 alc alter TRUE FALSE FALSE 0.00000 0 7 alc ego TRUE FALSE FALSE 0.00000 0 8 alc similarity TRUE FALSE FALSE 0.00000 0 9 reciprocity x indegree - popularity TRUE FALSE FALSE 0.00000 0 10 reciprocity x alc similarity TRUE FALSE FALSE 0.00000 0 effect1 effect2 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 16 79 10 16 288 > > > > cleanEx() > nameEx("includeTimeDummy") > ### * includeTimeDummy > > flush(stderr()); flush(stdout()) > > ### Name: includeTimeDummy > ### Title: Function to include time dummy effects in a Siena model > ### Aliases: includeTimeDummy > ### Keywords: models > > ### ** Examples > > ## Not run: > ##D ## Estimate a restricted model > ##D myalgorithm <- sienaAlgorithmCreate(nsub=4, n3=1000) > ##D mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > ##D mydata <- sienaDataCreate(mynet1) > ##D myeff <- getEffects(mydata) > ##D myeff <- includeEffects(myeff, transTrip, balance) > ##D myeff > ##D (ans <- siena07(myalgorithm, data=mydata, effects=myeff)) > ##D > ##D ## Conduct the score type test to assess whether heterogeneity is present. > ##D tt <- sienaTimeTest(ans) > ##D summary(tt) > ##D > ##D ## Suppose that we wish to include a time dummy. > ##D ## Since there are three waves, the number of periods is two. > ##D ## This means that only one time dummy can be included for > ##D ## the interactions. The default is for period 2; > ##D ## an equivalent model, but with different parameters > ##D ## (that can be transformed into each other) is obtained > ##D ## when the dummies are defined for period 1. > ##D myeff <- includeTimeDummy(myeff, density, recip, timeDummy="2") > ##D myeff # Note the \code{timeDummy} column. > ##D (ans2 <- siena07(myalgorithm, data=mydata, effects=myeff)) > ##D > ##D ## Re-assess the time heterogeneity > ##D tt2 <- sienaTimeTest(ans2) > ##D summary(tt2) > ##D > ##D ## And so on.. > ## End(Not run) > > ## A demonstration of RateX heterogeneity. > ## Note that rate interactions are not implemented in general, > ## but they are for Rate x coCovar. > ## Not run: > ##D myalgorithm <- sienaAlgorithmCreate(nsub=4, n3=1000) > ##D mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > ##D myccov <- coCovar(s50a[,1]) > ##D mydata <- sienaDataCreate(mynet1, myccov) > ##D myeff <- getEffects(mydata) > ##D myeff <- includeEffects(myeff, transTrip, balance) > ##D myeff <- includeTimeDummy(myeff, RateX, type="rate", > ##D interaction1="myccov") > ##D myeff > ##D (ans <- siena07(myalgorithm, data=mydata, effects=myeff)) > ## End(Not run) > > > > cleanEx() > nameEx("iwlsm") > ### * iwlsm > > flush(stderr()); flush(stdout()) > > ### Name: iwlsm > ### Title: Function to fit an iterated weighted least squares model. > ### Aliases: iwlsm iwlsm.default iwlsm.formula print.iwlsm predict.iwlsm > ### psi.iwlsm > ### Keywords: models > > ### ** Examples > > ## Not run: > ##D ##not enough data here for a sensible example, but shows the idea. > ##D myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100) > ##D mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > ##D mynet2 <- sienaDependent(array(c(s502, s503), dim=c(50, 50, 2))) > ##D mydata1 <- sienaDataCreate(mynet1) > ##D mydata2 <- sienaDataCreate(mynet2) > ##D myeff1 <- getEffects(mydata1) > ##D myeff2 <- getEffects(mydata2) > ##D myeff1 <- setEffect(myeff1, transTrip, fix=TRUE, test=TRUE) > ##D myeff2 <- setEffect(myeff2, transTrip, fix=TRUE, test=TRUE) > ##D myeff1 <- setEffect(myeff1, cycle3, fix=TRUE, test=TRUE) > ##D myeff2 <- setEffect(myeff2, cycle3, fix=TRUE, test=TRUE) > ##D ans1 <- siena07(myalgorithm, data=mydata1, effects=myeff1, batch=TRUE) > ##D ans2 <- siena07(myalgorithm, data=mydata2, effects=myeff2, batch=TRUE) > ##D meta <- siena08(ans1, ans2) > ##D metadf <- split(meta$thetadf, meta$thetadf$effects)[[1]] > ##D metalm <- iwlsm(theta ~ tconv, metadf, ses=se^2) > ## End(Not run) > > > > cleanEx() > nameEx("n3401") > ### * n3401 > > flush(stderr()); flush(stdout()) > > ### Name: n3401 > ### Title: Network data: excerpt from "Dutch Social Behavior Data Set" of > ### Chris Baerveldt. > ### Aliases: n3401 N3401 N3403 N3404 N3406 > ### Keywords: datasets > > ### ** Examples > > mynet <- sienaDependent(array(c(N3401, HN3401), dim=c(45, 45, 2))) > mydata <- sienaDataCreate(mynet) > > > > cleanEx() > nameEx("plot.sienaTimeTest") > ### * plot.sienaTimeTest > > flush(stderr()); flush(stdout()) > > ### Name: plot.sienaTimeTest > ### Title: Functions to plot assessment of time heterogeneity of parameters > ### Aliases: plot.sienaTimeTest > ### Keywords: methods > > ### ** Examples > > ## Not run: > ##D myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=500) > ##D # It makes no sense to put together the following data set, > ##D # but just for demonstration: > ##D mynet1 <- sienaDependent(array(c(s501, s502, s503, s501, s503, s502), dim=c(50, 50, 6))) > ##D mydata <- sienaDataCreate(mynet1) > ##D myeff <- getEffects(mydata) > ##D myeff <- includeEffects(myeff, transTrip) > ##D myeff <- includeTimeDummy(myeff, density, timeDummy="all") > ##D myeff <- includeTimeDummy(myeff, recip, timeDummy="2,3,5") > ##D myeff <- includeTimeDummy(myeff, transTrip, timeDummy="2,3") > ##D (ansp <- siena07(myalgorithm, data=mydata, effects=myeff)) > ##D ttp <- sienaTimeTest(ansp) > ##D summary(ttp) > ##D > ##D ## Pairwise plots show > ##D plot(ttp, pairwise=TRUE) > ##D > ##D ## Time test plots show > ##D plot(ttp, effects=1:3) ## default layout > ##D plot(ttp, effects=1:3, layout=c(3,1)) > ## End(Not run) > > > > cleanEx() > nameEx("print.sienaEffects") > ### * print.sienaEffects > > flush(stderr()); flush(stdout()) > > ### Name: print.sienaEffects > ### Title: Print methods for Siena effects objects > ### Aliases: print.sienaEffects summary.sienaEffects > ### print.summary.sienaEffects > ### Keywords: print > > ### ** Examples > > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mycovar <- coCovar(rnorm(50)) > mydyadcovar <- coDyadCovar(matrix(as.numeric(rnorm(2500) > 2), nrow=50)) > mydata <- sienaDataCreate(mynet1, mybeh, mycovar, mydyadcovar) > myeff <- getEffects(mydata) > myeff 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 mybeh rate mybeh (period 1) TRUE FALSE FALSE 0.70571 0 6 mybeh rate mybeh (period 2) TRUE FALSE FALSE 0.84939 0 7 mybeh mybeh linear shape TRUE FALSE FALSE 0.32237 0 8 mybeh mybeh quadratic shape TRUE FALSE FALSE 0.00000 0 > summary(myeff) name effectName mynet1.rate.1 mynet1 constant mynet1 rate (period 1) mynet1.rate.2 mynet1 constant mynet1 rate (period 2) mynet1.obj.eval.1 mynet1 outdegree (density) mynet1.obj.eval.2 mynet1 reciprocity mybeh.rate.1 mybeh rate mybeh (period 1) mybeh.rate.2 mybeh rate mybeh (period 2) mybeh.obj.eval.1 mybeh mybeh linear shape mybeh.obj.eval.2 mybeh mybeh quadratic shape functionName shortName mynet1.rate.1 Amount of network change in period 1 Rate mynet1.rate.2 Amount of network change in period 2 Rate mynet1.obj.eval.1 Number of ties density mynet1.obj.eval.2 Number of reciprocated ties recip mybeh.rate.1 Amount of behavioral change in period 1 on mybeh Rate mybeh.rate.2 Amount of behavioral change in period 2 on mybeh Rate mybeh.obj.eval.1 mybeh centered sum linear mybeh.obj.eval.2 mybeh sum of cent. squares quad interaction1 interaction2 type basicRate include mynet1.rate.1 rate TRUE TRUE mynet1.rate.2 rate TRUE TRUE mynet1.obj.eval.1 eval FALSE TRUE mynet1.obj.eval.2 eval FALSE TRUE mybeh.rate.1 rate TRUE TRUE mybeh.rate.2 rate TRUE TRUE mybeh.obj.eval.1 eval FALSE TRUE mybeh.obj.eval.2 eval FALSE TRUE randomEffects fix test timeDummy initialValue parm mynet1.rate.1 FALSE FALSE FALSE , 4.6960424 0 mynet1.rate.2 FALSE FALSE FALSE , 4.3288454 0 mynet1.obj.eval.1 TRUE FALSE FALSE , -1.4677046 0 mynet1.obj.eval.2 FALSE FALSE FALSE , 0.0000000 0 mybeh.rate.1 FALSE FALSE FALSE , 0.7057143 0 mybeh.rate.2 FALSE FALSE FALSE , 0.8493878 0 mybeh.obj.eval.1 FALSE FALSE FALSE , 0.3223690 0 mybeh.obj.eval.2 FALSE FALSE FALSE , 0.0000000 0 functionType period rateType untrimmedValue effect1 effect2 mynet1.rate.1 rate 1 0.000000 0 0 mynet1.rate.2 rate 2 0.000000 0 0 mynet1.obj.eval.1 objective -1.467705 0 0 mynet1.obj.eval.2 objective 0.000000 0 0 mybeh.rate.1 rate 1 0.000000 0 0 mybeh.rate.2 rate 2 0.000000 0 0 mybeh.obj.eval.1 objective 0.322369 0 0 mybeh.obj.eval.2 objective 0.000000 0 0 effect3 interactionType local setting effectFn statisticFn mynet1.rate.1 0 TRUE NULL NULL mynet1.rate.2 0 TRUE NULL NULL mynet1.obj.eval.1 0 dyadic TRUE NULL NULL mynet1.obj.eval.2 0 dyadic TRUE NULL NULL mybeh.rate.1 0 FALSE NULL NULL mybeh.rate.2 0 FALSE NULL NULL mybeh.obj.eval.1 0 OK TRUE NULL NULL mybeh.obj.eval.2 0 TRUE NULL NULL netType groupName group effectNumber mynet1.rate.1 oneMode Group1 1 1 mynet1.rate.2 oneMode Group1 1 2 mynet1.obj.eval.1 oneMode Group1 1 14 mynet1.obj.eval.2 oneMode Group1 1 17 mybeh.rate.1 behavior Group1 1 641 mybeh.rate.2 behavior Group1 1 642 mybeh.obj.eval.1 behavior Group1 1 655 mybeh.obj.eval.2 behavior Group1 1 658 > > > > cleanEx() > nameEx("print.sienaMeta") > ### * print.sienaMeta > > flush(stderr()); flush(stdout()) > > ### Name: print.sienaMeta > ### Title: Methods for processing sienaMeta objects > ### Aliases: print.sienaMeta summary.sienaMeta plot.sienaMeta > ### print.summary.sienaMeta meta.table > ### Keywords: print > > ### ** Examples > > ## Not run: > ##D # A meta-analysis for three groups does not make much sense > ##D # for generalizing to a population of networks, > ##D # but it the Fisher combinations of p-values are meaningful. > ##D # But using three groups shows the idea. > ##D > ##D Group1 <- sienaDependent(array(c(N3401, HN3401), dim=c(45, 45, 2))) > ##D Group3 <- sienaDependent(array(c(N3403, HN3403), dim=c(37, 37, 2))) > ##D Group4 <- sienaDependent(array(c(N3404, HN3404), dim=c(33, 33, 2))) > ##D dataset.1 <- sienaDataCreate(Friends = Group1) > ##D dataset.3 <- sienaDataCreate(Friends = Group3) > ##D dataset.4 <- sienaDataCreate(Friends = Group4) > ##D OneAlgorithm <- sienaAlgorithmCreate(projname = "SingleGroups") > ##D effects.1 <- getEffects(dataset.1) > ##D effects.3 <- getEffects(dataset.3) > ##D effects.4 <- getEffects(dataset.4) > ##D effects.1 <- includeEffects(effects.1, transTrip) > ##D effects.1 <- setEffect(effects.1, transRecTrip, fix=TRUE, test=TRUE) > ##D effects.3 <- includeEffects(effects.3, transTrip) > ##D effects.3 <- setEffect(effects.3, transRecTrip, fix=TRUE, test=TRUE) > ##D effects.4 <- includeEffects(effects.4, transTrip) > ##D effects.4 <- setEffect(effects.4, transRecTrip, fix=TRUE, test=TRUE) > ##D ans.1 <- siena07(OneAlgorithm, data=dataset.1, effects=effects.1, batch=TRUE) > ##D ans.3 <- siena07(OneAlgorithm, data=dataset.3, effects=effects.3, batch=TRUE) > ##D ans.4 <- siena07(OneAlgorithm, data=dataset.4, effects=effects.4, batch=TRUE) > ##D ans.1 > ##D ans.3 > ##D ans.4 > ##D meta <- siena08(ans.1, ans.3, ans.4) > ##D print(meta, reportEstimates=FALSE) > ##D print(meta) > ##D summary(meta) > ##D # For specifically presenting the Fisher combinations: > ##D # First determine the number of estimated effects: > ##D (neff <- sum(sapply(meta, function(x){ifelse(is.list(x), > ##D !is.null(x$cjplus),FALSE)}))) > ##D Fishers <- t(sapply(1:neff, > ##D function(i){c(meta[[i]]$cjplus, meta[[i]]$cjminus, > ##D meta[[i]]$cjplusp, meta[[i]]$cjminusp, 2*meta[[i]]$n1 )})) > ##D Fishers <- as.data.frame(Fishers, row.names=names(meta)[1:neff]) > ##D names(Fishers) <- c('Fplus', 'Fminus', 'pplus', 'pminus', 'df') > ##D Fishers > ##D # For plotting: > ##D plo <- plot(meta, layout = c(3,1)) > ##D plo > ##D plo[3] > ##D # Show effects of bound (bounding at 0.4 is not reasonable, just for example) > ##D meta <- siena08(ans.1, ans.3, ans.4, bound=0.4) > ##D plot(meta, which=c(2,3), layout=c(2,1)) > ##D plot(meta, which=c(2,3), layout=c(2,1), useBound=FALSE) > ##D meta.table(meta, option=3, file='') > ## End(Not run) > > > cleanEx() > nameEx("print.sienaTest") > ### * print.sienaTest > > flush(stderr()); flush(stdout()) > > ### Name: print.sienaTest > ### Title: Print method for Wald and score tests for RSiena results > ### Aliases: print.sienaTest sienaTest.methods > ### Keywords: print > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > mydata <- sienaDataCreate(mynet) > myeff <- getEffects(mydata) > myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=40, seed=123, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > # nsub=1 and n3=40 is used here for having a brief computation, > # not for practice. > myeff <- includeEffects(myeff, transTrip, transTies) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 2 transitive ties TRUE FALSE FALSE 0 0 > myeff <- includeEffects(myeff, outAct, outPop, fix=TRUE, test=TRUE) effectName include fix test initialValue parm 1 outdegree - popularity TRUE TRUE TRUE 0 0 2 outdegree - activity TRUE TRUE TRUE 0 0 > (ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE)) Start phase 0 theta: -1.49 0.00 0.00 0.00 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 4% Phase 1 Iteration 30 Progress: 5% Phase 1 Iteration 35 Progress: 6% Phase 1 Iteration 40 Progress: 6% Phase 1 Iteration 45 Progress: 7% Phase 1 Iteration 50 Progress: 8% theta: -1.691 0.394 0.419 -0.246 0.000 0.000 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 56% Phase 2 Subphase 1 Iteration 2 Progress: 57% theta -1.813 0.601 0.621 -0.194 0.000 0.000 ac 0.1331 1.8626 5.8043 6.1750 0.0164 0.2778 Phase 2 Subphase 1 Iteration 3 Progress: 57% Phase 2 Subphase 1 Iteration 4 Progress: 57% theta -2.2986 1.6068 0.9898 -0.0947 0.0000 0.0000 ac 0.3221 0.1176 -0.0470 -0.0484 0.2892 0.3335 Phase 2 Subphase 1 Iteration 5 Progress: 57% Phase 2 Subphase 1 Iteration 6 Progress: 57% theta -2.483 2.122 0.619 0.267 0.000 0.000 ac 0.571 0.413 0.169 0.277 0.611 0.591 Phase 2 Subphase 1 Iteration 7 Progress: 57% Phase 2 Subphase 1 Iteration 8 Progress: 58% theta -2.606 2.277 0.263 0.412 0.000 0.000 ac 0.567 0.427 0.151 0.199 0.613 0.594 Phase 2 Subphase 1 Iteration 9 Progress: 58% Phase 2 Subphase 1 Iteration 10 Progress: 58% theta -2.751 2.306 0.273 0.537 0.000 0.000 ac 0.556 0.441 0.145 0.194 0.614 0.607 theta -2.673 2.086 0.291 0.683 0.000 0.000 ac -0.00724 -0.23041 -0.15029 -0.29298 0.23609 0.23514 theta: -2.673 2.086 0.291 0.683 0.000 0.000 Start phase 3 Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 6.8214 ( 1.2733 ) Other parameters: 1. eval outdegree (density) -2.6729 ( 0.1762 ) -0.0968 2. eval reciprocity 2.0859 ( 0.3172 ) -0.1183 3. eval transitive triplets 0.2913 ( 0.6362 ) -0.0741 4. eval transitive ties 0.6835 ( 1.3012 ) -0.0611 5. eval outdegree - popularity 0.0000 ( NA ) 0.6060 6. eval outdegree - activity 0.0000 ( NA ) 0.4845 Overall maximum convergence ratio: 0.1743 Score test for 2 parameters: chi-squared = 11.49, p = 0.0032. Total of 166 iteration steps. > mprs <- Multipar.RSiena(ans, 3, 4) > print(mprs) Tested effects: transitive triplets transitive ties chi-squared = 16.52, d.f. = 2; p < 0.001. > > > > cleanEx() > nameEx("print01Report") > ### * print01Report > > flush(stderr()); flush(stdout()) > > ### Name: print01Report > ### Title: Function to produce the Siena01 report from R objects > ### Aliases: print01Report > ### Keywords: print > > ### ** Examples > > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mydata <- sienaDataCreate(mynet1) > ## Not run: > ##D print01Report(mydata, modelname="mydescription") > ## End(Not run) > > > > cleanEx() > nameEx("s50") > ### * s50 > > flush(stderr()); flush(stdout()) > > ### Name: s50 > ### Title: Network data: excerpt from "Teenage Friends and Lifestyle Study" > ### data. > ### Aliases: s50 > ### Keywords: datasets > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mydata <- sienaDataCreate(mynet, mybeh) > mydata Dependent variables: mynet, mybeh Number of observations: 3 Nodeset Actors Number of nodes 50 Dependent variable mynet Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.047 0.05 Dependent variable mybeh Type behavior Observations 3 Nodeset Actors Range 1 - 5 > > > > cleanEx() > nameEx("s503") > ### * s503 > > flush(stderr()); flush(stdout()) > > ### Name: s503 > ### Title: Network 3 data: excerpt from "Teenage Friends and Lifestyle > ### Study" data. > ### Aliases: s503 > ### Keywords: datasets > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mydata <- sienaDataCreate(mynet, mybeh) > > > > cleanEx() > nameEx("s50a") > ### * s50a > > flush(stderr()); flush(stdout()) > > ### Name: s50a > ### Title: Alcohol use data: excerpt from "Teenage Friends and Lifestyle > ### Study" data > ### Aliases: s50a > ### Keywords: datasets > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mydata <- sienaDataCreate(mynet, mybeh) > mydata Dependent variables: mynet, mybeh Number of observations: 3 Nodeset Actors Number of nodes 50 Dependent variable mynet Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.047 0.05 Dependent variable mybeh Type behavior Observations 3 Nodeset Actors Range 1 - 5 > > > > cleanEx() > nameEx("s50s") > ### * s50s > > flush(stderr()); flush(stdout()) > > ### Name: s50s > ### Title: Smoking data: excerpt from "Teenage Friends and Lifestyle Study" > ### data > ### Aliases: s50s > ### Keywords: datasets > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > myvar <- varCovar(s50s) > mydata <- sienaDataCreate(mynet, myvar) > mydata Dependent variables: mynet Number of observations: 3 Nodeset Actors Number of nodes 50 Dependent variable mynet Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.047 0.05 Changing covariates: myvar > > > > cleanEx() > nameEx("setEffect") > ### * setEffect > > flush(stderr()); flush(stdout()) > > ### Name: setEffect > ### Title: Function to set various columns in an effects object in a Siena > ### model. > ### Aliases: setEffect > ### Keywords: classes > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mydata <- sienaDataCreate(mynet, mybeh) > myeff <- getEffects(mydata) > # Specify an effect parameter: > myeff <- setEffect(myeff, outTrunc, parameter=1) effectName include fix test initialValue parm 1 outdegree-trunc(#) TRUE FALSE FALSE 0 1 > myeff name effectName include fix test initialValue parm 1 mynet constant mynet rate (period 1) TRUE FALSE FALSE 4.69604 0 2 mynet constant mynet rate (period 2) TRUE FALSE FALSE 4.32885 0 3 mynet outdegree (density) TRUE FALSE FALSE -1.46770 0 4 mynet reciprocity TRUE FALSE FALSE 0.00000 0 5 mynet outdegree-trunc(#) TRUE FALSE FALSE 0.00000 1 6 mybeh rate mybeh (period 1) TRUE FALSE FALSE 0.70571 0 7 mybeh rate mybeh (period 2) TRUE FALSE FALSE 0.84939 0 8 mybeh mybeh linear shape TRUE FALSE FALSE 0.32237 0 9 mybeh mybeh quadratic shape TRUE FALSE FALSE 0.00000 0 > # Set the initial rate parameter for one period: > myeff <- setEffect(myeff, Rate, initialValue=1.5, name="mybeh", + type="rate", period=2) effectName include fix test initialValue parm 1 rate mybeh (period 2) TRUE FALSE FALSE 1.5 0 > > > > cleanEx() > nameEx("siena07") > ### * siena07 > > flush(stderr()); flush(stdout()) > > ### Name: siena07 > ### Title: Function to estimate parameters in a Siena model > ### Aliases: siena07 > ### Keywords: models > > ### ** Examples > > myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100, seed=1293) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > # nsub=2, n3=100 is used here for having a brief computation, not for practice. > mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > mydata <- sienaDataCreate(mynet1) > myeff <- getEffects(mydata) > ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) Start phase 0 theta: -0.56 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 3% Phase 1 Iteration 30 Progress: 4% Phase 1 Iteration 35 Progress: 5% Phase 1 Iteration 40 Progress: 6% Phase 1 Iteration 45 Progress: 6% Phase 1 Iteration 50 Progress: 7% theta: -0.622 0.311 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 21% Phase 2 Subphase 1 Iteration 2 Progress: 21% theta -0.699 0.762 ac 0.143 2.034 Phase 2 Subphase 1 Iteration 3 Progress: 21% Phase 2 Subphase 1 Iteration 4 Progress: 21% theta -0.963 1.700 ac 0.234 1.979 Phase 2 Subphase 1 Iteration 5 Progress: 21% Phase 2 Subphase 1 Iteration 6 Progress: 21% theta -1.14 2.02 ac 0.219 1.979 Phase 2 Subphase 1 Iteration 7 Progress: 22% Phase 2 Subphase 1 Iteration 8 Progress: 22% theta -1.22 1.99 ac 0.223 1.968 Phase 2 Subphase 1 Iteration 9 Progress: 22% Phase 2 Subphase 1 Iteration 10 Progress: 22% theta -1.24 1.97 ac 0.267 0.740 theta -1.15 1.78 ac -0.00224 -0.21418 theta: -1.15 1.78 Start phase 2.2 Phase 2 Subphase 2 Iteration 1 Progress: 51% Phase 2 Subphase 2 Iteration 2 Progress: 51% Phase 2 Subphase 2 Iteration 3 Progress: 52% Phase 2 Subphase 2 Iteration 4 Progress: 52% Phase 2 Subphase 2 Iteration 5 Progress: 52% Phase 2 Subphase 2 Iteration 6 Progress: 52% Phase 2 Subphase 2 Iteration 7 Progress: 52% Phase 2 Subphase 2 Iteration 8 Progress: 52% Phase 2 Subphase 2 Iteration 9 Progress: 52% Phase 2 Subphase 2 Iteration 10 Progress: 53% theta -1.13 1.79 ac -0.13555 -0.00968 theta: -1.13 1.79 Start phase 3 Phase 3 Iteration 100 Progress 100% > > # or for non-conditional estimation -------------------------------------------- > ## Not run: > ##D model <- sienaAlgorithmCreate(nsub=2, n3=100, cond=FALSE, seed=1283) > ##D ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) > ##D > ## End(Not run) > > # or if a previous "on track" result ans was obtained -------------------------- > ## Not run: > ##D ans1 <- siena07(myalgorithm, data=mydata, effects=myeff, prevAns=ans) > ##D > ## End(Not run) > > # Running in multiple processors ----------------------------------------------- > ## Not run: > ##D # Not tested because dependent on presence of processors > ##D # Find out how many processors there are > ##D library(parallel) > ##D (n.clus <- detectCores() - 1) > ##D n.clus <- min(n.clus, 4) # keep time for other processes > ##D ans2 <- siena07(myalgorithm, data=mydata, effects=myeff, > ##D useCluster=TRUE, nbrNodes=n.clus, initC=TRUE) > ##D > ##D # Suppose 8 processors are going to be used. > ##D # Loading the parallel package and creating a cluster > ##D # with 8 processors (this should be equivalent) > ##D > ##D library(parallel) > ##D cl <- makeCluster(n.clus) > ##D > ##D ans3 <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE, cl = cl) > ##D > ##D # Notice that now -siena07- perhaps won't stop the cluster for you. > ##D # stopCluster(cl) > ##D > ##D # You can create even more complex clusters using several computers. In this > ##D # example we are creating a cluster with 3*8 = 24 processors on three > ##D # different machines. > ##D #cl <- makePSOCKcluster( > ##D # rep(c('localhost', 'machine2.website.com' , 'machine3.website.com'), 8), > ##D # user='myusername', rshcmd='ssh -p PORTNUMBER') > ##D > ##D #ans4 <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE, cl = cl) > ##D #stopCluster(cl) > ## End(Not run) > > # for a continuous behavior variable ------------------------------------------- > # simulate behavior data according to dZ(t) = [-0.1 Z + 1] dt + 1 dW(t) > set.seed(123) > 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 <- sienaDependent(array(c(s501, s502), dim = c(50,50,2))) > behavior <- sienaDependent(matrix(c(y1,y2), 50,2), type = "continuous") > (mydata <- sienaDataCreate(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 <- getEffects(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 > algorithmMoM <- sienaAlgorithmCreate(nsub=1, n3=20, seed=321) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > (ans <- siena07(myalgorithm, data = mydata, effects = myeff, batch=TRUE)) SDE init parameters: -0.1117176 -0.864023 0.8576913 SDE par stand errors: 0.04669358 0.1223113 0.08791327 Start phase 0 theta: 4.696 -1.489 0.000 0.858 -0.112 -0.864 1.000 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 0% Phase 1 Iteration 5 Progress: 0% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 1% Phase 1 Iteration 20 Progress: 2% Phase 1 Iteration 25 Progress: 2% Phase 1 Iteration 30 Progress: 3% Phase 1 Iteration 35 Progress: 3% Phase 1 Iteration 40 Progress: 4% Phase 1 Iteration 45 Progress: 4% Phase 1 Iteration 50 Progress: 5% theta: 5.030 -1.547 0.402 0.855 -0.118 -0.913 1.000 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 39% Phase 2 Subphase 1 Iteration 2 Progress: 39% theta 5.1237 -1.5736 1.0785 0.8745 -0.0999 -0.9241 1.0000 ac 2.021 0.492 2.532 0.954 0.256 0.894 1.028 Phase 2 Subphase 1 Iteration 3 Progress: 39% Phase 2 Subphase 1 Iteration 4 Progress: 39% theta 4.9023 -1.6610 2.0218 0.9370 -0.0836 -0.9094 1.0000 ac 2.076 0.865 1.702 0.758 0.299 1.191 0.729 Phase 2 Subphase 1 Iteration 5 Progress: 40% Phase 2 Subphase 1 Iteration 6 Progress: 40% theta 4.273 -1.796 2.026 0.980 -0.112 -0.870 1.000 ac 2.019 1.012 1.760 0.580 0.443 0.949 0.585 Phase 2 Subphase 1 Iteration 7 Progress: 40% Phase 2 Subphase 1 Iteration 8 Progress: 40% theta 4.243 -1.915 2.170 1.023 -0.137 -0.881 1.000 ac 2.154 1.059 1.795 0.356 0.454 0.911 0.387 Phase 2 Subphase 1 Iteration 9 Progress: 40% Phase 2 Subphase 1 Iteration 10 Progress: 40% theta 4.783 -2.120 2.211 1.006 -0.171 -0.926 1.000 ac 1.673 1.065 1.673 0.734 0.727 0.899 0.763 Phase 2 Subphase 1 Iteration 100 Progress: 50% theta 4.932 -2.265 2.438 0.819 -0.103 -0.837 1.000 ac 0.0602 0.6676 0.5016 0.4129 0.8645 0.8030 0.4077 Phase 2 Subphase 1 Iteration 200 Progress: 60% theta 4.862 -2.216 2.313 0.891 -0.110 -0.840 1.000 ac 0.0957 0.4933 0.1438 0.2613 0.8324 0.7316 0.2642 theta 5.445 -2.256 2.475 0.873 -0.113 -0.865 1.000 ac 0.0665 0.4569 0.1386 0.1945 0.8026 0.6952 0.1899 theta: 5.445 -2.256 2.475 0.873 -0.113 -0.865 1.000 Start phase 2.2 Phase 2 Subphase 2 Iteration 1 Progress: 62% Phase 2 Subphase 2 Iteration 2 Progress: 62% Phase 2 Subphase 2 Iteration 3 Progress: 62% Phase 2 Subphase 2 Iteration 4 Progress: 62% Phase 2 Subphase 2 Iteration 5 Progress: 63% Phase 2 Subphase 2 Iteration 6 Progress: 63% Phase 2 Subphase 2 Iteration 7 Progress: 63% Phase 2 Subphase 2 Iteration 8 Progress: 63% Phase 2 Subphase 2 Iteration 9 Progress: 63% Phase 2 Subphase 2 Iteration 10 Progress: 63% Phase 2 Subphase 2 Iteration 100 Progress: 73% theta 5.358 -2.153 2.232 0.865 -0.117 -0.869 1.000 ac -0.187 0.485 0.161 -0.110 0.594 0.408 -0.133 Phase 2 Subphase 2 Iteration 200 Progress: 83% theta 5.816 -2.258 2.439 0.819 -0.112 -0.864 1.000 ac -0.1547 0.3007 0.0535 -0.0812 0.4677 0.4396 -0.0938 theta 5.517 -2.221 2.424 0.848 -0.110 -0.863 1.000 ac -0.0856 0.2729 0.0749 -0.0578 0.5103 0.5349 -0.0734 theta: 5.517 -2.221 2.424 0.848 -0.110 -0.863 1.000 Start phase 3 Phase 3 Iteration 50 Progress 95% Phase 3 Iteration 100 Progress 100% Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Network Dynamics 1. rate basic rate parameter friend 5.5171 ( 0.7742 ) 0.1425 2. eval outdegree (density) -2.2206 ( 0.1168 ) 0.1181 3. eval reciprocity 2.4241 ( 0.2408 ) 0.0783 Continuous Behavior Dynamics 4. eval wiener (behavior.behavior) 0.8483 ( 0.0221 ) -0.1528 5. eval feedback from behavior -0.1102 ( 0.0499 ) 0.1276 6. eval intercept -0.8630 ( 0.1372 ) 0.0577 7. rate scale parameter period 1 1.0000 ( NA ) -0.1528 Overall maximum convergence ratio: 0.2714 Total of 673 iteration steps. > > # Accessing simulated networks for ML ------------------------------------------ > # The following is an example for accessing the simulated networks for ML, > # which makes sense only if there are some missing tie variables; > # observed tie variables are identically simulated > # at the moment of observation, > # missing tie variable are imputed in a model-based way. > mat1 <- matrix(c(0,0,1,1, + 1,0,0,0, + 0,0,0,1, + 0,1,0,0),4,4, byrow=TRUE) > mat2 <- matrix(c(0,1,1,1, + 1,0,0,0, + 0,0,0,1, + 0,0,1,0),4,4, byrow=TRUE) > mat3 <- matrix(c(0,1,0,1, + 1,0,0,0, + 0,0,0,0, + NA,1,1,0),4,4, byrow=TRUE) > mats <- array(c(mat1,mat2,mat3), dim=c(4,4,3)) > net <- sienaDependent(mats, allowOnly=FALSE) > sdat <- sienaDataCreate(net) > alg <- sienaAlgorithmCreate(maxlike=TRUE, nsub=3, n3=100, seed=12534) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > effs <- getEffects(sdat) > (ans <- siena07(alg, data=sdat, effects=effs, returnDeps=TRUE, batch=TRUE)) ==2826240== Invalid write of size 4 ==2826240== at 0x1C43453D: mlMakeChains (packages/tests-vg/RSiena/src/siena07setup.cpp:1069) ==2826240== by 0x4A470D: R_doDotCall (svn/R-devel/src/main/dotcode.c:790) ==2826240== by 0x4A4D13: do_dotcall (svn/R-devel/src/main/dotcode.c:1437) ==2826240== by 0x4DF9AA: bcEval_loop (svn/R-devel/src/main/eval.c:8141) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7524) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7509) ==2826240== by 0x4F667A: Rf_eval (svn/R-devel/src/main/eval.c:1167) ==2826240== by 0x4F857D: R_execClosure (svn/R-devel/src/main/eval.c:2398) ==2826240== by 0x4F92D6: applyClosure_core (svn/R-devel/src/main/eval.c:2311) ==2826240== by 0x4F6785: Rf_applyClosure (svn/R-devel/src/main/eval.c:2333) ==2826240== by 0x4F6785: Rf_eval (svn/R-devel/src/main/eval.c:1285) ==2826240== by 0x4FB39C: do_set (svn/R-devel/src/main/eval.c:3582) ==2826240== by 0x4F6A22: Rf_eval (svn/R-devel/src/main/eval.c:1237) ==2826240== by 0x4FB530: Rf_evalList (svn/R-devel/src/main/eval.c:3680) ==2826240== Address 0x1b0e20bc is 1,884 bytes inside a block of size 7,960 alloc'd ==2826240== at 0x484280F: malloc (/builddir/build/BUILD/valgrind-3.22.0/coregrind/m_replacemalloc/vg_replace_malloc.c:442) ==2826240== by 0x535770: GetNewPage (svn/R-devel/src/main/memory.c:998) ==2826240== by 0x5374BB: Rf_allocVector3 (svn/R-devel/src/main/memory.c:2862) ==2826240== by 0x597FBF: Rf_allocVector (svn/R-devel/src/include/Rinlinedfuns.h:595) ==2826240== by 0x597FBF: readRawFromFile (svn/R-devel/src/main/serialize.c:3112) ==2826240== by 0x597FBF: do_lazyLoadDBfetch (svn/R-devel/src/main/serialize.c:3296) ==2826240== by 0x4F6B65: Rf_eval (svn/R-devel/src/main/eval.c:1269) ==2826240== by 0x4F6F5E: forcePromise (svn/R-devel/src/main/eval.c:976) ==2826240== by 0x4F6F5E: forcePromise (svn/R-devel/src/main/eval.c:954) ==2826240== by 0x4F6957: Rf_eval (svn/R-devel/src/main/eval.c:1198) ==2826240== by 0x5B9C86: do_subset2_dflt (svn/R-devel/src/main/subset.c:1012) ==2826240== by 0x4D35E8: VECSUBSET_PTR (svn/R-devel/src/main/eval.c:6374) ==2826240== by 0x4E3789: bcEval_loop (svn/R-devel/src/main/eval.c:8678) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7524) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7509) ==2826240== by 0x4F667A: Rf_eval (svn/R-devel/src/main/eval.c:1167) ==2826240== ==2826240== Invalid write of size 4 ==2826240== at 0x1C434589: mlMakeChains (packages/tests-vg/RSiena/src/siena07setup.cpp:1072) ==2826240== by 0x4A470D: R_doDotCall (svn/R-devel/src/main/dotcode.c:790) ==2826240== by 0x4A4D13: do_dotcall (svn/R-devel/src/main/dotcode.c:1437) ==2826240== by 0x4DF9AA: bcEval_loop (svn/R-devel/src/main/eval.c:8141) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7524) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7509) ==2826240== by 0x4F667A: Rf_eval (svn/R-devel/src/main/eval.c:1167) ==2826240== by 0x4F857D: R_execClosure (svn/R-devel/src/main/eval.c:2398) ==2826240== by 0x4F92D6: applyClosure_core (svn/R-devel/src/main/eval.c:2311) ==2826240== by 0x4F6785: Rf_applyClosure (svn/R-devel/src/main/eval.c:2333) ==2826240== by 0x4F6785: Rf_eval (svn/R-devel/src/main/eval.c:1285) ==2826240== by 0x4FB39C: do_set (svn/R-devel/src/main/eval.c:3582) ==2826240== by 0x4F6A22: Rf_eval (svn/R-devel/src/main/eval.c:1237) ==2826240== by 0x4FB530: Rf_evalList (svn/R-devel/src/main/eval.c:3680) ==2826240== Address 0x1b0e219c is 2,108 bytes inside a block of size 7,960 alloc'd ==2826240== at 0x484280F: malloc (/builddir/build/BUILD/valgrind-3.22.0/coregrind/m_replacemalloc/vg_replace_malloc.c:442) ==2826240== by 0x535770: GetNewPage (svn/R-devel/src/main/memory.c:998) ==2826240== by 0x5374BB: Rf_allocVector3 (svn/R-devel/src/main/memory.c:2862) ==2826240== by 0x597FBF: Rf_allocVector (svn/R-devel/src/include/Rinlinedfuns.h:595) ==2826240== by 0x597FBF: readRawFromFile (svn/R-devel/src/main/serialize.c:3112) ==2826240== by 0x597FBF: do_lazyLoadDBfetch (svn/R-devel/src/main/serialize.c:3296) ==2826240== by 0x4F6B65: Rf_eval (svn/R-devel/src/main/eval.c:1269) ==2826240== by 0x4F6F5E: forcePromise (svn/R-devel/src/main/eval.c:976) ==2826240== by 0x4F6F5E: forcePromise (svn/R-devel/src/main/eval.c:954) ==2826240== by 0x4F6957: Rf_eval (svn/R-devel/src/main/eval.c:1198) ==2826240== by 0x5B9C86: do_subset2_dflt (svn/R-devel/src/main/subset.c:1012) ==2826240== by 0x4D35E8: VECSUBSET_PTR (svn/R-devel/src/main/eval.c:6374) ==2826240== by 0x4E3789: bcEval_loop (svn/R-devel/src/main/eval.c:8678) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7524) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7509) ==2826240== by 0x4F667A: Rf_eval (svn/R-devel/src/main/eval.c:1167) ==2826240== ==2826240== Invalid write of size 4 ==2826240== at 0x1C43459D: mlMakeChains (packages/tests-vg/RSiena/src/siena07setup.cpp:1073) ==2826240== by 0x4A470D: R_doDotCall (svn/R-devel/src/main/dotcode.c:790) ==2826240== by 0x4A4D13: do_dotcall (svn/R-devel/src/main/dotcode.c:1437) ==2826240== by 0x4DF9AA: bcEval_loop (svn/R-devel/src/main/eval.c:8141) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7524) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7509) ==2826240== by 0x4F667A: Rf_eval (svn/R-devel/src/main/eval.c:1167) ==2826240== by 0x4F857D: R_execClosure (svn/R-devel/src/main/eval.c:2398) ==2826240== by 0x4F92D6: applyClosure_core (svn/R-devel/src/main/eval.c:2311) ==2826240== by 0x4F6785: Rf_applyClosure (svn/R-devel/src/main/eval.c:2333) ==2826240== by 0x4F6785: Rf_eval (svn/R-devel/src/main/eval.c:1285) ==2826240== by 0x4FB39C: do_set (svn/R-devel/src/main/eval.c:3582) ==2826240== by 0x4F6A22: Rf_eval (svn/R-devel/src/main/eval.c:1237) ==2826240== by 0x4FB530: Rf_evalList (svn/R-devel/src/main/eval.c:3680) ==2826240== Address 0x1b0e212c is 1,996 bytes inside a block of size 7,960 alloc'd ==2826240== at 0x484280F: malloc (/builddir/build/BUILD/valgrind-3.22.0/coregrind/m_replacemalloc/vg_replace_malloc.c:442) ==2826240== by 0x535770: GetNewPage (svn/R-devel/src/main/memory.c:998) ==2826240== by 0x5374BB: Rf_allocVector3 (svn/R-devel/src/main/memory.c:2862) ==2826240== by 0x597FBF: Rf_allocVector (svn/R-devel/src/include/Rinlinedfuns.h:595) ==2826240== by 0x597FBF: readRawFromFile (svn/R-devel/src/main/serialize.c:3112) ==2826240== by 0x597FBF: do_lazyLoadDBfetch (svn/R-devel/src/main/serialize.c:3296) ==2826240== by 0x4F6B65: Rf_eval (svn/R-devel/src/main/eval.c:1269) ==2826240== by 0x4F6F5E: forcePromise (svn/R-devel/src/main/eval.c:976) ==2826240== by 0x4F6F5E: forcePromise (svn/R-devel/src/main/eval.c:954) ==2826240== by 0x4F6957: Rf_eval (svn/R-devel/src/main/eval.c:1198) ==2826240== by 0x5B9C86: do_subset2_dflt (svn/R-devel/src/main/subset.c:1012) ==2826240== by 0x4D35E8: VECSUBSET_PTR (svn/R-devel/src/main/eval.c:6374) ==2826240== by 0x4E3789: bcEval_loop (svn/R-devel/src/main/eval.c:8678) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7524) ==2826240== by 0x4F63CF: bcEval (svn/R-devel/src/main/eval.c:7509) ==2826240== by 0x4F667A: Rf_eval (svn/R-devel/src/main/eval.c:1167) ==2826240== Start phase 0 theta: 1.9077 2.0667 -0.0408 0.0000 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 0% Phase 1 Iteration 5 Progress: 0% Phase 1 Iteration 6 Progress: 1% Phase 1 Iteration 7 Progress: 1% Phase 1 Iteration 8 Progress: 1% Phase 1 Iteration 9 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 11 Progress: 1% Phase 1 Iteration 12 Progress: 1% Phase 1 Iteration 13 Progress: 1% Phase 1 Iteration 14 Progress: 1% Phase 1 Iteration 15 Progress: 1% Phase 1 Iteration 16 Progress: 2% Phase 1 Iteration 17 Progress: 2% Phase 1 Iteration 18 Progress: 2% Phase 1 Iteration 19 Progress: 2% theta: 1.9077 2.0667 -0.0355 0.0258 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 9% Phase 2 Subphase 1 Iteration 2 Progress: 9% theta 1.908 2.067 -0.126 0.132 ac -2.000 -2.000 -0.742 0.122 Phase 2 Subphase 1 Iteration 3 Progress: 9% Phase 2 Subphase 1 Iteration 4 Progress: 9% theta 1.908 2.067 -0.282 0.557 ac -2.000 -2.000 -0.775 -0.302 Phase 2 Subphase 1 Iteration 5 Progress: 9% Phase 2 Subphase 1 Iteration 6 Progress: 10% theta 1.908 2.067 -0.285 0.614 ac -2.000 -2.000 -0.335 -0.307 Phase 2 Subphase 1 Iteration 7 Progress: 10% Phase 2 Subphase 1 Iteration 8 Progress: 10% theta 1.908 2.067 -0.263 0.726 ac -2.000 -2.000 -0.402 -0.488 Phase 2 Subphase 1 Iteration 9 Progress: 10% Phase 2 Subphase 1 Iteration 10 Progress: 10% theta 1.908 2.067 -0.232 0.729 ac -2.000 -2.000 -0.470 -0.468 Phase 2 Subphase 1 Iteration 200 Progress: 29% theta 1.908 2.067 -0.228 0.594 ac -2.000 -2.000 0.202 0.198 theta 1.908 2.067 -0.316 0.628 ac -2.000 -2.000 0.179 0.229 theta: 1.908 2.067 -0.316 0.628 Start phase 2.2 Phase 2 Subphase 2 Iteration 1 Progress: 30% Phase 2 Subphase 2 Iteration 2 Progress: 31% Phase 2 Subphase 2 Iteration 3 Progress: 31% Phase 2 Subphase 2 Iteration 4 Progress: 31% Phase 2 Subphase 2 Iteration 5 Progress: 31% Phase 2 Subphase 2 Iteration 6 Progress: 31% Phase 2 Subphase 2 Iteration 7 Progress: 31% Phase 2 Subphase 2 Iteration 8 Progress: 31% Phase 2 Subphase 2 Iteration 9 Progress: 31% Phase 2 Subphase 2 Iteration 10 Progress: 31% Phase 2 Subphase 2 Iteration 200 Progress: 50% theta 1.908 2.067 -0.477 1.107 ac 0.484 0.452 0.405 0.712 theta 1.908 2.067 -0.369 0.810 ac 0.573 0.417 0.454 0.712 theta: 1.908 2.067 -0.369 0.810 Start phase 2.3 Phase 2 Subphase 3 Iteration 1 Progress: 56% Phase 2 Subphase 3 Iteration 2 Progress: 56% Phase 2 Subphase 3 Iteration 3 Progress: 56% Phase 2 Subphase 3 Iteration 4 Progress: 56% Phase 2 Subphase 3 Iteration 5 Progress: 56% Phase 2 Subphase 3 Iteration 6 Progress: 56% Phase 2 Subphase 3 Iteration 7 Progress: 56% Phase 2 Subphase 3 Iteration 8 Progress: 56% Phase 2 Subphase 3 Iteration 9 Progress: 56% Phase 2 Subphase 3 Iteration 10 Progress: 57% Phase 2 Subphase 3 Iteration 200 Progress: 75% theta 1.908 2.067 -0.158 0.359 ac 0.404 0.600 0.349 0.347 theta 1.908 2.067 -0.218 0.444 ac 0.450 0.556 0.353 0.259 theta: 1.908 2.067 -0.218 0.444 Start phase 3 Estimated by Maximum Likelihood Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate constant net rate (period 1) 1.9077 ( NA ) 0.0000 2. rate constant net rate (period 2) 2.0667 ( NA ) 0.0000 3. eval outdegree (density) -0.2182 ( 0.7184 ) -0.2215 4. eval reciprocity 0.4439 ( 1.1982 ) -0.1650 Overall maximum convergence ratio: 0.2267 Total of 985 iteration steps. > # See manual Section 9.1 for information about the following functions > edges.to.adj <- function(x,n){ + # create empty adjacency matrix + adj <- matrix(0, n, n) + # put edge values in desired places + adj[x[, 1:2]] <- x[, 3] + adj + } > the.edge <- function(x,n,h,k){ + edges.to.adj(x,n)[h,k] + } > # Now show the results > n <- 4 > ego <- rep.int(1:n,n) > alter <- rep(1:n, each=n) > # Get the average simulated adjacency matrices for wave 3 (period 2): > ones <- sapply(1:n^2, function(i) + {mean(sapply(ans$sims, + function(x){the.edge(x[[1]][[2]][[1]],n,ego[i],alter[i])}))}) > # Note that for maximum likelihood estimation, > # if there is one group and one period, > # the nesting levels for group and period are dropped from ans$sims. > cbind(ego,alter,ones) ego alter ones [1,] 1 1 0.00 [2,] 2 1 1.00 [3,] 3 1 0.00 [4,] 4 1 0.42 [5,] 1 2 1.00 [6,] 2 2 0.00 [7,] 3 2 0.00 [8,] 4 2 1.00 [9,] 1 3 0.00 [10,] 2 3 0.00 [11,] 3 3 0.00 [12,] 4 3 1.00 [13,] 1 4 1.00 [14,] 2 4 0.00 [15,] 3 4 0.00 [16,] 4 4 0.00 > matrix(ones,n,n) [,1] [,2] [,3] [,4] [1,] 0.00 1 0 1 [2,] 1.00 0 0 0 [3,] 0.00 0 0 0 [4,] 0.42 1 1 0 > > > > cleanEx() > nameEx("siena08") > ### * siena08 > > flush(stderr()); flush(stdout()) > > ### Name: siena08 > ### Title: Function to perform a meta analysis of a collection of Siena > ### fits. > ### Aliases: siena08 sienaMeta > ### Keywords: models > > ### ** Examples > > ## Not run: > ##D # A meta-analysis for three groups does not make much sense > ##D # for generalizing to a population of networks, > ##D # but the Fisher combinations of p-values are meaningful. > ##D # However, using three groups does show the idea. > ##D > ##D Group1 <- sienaDependent(array(c(N3401, HN3401), dim=c(45, 45, 2))) > ##D Group3 <- sienaDependent(array(c(N3403, HN3403), dim=c(37, 37, 2))) > ##D Group4 <- sienaDependent(array(c(N3404, HN3404), dim=c(33, 33, 2))) > ##D dataset.1 <- sienaDataCreate(Friends = Group1) > ##D dataset.3 <- sienaDataCreate(Friends = Group3) > ##D dataset.4 <- sienaDataCreate(Friends = Group4) > ##D OneAlgorithm <- sienaAlgorithmCreate(projname = "SingleGroups", seed=128) > ##D effects.1 <- getEffects(dataset.1) > ##D effects.3 <- getEffects(dataset.3) > ##D effects.4 <- getEffects(dataset.4) > ##D effects.1 <- includeEffects(effects.1, transTrip) > ##D effects.1 <- setEffect(effects.1, transRecTrip, fix=TRUE, test=TRUE) > ##D effects.3 <- includeEffects(effects.3, transTrip) > ##D effects.3 <- setEffect(effects.3, transRecTrip, fix=TRUE, test=TRUE) > ##D effects.4 <- includeEffects(effects.4, transTrip) > ##D effects.4 <- setEffect(effects.4, transRecTrip, fix=TRUE, test=TRUE) > ##D ans.1 <- siena07(OneAlgorithm, data=dataset.1, effects=effects.1, batch=TRUE) > ##D ans.3 <- siena07(OneAlgorithm, data=dataset.3, effects=effects.3, batch=TRUE) > ##D ans.4 <- siena07(OneAlgorithm, data=dataset.4, effects=effects.4, batch=TRUE) > ##D ans.1 > ##D ans.3 > ##D ans.4 > ##D (meta <- siena08(ans.1, ans.3, ans.4)) > ##D plot(meta, which=2:3, layout = c(2,1)) > ##D # For specifically presenting the Fisher combinations: > ##D # First determine the components of meta with estimated effects: > ##D which.est <- sapply(meta, function(x){ifelse(is.list(x),!is.null(x$cjplus),FALSE)}) > ##D Fishers <- t(sapply(1:sum(which.est), > ##D function(i){c(meta[[i]]$cjplus, meta[[i]]$cjminus, > ##D meta[[i]]$cjplusp, meta[[i]]$cjminusp, 2*meta[[i]]$n1 )})) > ##D Fishers <- as.data.frame(Fishers, row.names=names(meta)[which.est]) > ##D names(Fishers) <- c('Fplus', 'Fminus', 'pplus', 'pminus', 'df') > ##D Fishers > ##D round(Fishers,4) > ## End(Not run) > > > > cleanEx() > nameEx("sienaAlgorithmCreate") > ### * sienaAlgorithmCreate > > flush(stderr()); flush(stdout()) > > ### Name: sienaAlgorithmCreate > ### Title: Function to create an object containing the algorithm > ### specifications for parameter estimation in RSiena > ### Aliases: sienaModelCreate sienaAlgorithmCreate sienaModel > ### sienaAlgorithm model.create > ### Keywords: classes > > ### ** Examples > > myAlgorithm <- sienaAlgorithmCreate(projname="NetworkDyn") If you use this algorithm object, siena07 will create/use an output file Siena.txt . > StdAlgorithm <- sienaAlgorithmCreate(projname="NetworkDyn", useStdInits=TRUE) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > CondAlgorithm <- sienaAlgorithmCreate(projname="NetworkDyn", condvarno=1, cond=TRUE) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > Max10Algorithm <- sienaAlgorithmCreate(projname="NetworkDyn", MaxDegree=c(mynet=10), + modelType=c(mynet=1)) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > Beh2Algorithm <- sienaAlgorithmCreate(projname="NetBehDyn", behModelType=c(mybeh=2)) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > # where mynet is the name of the network object created by sienaDependent(), > # and mybeh the name of the behavior object created by the same function. > > > > cleanEx() > nameEx("sienaCompositionChange") > ### * sienaCompositionChange > > flush(stderr()); flush(stdout()) > > ### Name: sienaCompositionChange > ### Title: Functions to create a Siena composition change object > ### Aliases: sienaCompositionChange sienaCompositionChangeFromFile > ### Keywords: classes > > ### ** Examples > > clist <- list(c(1, 3), c(1.4, 2.5)) > #or > clist <- list(c("1", "3"), c("1.4", "2.5")) > > compChange <- sienaCompositionChange(clist) > > s50net <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > s50list <- rep(list(c(1,3)), 50) > # This is a trivial composition change: all actors are present in all waves. > compChange <- sienaCompositionChange(s50list) > s50data <- sienaDataCreate(s50net, compChange) > s50data Dependent variables: s50net Number of observations: 3 With composition change. Nodeset Actors Number of nodes 50 Dependent variable s50net Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.047 0.05 > > ## Not run: > ##D filedata <- c("1 3", "1.4 2.5") > ##D write.table(filedata, "cc.dat",row.names=FALSE, col.names=FALSE, > ##D quote=FALSE) > ##D ## file will be > ##D ## 1 3 > ##D ## 1.4 2.5 > ##D compChange <- sienaCompositionChangeFromFile("cc.dat") > ##D > ## End(Not run) > > > > cleanEx() > nameEx("sienaDataConstraint") > ### * sienaDataConstraint > > flush(stderr()); flush(stdout()) > > ### Name: sienaDataConstraint > ### Title: Function to change the values of the constraints between > ### networks. > ### Aliases: sienaDataConstraint > ### Keywords: classes > > ### ** Examples > > nowFriends <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > ever <- array(c(s501, s502, s503), dim=c(50, 50, 3)) > ever[,,2] <- pmax(ever[,,1], ever[,,2]) > ever[,,3] <- pmax(ever[,,2], ever[,,3]) > everFriends <- sienaDependent(ever) > # Note: this data set serves to illustrate this function, > # but it is not an appropriate data set for estimation by siena07, > # because everFriends (for the three waves together) depends deterministically > # on nowFriends (for the three waves together). > nowOrEver <- sienaDataCreate(nowFriends, everFriends) For dependent variable everFriends, 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. Network everFriends is higher than network nowFriends. This will be respected in the simulations. If this is not desired, change attribute 'higher' by function sienaDataConstraint. > attr(nowOrEver, "higher") nowFriends,nowFriends everFriends,nowFriends nowFriends,everFriends FALSE TRUE FALSE everFriends,everFriends FALSE > nowOrEver Dependent variables: nowFriends, everFriends Number of observations: 3 Nodeset Actors Number of nodes 50 Dependent variable nowFriends Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.047 0.05 Dependent variable everFriends Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.07 0.087 "uponly": everFriends: all periods Network everFriends is higher than network nowFriends. This will be respected in the simulations. If this is not desired, change attribute 'higher'. > nowOrEver.unconstrained <- + sienaDataConstraint(nowOrEver, everFriends, nowFriends, "higher", FALSE) > nowOrEver.unconstrained Dependent variables: nowFriends, everFriends Number of observations: 3 Nodeset Actors Number of nodes 50 Dependent variable nowFriends Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.047 0.05 Dependent variable everFriends Type oneMode Observations 3 Nodeset Actors Densities 0.046 0.07 0.087 "uponly": everFriends: all periods > attr(nowOrEver.unconstrained, "higher") nowFriends,nowFriends everFriends,nowFriends nowFriends,everFriends FALSE FALSE FALSE everFriends,everFriends FALSE > > > > cleanEx() > nameEx("sienaDataCreate") > ### * sienaDataCreate > > flush(stderr()); flush(stdout()) > > ### Name: sienaDataCreate > ### Title: Function to create a Siena data object > ### Aliases: sienaDataCreate siena > ### Keywords: classes > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > mydata <- sienaDataCreate(mynet, mybeh) > # This gives the same result as > mydata <- sienaDataCreate(list(mynet, mybeh)) > ## And for a two-mode network > mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2)), nodeSet="senders") > senders <- sienaNodeSet(50, nodeSetName="senders") > receivers <- sienaNodeSet(30, nodeSetName="receivers") > mynet2 <- sienaDependent(array(c(s501[,1:30], s502[,1:30]), dim=c(50, 30, 2)), + nodeSet=c("senders", "receivers")) > (mydata <- sienaDataCreate(mynet1, mynet2, nodeSets=list(senders, receivers))) Dependent variables: mynet1, mynet2 Number of observations: 2 Nodesets senders receivers Number of nodes 50 30 Dependent variable mynet1 Type oneMode Observations 2 Nodeset senders Densities 0.046 0.047 Dependent variable mynet2 Type bipartite Observations 2 First nodeset senders Second nodeset receivers Densities 0.045 0.043 > ## Not run: > ##D print01Report(mydata, modelname = "mydescription") > ## End(Not run) > > > > cleanEx() > nameEx("sienaDependent") > ### * sienaDependent > > flush(stderr()); flush(stdout()) > > ### Name: sienaDependent > ### Title: Function to create a dependent variable for a Siena model > ### Aliases: sienaDependent sienaNet > ### Keywords: classes > > ### ** Examples > > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mybeh <- sienaDependent(s50a, type="behavior") > ## note that the following example works although the node sets do not yet exist! > mynet3 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3)), + type="bipartite", nodeSet=c("senders", "receivers")) > ## sparse matrix input > ## To show this, we first go back from the adjacency matrices to edgelists. > ## The manual shows one way to do this. > ## Another way is to use the sparse matrix representation which internally > ## indeed is an edge list: > library(Matrix) > sp501 <- as(Matrix(s501), "TsparseMatrix") > sp502 <- as(Matrix(s502), "TsparseMatrix") > sp503 <- as(Matrix(s503), "TsparseMatrix") > ## If you are interested in the internal structure of these sparse matrices, > ## you can request > str(sp501) Formal class 'dgTMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:113] 13 6 10 3 8 2 8 31 7 1 ... ..@ j : int [1:113] 0 1 1 2 2 3 3 4 5 6 ... ..@ Dim : int [1:2] 50 50 ..@ Dimnames:List of 2 .. ..$ : chr [1:50] "1" "2" "3" "4" ... .. ..$ : chr [1:50] "V1" "V2" "V3" "V4" ... ..@ x : num [1:113] 1 1 1 1 1 1 1 1 1 1 ... ..@ factors : list() > ## Slot @i is the row, @j is the column, and @x the value; > ## here the values all are 1. > ## Slots @i and @j do not contain information about the number of nodes, > ## so that is supplied additionally by @Dim. > mymatlist <- list(sp501, sp502, sp503) > mynet.sp <- sienaDependent(mymatlist) > > > > cleanEx() detaching ‘package:Matrix’ > nameEx("sienaFit") > ### * sienaFit > > flush(stderr()); flush(stdout()) > > ### Name: sienaFit.methods > ### Title: Methods for processing sienaFit objects, produced by 'siena07'. > ### Aliases: sienaFit.methods print.summary.sienaFit sienaFit > ### xtable.sienaFit print.xtable.sienaFit siena.table print.sienaFit > ### summary.sienaFit > ### Keywords: methods > > ### ** Examples > > myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > mydata <- sienaDataCreate(mynet1) > myeff <- getEffects(mydata) > ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) Start phase 0 theta: -0.56 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 3% Phase 1 Iteration 30 Progress: 4% Phase 1 Iteration 35 Progress: 5% Phase 1 Iteration 40 Progress: 6% Phase 1 Iteration 45 Progress: 6% Phase 1 Iteration 50 Progress: 7% theta: -0.618 0.265 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 21% Phase 2 Subphase 1 Iteration 2 Progress: 21% theta -0.702 0.762 ac 0.147 4.585 Phase 2 Subphase 1 Iteration 3 Progress: 21% Phase 2 Subphase 1 Iteration 4 Progress: 21% theta -0.945 1.543 ac 0.309 3.112 Phase 2 Subphase 1 Iteration 5 Progress: 21% Phase 2 Subphase 1 Iteration 6 Progress: 21% theta -1.15 2.01 ac 0.308 2.232 Phase 2 Subphase 1 Iteration 7 Progress: 22% Phase 2 Subphase 1 Iteration 8 Progress: 22% theta -1.27 2.17 ac 0.308 1.112 Phase 2 Subphase 1 Iteration 9 Progress: 22% Phase 2 Subphase 1 Iteration 10 Progress: 22% theta -1.29 2.11 ac 0.303 0.622 theta -1.16 1.77 ac -0.0112 -0.0521 theta: -1.16 1.77 Start phase 2.2 Phase 2 Subphase 2 Iteration 1 Progress: 51% Phase 2 Subphase 2 Iteration 2 Progress: 51% Phase 2 Subphase 2 Iteration 3 Progress: 52% Phase 2 Subphase 2 Iteration 4 Progress: 52% Phase 2 Subphase 2 Iteration 5 Progress: 52% Phase 2 Subphase 2 Iteration 6 Progress: 52% Phase 2 Subphase 2 Iteration 7 Progress: 52% Phase 2 Subphase 2 Iteration 8 Progress: 52% Phase 2 Subphase 2 Iteration 9 Progress: 52% Phase 2 Subphase 2 Iteration 10 Progress: 53% theta -1.13 1.77 ac -0.0135 -0.1092 theta: -1.13 1.77 Start phase 3 Phase 3 Iteration 100 Progress 100% > ans Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 2.9792 ( 0.4630 ) Other parameters: 1. eval outdegree (density) -1.1329 ( 0.1632 ) 0.2305 2. eval reciprocity 1.7740 ( 0.3203 ) 0.1262 Overall maximum convergence ratio: 0.2338 Total of 306 iteration steps. > summary(ans) Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Rate parameters: 0 Rate parameter 2.9792 ( 0.4630 ) Other parameters: 1. eval outdegree (density) -1.1329 ( 0.1632 ) 0.2305 2. eval reciprocity 1.7740 ( 0.3203 ) 0.1262 Overall maximum convergence ratio: 0.2338 Total of 306 iteration steps. Covariance matrix of estimates (correlations below diagonal) 0.027 -0.018 -0.337 0.103 Derivative matrix of expected statistics X by parameters: 38.884 10.508 7.906 16.292 Covariance matrix of X (correlations below diagonal): 35.854 11.459 0.390 24.137 > ## Not run: > ##D xtable(ans, type="html", file="ans.html") > ##D siena.table(ans, type="html", tstat=TRUE, d=2) > ## End(Not run) > > > > cleanEx() > nameEx("sienaGOF-auxiliary") > ### * sienaGOF-auxiliary > > flush(stderr()); flush(stdout()) > > ### Name: sienaGOF-auxiliary > ### Title: Auxiliary functions for goodness of fit assessment by 'sienaGOF' > ### Aliases: sienaGOF-auxiliary sparseMatrixExtraction networkExtraction > ### behaviorExtraction OutdegreeDistribution IndegreeDistribution > ### BehaviorDistribution TriadCensus mixedTriadCensus dyadicCov > ### Keywords: models > > ### ** Examples > > ### For use out of the box: > > mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > mybeh <- sienaDependent(s50a[,1:2], type="behavior") > mycov <- c(rep(1:3,16),1,2) # artificial, just for trying > mydycov <- matrix(rep(1:5, 500), 50, 50) # also artificial, just for trying > mydata <- sienaDataCreate(mynet1, mybeh) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTies, cycle3) effectName include fix test initialValue parm 1 3-cycles TRUE FALSE FALSE 0 0 2 transitive ties TRUE FALSE FALSE 0 0 > # Shorter phases 2 and 3, just for example: > myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=50, seed=122, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > (ans <- siena07(myalgorithm, data=mydata, effects=myeff, returnDeps=TRUE, + batch=TRUE)) Start phase 0 theta: 4.696 -1.489 0.000 0.000 0.000 0.706 0.322 0.000 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 3% Phase 1 Iteration 30 Progress: 4% Phase 1 Iteration 35 Progress: 5% Phase 1 Iteration 40 Progress: 5% Phase 1 Iteration 45 Progress: 6% Phase 1 Iteration 50 Progress: 7% theta: 5.626 -1.765 0.513 0.244 0.295 0.401 0.277 0.102 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 61% Phase 2 Subphase 1 Iteration 2 Progress: 61% theta 6.222 -1.910 0.847 0.400 0.589 0.383 0.139 0.150 ac 0.527 0.050 2.786 6.110 5.883 1.014 0.922 -2.652 Phase 2 Subphase 1 Iteration 3 Progress: 61% Phase 2 Subphase 1 Iteration 4 Progress: 62% theta 6.2239 -2.1219 1.2821 0.0671 0.6807 0.8771 0.2755 0.1887 ac 0.992 1.239 1.230 -3.756 2.550 1.108 1.351 0.193 Phase 2 Subphase 1 Iteration 5 Progress: 62% Phase 2 Subphase 1 Iteration 6 Progress: 62% theta 6.422 -2.392 1.720 0.214 0.799 1.117 0.269 0.136 ac 0.910 1.271 1.301 -3.605 1.196 1.118 1.252 0.303 Phase 2 Subphase 1 Iteration 7 Progress: 62% Phase 2 Subphase 1 Iteration 8 Progress: 62% theta 6.6477 -2.5994 1.9545 0.2903 0.9594 1.1115 0.3731 0.0797 ac 0.743 1.274 1.310 -3.464 0.987 0.953 1.292 0.470 Phase 2 Subphase 1 Iteration 9 Progress: 62% Phase 2 Subphase 1 Iteration 10 Progress: 62% theta 6.5262 -2.7189 2.0723 0.4106 1.0502 1.1184 0.3314 -0.0143 ac 0.7050 1.2030 0.5857 -2.1894 0.0142 0.9217 1.1864 0.2257 Phase 2 Subphase 1 Iteration 100 Progress: 76% theta 6.6271 -2.6743 2.0766 0.3957 1.1141 1.0232 0.1135 -0.0651 ac 0.339 -0.421 -0.577 -0.467 -0.651 0.195 -0.207 0.124 Phase 2 Subphase 1 Iteration 200 Progress: 90% theta 6.3034 -2.5111 1.7919 0.1469 0.5975 1.2333 0.4793 -0.0772 ac 0.1389 -0.5691 -0.6732 -0.5682 -0.7049 -0.0462 -0.3144 -0.0348 theta 6.6463 -2.6155 1.9720 0.2869 0.8550 1.2018 0.3186 -0.0498 ac 0.17818 -0.61049 -0.69343 -0.61515 -0.73885 0.00491 -0.31594 0.01206 theta: 6.6463 -2.6155 1.9720 0.2869 0.8550 1.2018 0.3186 -0.0498 Start phase 3 Phase 3 Iteration 50 Progress 100% Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio Network Dynamics 1. rate basic rate parameter mynet1 6.6463 ( 3.6467 ) -0.0572 2. eval outdegree (density) -2.6155 ( 0.2693 ) -0.4537 3. eval reciprocity 1.9720 ( 0.2606 ) -0.4184 4. eval 3-cycles 0.2869 ( 0.3186 ) -0.5529 5. eval transitive ties 0.8550 ( 0.2896 ) -0.3299 Behavior Dynamics 6. rate rate mybeh period 1 1.2018 ( 0.3102 ) 0.0240 7. eval mybeh linear shape 0.3186 ( 0.1805 ) -0.2794 8. eval mybeh quadratic shape -0.0498 ( 0.5535 ) -0.2177 Overall maximum convergence ratio: 0.8551 Total of 337 iteration steps. > > # NULL for the observations: > OutdegreeDistribution(NULL, ans$f, ans$sims, period=1, groupName="Data1", + levls=0:7, varName="mynet1") 0 1 2 3 4 5 6 7 3 15 27 42 47 50 50 50 > dyadicCov(NULL, ans$f, ans$sims, period=1, groupName="Data1", + dc=mydycov, varName="mynet1") 1 2 3 4 5 31 25 14 23 23 > # An arbitrary selection for simulation run i: > IndegreeDistribution(5, ans$f, ans$sims, period=1, groupName="Data1", + varName="mynet1") 0 1 2 3 4 5 6 7 8 10 19 31 39 47 49 49 50 50 > BehaviorDistribution(20, ans$f, ans$sims, period=1, groupName="Data1", + varName="mybeh") 1 2 3 4 5 2 14 30 41 50 > sparseMatrixExtraction(50, ans$f, ans$sims, period=1, groupName="Data1", + varName="mynet1") 50 x 50 sparse Matrix of class "dgTMatrix" [1,] . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . [2,] . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [3,] . . . 1 . . . . 1 . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . [4,] . . 1 . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . [5,] . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . [6,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . [7,] . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . [8,] . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . [9,] . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [10,] . . . . . . . . . . 1 . . . 1 . . . . . . . . . . . . . . . . 1 . . . . . [11,] . . . . . . . . . 1 . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . [12,] . . . . . . 1 . . . 1 . . . . . . . . . . . . . . . . . . . . . . . 1 . . [13,] . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . [14,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [15,] . . . . . . . . . 1 . . . . . 1 . . . . . . . . . . . . . . . . . . . . . [16,] . . . . . . . . . . 1 . . . 1 . . . . . . . . . . . . . . . . . . . . . . [17,] . . . . . . . . . . . . . . . . . . 1 . . 1 . 1 . . . . . . . . . . . . . [18,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [19,] . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . . . . . . . . . [20,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [21,] . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . [22,] . . . . . . . . . . . . . . . . 1 . 1 . 1 . . . . . . . . . 1 . . . . . . [23,] . . . . . . . . . . . . . . . 1 . 1 . . . . . . . . . . . . . . . . . . . [24,] . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . [25,] . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [26,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . [27,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [28,] . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . [29,] . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . . . . . . . [30,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . [31,] . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . 1 . . . . 1 [32,] . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . 1 . . . . . . [33,] . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . [34,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . 1 [35,] . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . [36,] . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . [37,] . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . 1 1 . . . . . [38,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . [39,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [40,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [41,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . [42,] . . . . . . 1 . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . [43,] . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . 1 . . [44,] . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [45,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [46,] . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [47,] . . . . . . . . 1 . . . . . . . . . . . . . . . 1 . . . . . 1 1 . . . . . [48,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [49,] . . . . . . . . . . . . . . . . 1 . . . 1 . . 1 . . . . . . . 1 . . . . . [50,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [1,] . . . . . . . . . . . . . [2,] . . . . . . . . . . . . . [3,] . . . . . . . . . . . . . [4,] . . 1 . . . . . . . . . . [5,] . . . . . . . . . . . . . [6,] . . . . . . . . . . . . . [7,] . . . . 1 1 1 . . . . . . [8,] . . . . . 1 . . . . . . . [9,] . . . . . . . . . . . . . [10,] . . . . . . . . . . . . . [11,] . . . . . . . . . . . . . [12,] . . . . 1 . . . . . . . . [13,] . . . . . . . . . . . . . [14,] . . . . . . . . . . . . . [15,] . . . . . . . . . . . . . [16,] . . . . . . . . . . . . . [17,] . . . . . . . . . . . . . [18,] . . . . . . . . . . . . . [19,] . . . . . . . . . . . . . [20,] . . . . . . . . . . . . . [21,] . . . . . . . . . . . . . [22,] . . . . . 1 . . . . . . . [23,] . . . . . . . . . . . . . [24,] . . . . . . . . . . . . . [25,] . . . . . . . . . . . . . [26,] . . . . . . . . . . . . . [27,] . . . . . . . . . . . . . [28,] . . . . . . . . . . . . . [29,] . . . . . . . . . . . . . [30,] . . . . . . . . . . . . . [31,] . . . . . . . . . . . . . [32,] . . 1 . . . . . . 1 . . . [33,] . . . . . . . . . . . . . [34,] . . . . . . . . . . . . . [35,] . . . . . . . . . . . . . [36,] 1 . . 1 . . . . . . . . . [37,] . . . . . . . . . . . . . [38,] . . . 1 . . . . . . . . . [39,] . . . . . . . . . . . . . [40,] . . . . . . . . . . . . . [41,] 1 . . . . . . . . . . . . [42,] . . . . . . 1 . . . . . . [43,] . . . . . . . . . . . . . [44,] . . . . 1 . . . . . . . . [45,] . . . . . . . . . . . . . [46,] . . . . . . 1 . . . . . . [47,] . . . . . . . . . . 1 . . [48,] . . . 1 . . . . . . . . . [49,] . . . . . . . . . . . . . [50,] . . . . . . . . . . . . . > networkExtraction(40, ans$f, ans$sims, period=1, groupName="Data1", + varName="mynet1") Network attributes: vertices = 50 directed = TRUE hyper = FALSE loops = FALSE multiple = FALSE total edges= 100 missing edges= 0 non-missing edges= 100 Vertex attribute names: vertex.names No edge attributes > behaviorExtraction(50, ans$f, ans$sims, period=1, groupName="Data1", + varName="mybeh") [1] 3 2 3 3 4 3 4 4 2 4 5 5 1 4 3 4 2 4 4 2 2 3 5 3 4 4 2 3 3 1 5 4 3 2 2 4 1 3 [39] 2 2 4 5 1 5 2 2 3 2 1 1 > > gofi <- sienaGOF(ans, IndegreeDistribution, verbose=TRUE, join=TRUE, + varName="mynet1") Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations > gofi Siena Goodness of Fit ( IndegreeDistribution ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0.74 ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 4.73 ) for current model. > plot(gofi) > > (gofo <- sienaGOF(ans, OutdegreeDistribution, verbose=TRUE, join=TRUE, + varName="mynet1", cumulative=FALSE)) Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations Siena Goodness of Fit ( OutdegreeDistribution ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0.46 **Note: Only 8 statistics are necessary in the auxiliary function. ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 7.55 ) for current model. > # cumulative is an example of "\dots". > plot(gofo) > > (gofdc <- sienaGOF(ans, dyadicCov, verbose=TRUE, join=TRUE, + dc=mydycov, varName="mynet1")) Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations Siena Goodness of Fit ( dyadicCov ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0.84 ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 2.28 ) for current model. > plot(gofdc) > > # How to use dyadicCov for ego-alter combinations of a monadic variable: > mycov.egoalter <- outer(10*mycov, mycov ,'+') > diag(mycov.egoalter) <- 0 > dim(mycov.egoalter) # 50 * 50 matrix [1] 50 50 > # This is a dyadic variable indicating ego-alter combinations of mycov. > # This construction works since mycov has integer values > # not outside the interval from 1 to 9 (actually, only 1 to 3). > # All cells of this matrix contain a two-digit number, > # left digit is row (ego) value, right digit is column (alter) value. > # See the top left part of the matrix: > mycov.egoalter[1:10,1:12] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0 12 13 11 12 13 11 12 13 11 12 13 [2,] 21 0 23 21 22 23 21 22 23 21 22 23 [3,] 31 32 0 31 32 33 31 32 33 31 32 33 [4,] 11 12 13 0 12 13 11 12 13 11 12 13 [5,] 21 22 23 21 0 23 21 22 23 21 22 23 [6,] 31 32 33 31 32 0 31 32 33 31 32 33 [7,] 11 12 13 11 12 13 0 12 13 11 12 13 [8,] 21 22 23 21 22 23 21 0 23 21 22 23 [9,] 31 32 33 31 32 33 31 32 0 31 32 33 [10,] 11 12 13 11 12 13 11 12 13 0 12 13 > # The number of values is the square of the number of values of mycov; > # therefore, unwise to do this for a monadic covariate with more than 5 values. > gof.mycov <- sienaGOF(ans, dyadicCov, verbose=TRUE, varName="mynet1", + dc=mycov.egoalter) Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations > plot(gof.mycov) > descriptives.sienaGOF(gof.mycov, showAll=TRUE) 11 12 13 21 22 23 31 max 23.000000 18.000000 22.000000 21.0000 19.000000 21.000000 21.000000 perc.upper 23.000000 17.000000 21.000000 19.0000 19.000000 19.000000 19.000000 mean 12.960000 11.980000 14.360000 12.3200 10.460000 13.540000 14.280000 median 13.000000 12.000000 14.000000 12.0000 10.000000 13.000000 14.000000 perc.lower 5.000000 4.000000 9.000000 6.0000 2.000000 8.000000 7.000000 min 5.000000 4.000000 9.000000 6.0000 2.000000 8.000000 7.000000 sd 4.439893 2.972596 3.218315 2.9098 3.769967 2.963795 3.213746 obs 12.000000 12.000000 17.000000 19.0000 8.000000 11.000000 15.000000 p> 0.560000 0.480000 0.140000 0.0200 0.640000 0.760000 0.380000 p>= 0.600000 0.540000 0.240000 0.0400 0.800000 0.840000 0.500000 32 33 max 19.000000 14.000000 perc.upper 18.000000 13.000000 mean 13.160000 8.500000 median 13.000000 9.000000 perc.lower 8.000000 3.000000 min 8.000000 3.000000 sd 2.690573 2.727412 obs 13.000000 9.000000 p> 0.480000 0.440000 p>= 0.540000 0.560000 > > (gofb <- sienaGOF(ans, BehaviorDistribution, varName = "mybeh", + verbose=TRUE, join=TRUE, cumulative=FALSE)) Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations Siena Goodness of Fit ( BehaviorDistribution ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0.52 **Note: Only 4 statistics are necessary in the auxiliary function. ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 3.15 ) for current model. > plot(gofb) > > (goftc <- sienaGOF(ans, TriadCensus, verbose=TRUE, join=TRUE, + varName="mynet1")) Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations Siena Goodness of Fit ( TriadCensus ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0 **Note: Only 15 statistics are necessary in the auxiliary function. ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 50.33 ) for current model. > plot(goftc, center=TRUE, scale=TRUE) > # For this type of auxiliary statistics > # it is advisable in the plot to center and scale. > # note the keys at the x-axis (widen the plot if they are not clear). > descriptives.sienaGOF(goftc) 003 012 102 021D 021U 021C max 16782.0000 2472.0000 1889.0000 28.000000 35.000000 65.00000 perc.upper 16726.0000 2297.0000 1735.0000 23.000000 31.000000 56.00000 mean 16068.2000 1917.1000 1401.3600 13.840000 18.960000 37.00000 median 16045.0000 1935.0000 1382.0000 13.000000 19.000000 36.00000 perc.lower 15573.0000 1391.0000 1048.0000 5.000000 10.000000 19.00000 min 15573.0000 1391.0000 1048.0000 5.000000 10.000000 19.00000 sd 268.4862 212.6341 189.5351 4.523679 6.054042 10.17199 obs 15927.0000 1956.0000 1530.0000 24.000000 19.000000 30.00000 p> 0.6600 0.3800 0.2400 0.020000 0.420000 0.74000 p>= 0.6600 0.4000 0.2400 0.020000 0.520000 0.76000 111D 111U 030T 030C 201 120D 120U max 75.000000 73.00000 4.0000000 4.0000000 40.000000 5.000000 4.000000 perc.upper 74.000000 73.00000 3.0000000 2.0000000 38.000000 5.000000 4.000000 mean 50.720000 48.08000 1.2000000 0.2800000 22.840000 2.140000 1.580000 median 51.000000 49.00000 1.0000000 0.0000000 22.000000 2.000000 1.000000 perc.lower 30.000000 24.00000 0.0000000 0.0000000 6.000000 0.000000 0.000000 min 30.000000 24.00000 0.0000000 0.0000000 6.000000 0.000000 0.000000 sd 9.587492 10.83615 0.9897433 0.7010197 8.657567 1.293784 1.011969 obs 46.000000 26.00000 2.0000000 0.0000000 14.000000 4.000000 1.000000 p> 0.740000 0.96000 0.0800000 0.2000000 0.840000 0.040000 0.480000 p>= 0.740000 0.96000 0.3800000 1.0000000 0.860000 0.120000 0.880000 120C 210 300 max 7.000000 15.000000 13.000000 perc.upper 6.000000 14.000000 13.000000 mean 2.280000 7.260000 7.160000 median 2.000000 6.000000 7.000000 perc.lower 0.000000 1.000000 4.000000 min 0.000000 1.000000 4.000000 sd 1.714762 3.218632 2.501918 obs 4.000000 10.000000 7.000000 p> 0.100000 0.160000 0.340000 p>= 0.260000 0.260000 0.560000 > > ### The mixed triad census for co-evolution of one-mode and two-mode networks: > actors <- sienaNodeSet(50, nodeSetName="actors") > activities <- sienaNodeSet(20, nodeSetName="activities") > onemodenet <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2)), + nodeSet="actors") > # Not meaningful, just for example: > twomodenet <- sienaDependent(array(c(s502[1:50, 1:20], s503[1:50, 1:20]), + dim=c(50, 20, 2)), + type= "bipartite", nodeSet=c("actors", "activities")) > twodata <- sienaDataCreate(onemodenet, twomodenet, + nodeSets=list(actors, activities)) > twoeff <- getEffects(twodata) > twoeff <- includeEffects(twoeff, outActIntn, name="onemodenet", + interaction1="twomodenet") effectName include fix test 1 onemodenet: outdeg.^(1/#) twomodenet activity TRUE FALSE FALSE initialValue parm 1 0 2 > twoeff <- includeEffects(twoeff, outActIntn, name="twomodenet", + interaction1="onemodenet") effectName include fix test 1 twomodenet: outdegree^(1/#) onemodenet activity TRUE FALSE FALSE initialValue parm 1 0 2 > twoeff <- includeEffects(twoeff, from, name="onemodenet", + interaction1="twomodenet") effectName include fix test initialValue parm 1 onemodenet: from twomodenet agreement TRUE FALSE FALSE 0 0 > twoeff <- includeEffects(twoeff, to, name="twomodenet", + interaction1="onemodenet") effectName include fix test initialValue parm 1 twomodenet: onemodenet to agreement TRUE FALSE FALSE 0 0 > twoeff name effectName include fix 1 onemodenet basic rate parameter onemodenet TRUE FALSE 2 onemodenet onemodenet: outdegree (density) TRUE FALSE 3 onemodenet onemodenet: reciprocity TRUE FALSE 4 onemodenet onemodenet: outdeg.^(1/#) twomodenet activity TRUE FALSE 5 onemodenet onemodenet: from twomodenet agreement TRUE FALSE 6 twomodenet basic rate parameter twomodenet TRUE FALSE 7 twomodenet twomodenet: outdegree (density) TRUE FALSE 8 twomodenet twomodenet: outdegree^(1/#) onemodenet activity TRUE FALSE 9 twomodenet twomodenet: onemodenet to agreement TRUE FALSE test initialValue parm 1 FALSE 4.69604 0 2 FALSE -1.48852 0 3 FALSE 0.00000 0 4 FALSE 0.00000 2 5 FALSE 0.00000 0 6 FALSE 1.40260 0 7 FALSE -1.51053 0 8 FALSE 0.00000 2 9 FALSE 0.00000 0 > # Shorter phases 2 and 3, just for example: > twoalgorithm <- sienaAlgorithmCreate(projname=NULL, nsub=1, n3=50, + seed=5634) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > (ans <- siena07(twoalgorithm, data=twodata, effects=twoeff, returnDeps=TRUE, + batch=TRUE)) Start phase 0 theta: 4.70 -1.49 0.00 0.00 0.00 1.40 -1.51 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 3% Phase 1 Iteration 30 Progress: 4% Phase 1 Iteration 35 Progress: 4% Phase 1 Iteration 40 Progress: 5% Phase 1 Iteration 45 Progress: 6% Phase 1 Iteration 50 Progress: 6% theta: 5.2481 -1.6319 0.2655 0.0764 0.4263 1.3648 -1.4959 0.4424 -0.0614 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 63% Phase 2 Subphase 1 Iteration 2 Progress: 64% theta 5.528 -1.758 0.625 0.176 0.893 1.310 -1.554 0.737 0.231 ac 0.757 -3.175 0.973 -1.918 1.179 0.803 1.516 1097.435 0.916 Phase 2 Subphase 1 Iteration 3 Progress: 64% Phase 2 Subphase 1 Iteration 4 Progress: 64% theta 5.224 -1.975 1.418 0.197 1.769 1.229 -1.893 1.136 1.412 ac 1.017 0.798 0.997 -1.908 0.905 0.472 1.393 3.317 0.919 Phase 2 Subphase 1 Iteration 5 Progress: 64% Phase 2 Subphase 1 Iteration 6 Progress: 64% theta 4.890 -2.161 2.006 0.183 1.333 1.090 -2.366 1.232 1.757 ac 0.940 0.704 0.949 -1.727 1.080 0.475 1.437 3.056 1.212 Phase 2 Subphase 1 Iteration 7 Progress: 64% Phase 2 Subphase 1 Iteration 8 Progress: 64% theta 4.562 -2.316 2.295 0.106 1.432 1.051 -2.648 1.166 2.263 ac 0.753 0.739 0.941 -0.127 0.498 0.459 1.056 0.575 0.411 Phase 2 Subphase 1 Iteration 9 Progress: 64% Phase 2 Subphase 1 Iteration 10 Progress: 65% theta 4.8216 -2.4950 2.5432 0.0357 1.2886 1.1288 -2.8676 1.7997 1.9362 ac 0.612 0.563 0.889 -0.352 0.498 0.545 1.038 0.535 0.411 Phase 2 Subphase 1 Iteration 200 Progress: 90% theta 4.8790 -2.3796 2.2246 0.0326 1.9432 1.4117 -2.9790 3.6154 2.0334 ac -0.00218 -0.15859 0.06603 -0.11211 -0.33598 0.00226 -0.09387 0.15192 -0.17930 theta 5.29139 -2.35640 2.26775 0.00709 1.42934 1.34509 -3.09132 3.59195 1.69835 ac -0.0176 -0.1829 -0.0163 -0.1496 -0.3913 0.0126 -0.1197 0.1233 -0.2342 theta: 5.29139 -2.35640 2.26775 0.00709 1.42934 1.34509 -3.09132 3.59195 1.69835 Start phase 3 Estimates, standard errors and convergence t-ratios Estimate Standard Convergence Error t-ratio 1. rate basic rate parameter onemodenet 5.2914 ( 0.5564 ) -0.0478 2. eval onemodenet: outdegree (density) -2.3564 ( 0.8350 ) 0.0000 3. eval onemodenet: reciprocity 2.2677 ( 0.6895 ) -0.0579 4. eval onemodenet: outdeg.^(1/2) twomodenet activity 0.0071 ( 0.6061 ) 0.0495 5. eval onemodenet: from twomodenet agreement 1.4293 ( 1.5142 ) 0.0885 6. rate basic rate parameter twomodenet 1.3451 ( 0.7823 ) 0.0859 7. eval twomodenet: outdegree (density) -3.0913 ( 0.6522 ) 0.2222 8. eval twomodenet: outdegree^(1/2) onemodenet activity 3.5920 ( 6.4660 ) 0.1163 9. eval twomodenet: onemodenet to agreement 1.6983 ( 0.6010 ) 0.2970 Overall maximum convergence ratio: 0.3591 Total of 340 iteration steps. > (gof.two <- sienaGOF(ans, mixedTriadCensus, + varName=c("onemodenet", "twomodenet"), verbose=TRUE)) Detected 50 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 50 calculations Siena Goodness of Fit ( mixedTriadCensus ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0.02 **Note: Only 9 statistics are necessary in the auxiliary function. ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 18.17 ) for current model. > plot(gof.two, center=TRUE, scale=TRUE) > > ## Not run: > ##D ### Here come some useful functions for building your own auxiliary statistics: > ##D ### First an extraction function. > ##D > ##D # igraphNetworkExtraction extracts simulated and observed networks > ##D # from the results of a siena07 run. > ##D # It returns the network as an edge list of class "graph" > ##D # according to the igraph package. > ##D # Ties for ordered pairs with a missing value for wave=period or period+1 > ##D # are zeroed; > ##D # note that this also is done in RSiena for calculation of target statistics. > ##D # However, changing structurally fixed values are not taken into account. > ##D igraphNetworkExtraction <- function(i, data, sims, period, groupName, varName) { > ##D require(igraph) > ##D dimsOfDepVar <- attr(data[[groupName]]$depvars[[varName]], "netdims")[1] > ##D missings <- is.na(data[[groupName]]$depvars[[varName]][,,period]) | > ##D is.na(data[[groupName]]$depvars[[varName]][,,period+1]) > ##D if (is.null(i)) { > ##D # sienaGOF wants the observation: > ##D original <- data[[groupName]]$depvars[[varName]][,,period+1] > ##D original[missings] <- 0 > ##D returnValue <- graph.adjacency(original) > ##D } > ##D else > ##D { > ##D missings <- graph.adjacency(missings) > ##D #sienaGOF wants the i-th simulation: > ##D returnValue <- graph.difference( > ##D graph.empty(dimsOfDepVar) + > ##D edges(t(sims[[i]][[groupName]][[varName]][[period]][,1:2])), > ##D missings) > ##D } > ##D returnValue > ##D } > ##D > ##D ### Then some auxiliary statistics. > ##D > ##D # GeodesicDistribution calculates the distribution of non-directed > ##D # geodesic distances; see ?sna::geodist > ##D # The default for \code{levls} reflects that geodesic distances larger than 5 > ##D # do not differ appreciably with respect to interpretation. > ##D # Note that the levels of the result are named; > ##D # these names are used in the \code{plot} method. > ##D GeodesicDistribution <- function (i, data, sims, period, groupName, > ##D varName, levls=c(1:5,Inf), cumulative=TRUE, ...) { > ##D x <- networkExtraction(i, data, sims, period, groupName, varName) > ##D require(network) > ##D require(sna) > ##D a <- sna::geodist(symmetrize(x))$gdist > ##D if (cumulative) > ##D { > ##D gdi <- sapply(levls, function(i){ sum(a<=i) }) > ##D } > ##D else > ##D { > ##D gdi <- sapply(levls, function(i){ sum(a==i) }) > ##D } > ##D names(gdi) <- as.character(levls) > ##D gdi > ##D } > ##D > ##D # Holland and Leinhardt Triad Census from sna; see ?sna::triad.census. > ##D # For undirected networks, call this with levls=1:4 > ##D TriadCensus.sna <- function(i, data, sims, period, groupName, varName, levls=1:16){ > ##D unloadNamespace("igraph") # to avoid package clashes > ##D require(network) > ##D require(sna) > ##D x <- networkExtraction(i, data, sims, period, groupName, varName) > ##D if (network.edgecount(x) <= 0){x <- symmetrize(x)} > ##D # because else triad.census(x) will lead to an error > ##D tc <- sna::triad.census(x)[levls] > ##D # names are transferred automatically > ##D tc > ##D } > ##D > ##D # Holland and Leinhardt Triad Census from igraph; see ?igraph::triad_census. > ##D TriadCensus.i <- function(i, data, sims, period, groupName, varName){ > ##D unloadNamespace("sna") # to avoid package clashes > ##D require(igraph) > ##D x <- igraphNetworkExtraction(i, data, sims, period, groupName, varName) > ##D # suppressWarnings is used because else warnings will be generated > ##D # when a generated network happens to be symmetric. > ##D setNames(suppressWarnings(triad_census(x)), > ##D c("003", "012", "102", "021D","021U", "021C", "111D", "111U", > ##D "030T", "030C", "201", "120D", "120U", "120C", "210", "300")) > ##D } > ##D > ##D # CliqueCensus calculates the distribution of the clique census > ##D # of the symmetrized network; see ?sna::clique.census. > ##D CliqueCensus<-function (i, obsData, sims, period, groupName, varName, levls = 1:5){ > ##D require(sna) > ##D x <- networkExtraction(i, obsData, sims, period, groupName, varName) > ##D cc0 <- sna::clique.census(x, mode='graph', tabulate.by.vertex = FALSE, > ##D enumerate=FALSE)[[1]] > ##D cc <- 0*levls > ##D names(cc) <- as.character(levls) > ##D levels.used <- as.numeric(intersect(names(cc0), names(cc))) > ##D cc[levels.used] <- cc0[levels.used] > ##D cc > ##D } > ##D > ##D # Distribution of Bonacich eigenvalue centrality; see ?igraph::evcent. > ##D EigenvalueDistribution <- function (i, data, sims, period, groupName, varName, > ##D levls=c(seq(0,1,by=0.125)), cumulative=TRUE){ > ##D require(igraph) > ##D x <- igraphNetworkExtraction(i, data, sims, period, groupName, varName) > ##D a <- igraph::evcent(x)$vector > ##D a[is.na(a)] <- Inf > ##D lel <- length(levls) > ##D if (cumulative) > ##D { > ##D cdi <- sapply(2:lel, function(i){sum(a<=levls[i])}) > ##D } > ##D else > ##D { > ##D cdi <- sapply(2:lel, function(i){ > ##D sum(a<=levls[i]) - sum(a <= levls[i-1])}) > ##D } > ##D names(cdi) <- as.character(levls[2:lel]) > ##D cdi > ##D } > ##D > ##D ## Finally some examples of the three auxiliary statistics constructed above. > ##D mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > ##D mybeh <- sienaDependent(s50a, type="behavior") > ##D mydata <- sienaDataCreate(mynet1, mybeh) > ##D myeff <- getEffects(mydata) > ##D myeff <- includeEffects(myeff, transTrip, cycle3) > ##D myeff <- includeEffects(myeff, outdeg, name="mybeh", interaction1="mynet1") > ##D myeff <- includeEffects(myeff, outdeg, name="mybeh", interaction1="mynet1") > ##D # Shorter phases 2 and 3, just for example: > ##D myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=200, seed=765, projname=NULL) > ##D (ans2 <- siena07(myalgorithm, data=mydata, effects=myeff, returnDeps=TRUE, > ##D batch=TRUE)) > ##D gofc <- sienaGOF(ans2, EigenvalueDistribution, varName="mynet1", > ##D verbose=TRUE, join=TRUE) > ##D plot(gofc) > ##D descriptives.sienaGOF(gofc, showAll=TRUE) > ##D > ##D goftc <- sienaGOF(ans2, TriadCensus, varName="mynet1", verbose=TRUE, join=TRUE) > ##D plot(goftc, center=TRUE, scale=TRUE) > ##D # For this type of auxiliary statistics > ##D # it is advisable in the plot to center and scale. > ##D # note the keys at the x-axis; these names are given by sna::triad.census > ##D descriptives.sienaGOF(goftc) > ##D round(descriptives.sienaGOF(goftc)) > ##D > ##D gofgd <- sienaGOF(ans2, GeodesicDistribution, varName="mynet1", > ##D verbose=TRUE, join=TRUE, cumulative=FALSE) > ##D plot(gofgd) > ##D # and without infinite distances: > ##D gofgdd <- sienaGOF(ans2, GeodesicDistribution, varName="mynet1", > ##D verbose=TRUE, join=TRUE, levls=1:7, cumulative=FALSE) > ##D plot(gofgdd) > ## End(Not run) > > > > cleanEx() > nameEx("sienaGOF") > ### * sienaGOF > > flush(stderr()); flush(stdout()) > > ### Name: sienaGOF > ### Title: Functions to assess goodness of fit for SAOMs > ### Aliases: sienaGOF plot.sienaGOF descriptives.sienaGOF > ### Keywords: models > > ### ** Examples > > mynet <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > mybeh <- sienaDependent(s50a[,1:2], type="behavior") > mydata <- sienaDataCreate(mynet, mybeh) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 > myeff <- setEffect(myeff, cycle3, fix=TRUE, test=TRUE) effectName include fix test initialValue parm 1 3-cycles TRUE TRUE TRUE 0 0 > myeff <- setEffect(myeff, transTies, fix=TRUE, test=TRUE) effectName include fix test initialValue parm 1 transitive ties TRUE TRUE TRUE 0 0 > myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=10, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > # Shorter phases 2 and 3, just for example. > ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE, returnDeps=TRUE) Start phase 0 theta: 4.696 -1.489 0.000 0.000 0.000 0.000 0.706 0.322 0.000 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 3% Phase 1 Iteration 30 Progress: 4% Phase 1 Iteration 35 Progress: 5% Phase 1 Iteration 40 Progress: 5% Phase 1 Iteration 45 Progress: 6% Phase 1 Iteration 50 Progress: 7% theta: 4.897 -1.788 0.462 0.359 0.000 0.000 0.711 0.459 -0.143 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 67% Phase 2 Subphase 1 Iteration 2 Progress: 67% theta 4.981 -1.965 0.793 0.672 0.000 0.000 0.708 0.443 -0.184 ac 1.309 0.332 1.265 1.649 1.386 1.688 0.481 -0.846 1.714 Phase 2 Subphase 1 Iteration 3 Progress: 67% Phase 2 Subphase 1 Iteration 4 Progress: 67% theta 5.036 -2.328 1.554 0.913 0.000 0.000 0.751 0.531 -0.249 ac 1.2739 1.0265 0.9992 0.9252 0.8789 0.9926 1.0063 0.0155 1.0011 Phase 2 Subphase 1 Iteration 5 Progress: 67% Phase 2 Subphase 1 Iteration 6 Progress: 67% theta 5.066 -2.441 2.005 0.694 0.000 0.000 0.791 0.608 -0.209 ac 1.274 1.007 0.983 0.922 0.876 0.966 0.992 -0.164 0.939 Phase 2 Subphase 1 Iteration 7 Progress: 68% Phase 2 Subphase 1 Iteration 8 Progress: 68% theta 5.090 -2.544 2.213 0.608 0.000 0.000 0.928 0.550 -0.166 ac 1.2707 1.0064 0.9803 0.9222 0.8763 0.9694 0.8427 -0.0161 0.9646 Phase 2 Subphase 1 Iteration 9 Progress: 68% Phase 2 Subphase 1 Iteration 10 Progress: 68% theta 5.338 -2.645 2.316 0.736 0.000 0.000 1.132 0.487 -0.164 ac 1.262 1.002 0.967 0.921 0.875 0.962 0.791 -0.324 0.883 Phase 2 Subphase 1 Iteration 200 Progress: 95% theta 5.8343 -2.5307 2.1889 0.7003 0.0000 0.0000 1.2092 0.2770 -0.0696 ac 0.1598 -0.2095 -0.2518 0.1210 0.0917 -0.3831 0.0182 -0.3339 0.0536 theta 5.8860 -2.4901 2.1562 0.5460 0.0000 0.0000 1.2316 0.3204 -0.0612 ac 0.13085 -0.26927 -0.29513 0.07364 0.04793 -0.42916 -0.01086 -0.38305 -0.00267 theta: 5.8860 -2.4901 2.1562 0.5460 0.0000 0.0000 1.2316 0.3204 -0.0612 Start phase 3 > gofi <- sienaGOF(ans, IndegreeDistribution, verbose=TRUE, join=TRUE, + varName="mynet") Detected 10 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 10 calculations Estimating test statistic for model including 3-cycles Estimating test statistic for model including transitive ties > summary(gofi) Siena Goodness of Fit ( IndegreeDistribution ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0 **Note: Only 8 statistics are necessary in the auxiliary function. ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 9.81 ) for current model. One-step estimates and predicted Mahalanobis distances for modified models. **Model including 3-cycles one-step basic rate parameter mynet 3.198 outdegree (density) -2.880 reciprocity 0.347 transitive triplets 1.348 3-cycles 0.404 transitive ties 0.000 rate mybeh period 1 1.375 mybeh linear shape 1.584 mybeh quadratic shape 0.173 MHD 13.531 **Model including transitive ties one-step basic rate parameter mynet -22.038 outdegree (density) -4.177 reciprocity -11.802 transitive triplets -3.327 3-cycles 0.000 transitive ties 7.582 rate mybeh period 1 16.712 mybeh linear shape -2.743 mybeh quadratic shape 8.435 MHD -37.125 ----- Computation time for auxiliary statistic calculations on simulations: 1.639 seconds. > plot(gofi) Note: some statistics are not plotted because their variance is 0. This holds for the statistic: 8. > > # Illustration just for showing a case with two dependent networks; > # running time backwards is not meaningful! > mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > mynet2 <- sienaDependent(array(c(s503, s501), dim=c(50, 50, 2))) > mybeh <- sienaDependent(s50a[,1:2], type="behavior") > mydata <- sienaDataCreate(mynet1, mynet2, mybeh) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip) effectName include fix test initialValue parm 1 mynet1: transitive triplets TRUE FALSE FALSE 0 0 > myeff <- includeEffects(myeff, recip, name="mynet2") effectName include fix test initialValue parm 1 mynet2: reciprocity TRUE FALSE FALSE 0 0 > # Shorter phases 2 and 3, just for example. > ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE, returnDeps=TRUE) Start phase 0 theta: 4.696 -1.489 0.000 0.000 5.430 -1.542 0.000 0.706 0.322 0.000 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 0% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 2% Phase 1 Iteration 25 Progress: 3% Phase 1 Iteration 30 Progress: 4% Phase 1 Iteration 35 Progress: 4% Phase 1 Iteration 40 Progress: 5% Phase 1 Iteration 45 Progress: 6% Phase 1 Iteration 50 Progress: 6% theta: 5.6960 -1.6778 0.7209 0.3562 5.3447 -1.4856 0.6412 0.6694 0.9285 -0.0847 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 69% Phase 2 Subphase 1 Iteration 2 Progress: 69% theta 5.959 -1.804 1.217 0.544 5.525 -1.589 1.389 0.803 1.190 -0.154 ac 0.664 0.409 -1.034 -0.262 1.093 0.726 7.923 1.837 0.478 -0.714 Phase 2 Subphase 1 Iteration 3 Progress: 69% Phase 2 Subphase 1 Iteration 4 Progress: 69% theta 5.608 -1.961 1.595 0.425 5.992 -1.926 1.976 1.166 0.971 -0.199 ac 0.6909 0.4918 -0.9940 -0.2506 0.9683 0.8854 5.4242 0.0867 0.3198 0.0473 Phase 2 Subphase 1 Iteration 5 Progress: 69% Phase 2 Subphase 1 Iteration 6 Progress: 69% theta 5.476 -2.065 1.636 0.204 6.605 -2.236 2.248 1.246 0.399 -0.107 ac 0.7339 0.4808 -1.1463 -0.5824 0.8975 0.8685 0.9041 -0.0923 0.4037 0.0349 Phase 2 Subphase 1 Iteration 7 Progress: 69% Phase 2 Subphase 1 Iteration 8 Progress: 70% theta 5.5432 -2.2290 1.7337 0.3496 6.7512 -2.4321 2.5588 1.2437 0.1565 -0.0895 ac 0.6954 0.4417 -1.1605 -0.5994 0.1382 0.7988 0.0503 -0.0990 0.1821 0.2373 Phase 2 Subphase 1 Iteration 9 Progress: 70% Phase 2 Subphase 1 Iteration 10 Progress: 70% theta 5.6925 -2.3239 1.8914 0.3027 7.1928 -2.5744 2.7866 1.2598 0.0102 -0.1036 ac 0.6955 0.3141 -1.1119 -0.6963 -0.1475 0.6566 -0.4887 -0.0651 -0.0542 0.0220 Phase 2 Subphase 1 Iteration 1 Progress: 70% Phase 2 Subphase 1 Iteration 2 Progress: 70% Phase 2 Subphase 1 Iteration 3 Progress: 70% Phase 2 Subphase 1 Iteration 4 Progress: 70% Phase 2 Subphase 1 Iteration 5 Progress: 70% Phase 2 Subphase 1 Iteration 6 Progress: 71% Phase 2 Subphase 1 Iteration 7 Progress: 71% Phase 2 Subphase 1 Iteration 8 Progress: 71% Phase 2 Subphase 1 Iteration 9 Progress: 71% Phase 2 Subphase 1 Iteration 10 Progress: 71% theta 5.8553 -2.4621 2.1446 0.5278 8.0878 -2.4910 2.8960 1.2160 0.3532 -0.0513 ac -0.0095 -0.4274 -0.4433 -0.3272 -0.0765 -0.6156 -0.6393 -0.2373 -0.5498 -0.1978 theta: 5.8553 -2.4621 2.1446 0.5278 8.0878 -2.4910 2.8960 1.2160 0.3532 -0.0513 Start phase 3 > gofi <- sienaGOF(ans, IndegreeDistribution, verbose=TRUE, join=TRUE, + varName="mynet1") Detected 10 iterations and 1 group. Calculating auxiliary statistics for period 1 . Period 1 > Completed 10 calculations > summary(gofi) Siena Goodness of Fit ( IndegreeDistribution ), all periods ===== Monte Carlo Mahalanobis distance test p-value: 0 ----- One tailed test used (i.e. estimated probability of greater distance than observation). ----- Calculated joint MHD = ( 323.36 ) for current model. Computation time for auxiliary statistic calculations on simulations: 1.336 seconds. > plot(gofi) > > ## Not run: > ##D (gofi.nc <- sienaGOF(ans, IndegreeDistribution, cumulative=FALSE, > ##D varName="mynet1")) > ##D # cumulative is an example of "...". > ##D plot(gofi.nc) > ##D descriptives.sienaGOF(gofi.nc) > ##D > ##D (gofi2 <- sienaGOF(ans, IndegreeDistribution, varName="mynet2")) > ##D plot(gofi2) > ##D > ##D (gofb <- sienaGOF(ans, BehaviorDistribution, varName = "mybeh")) > ##D plot(gofb) > ##D > ##D (gofo <- sienaGOF(ans, OutdegreeDistribution, varName="mynet1", > ##D levls=0:6, cumulative=FALSE)) > ##D # levls is another example of "...". > ##D plot(gofo) > ## End(Not run) > > ## A demonstration of using multiple processes > ## Not run: > ##D library(parallel) > ##D (n.clus <- detectCores() - 1) > ##D n.clus <- min(n.clus, 4) # keep time for other processes > ##D myalgorithm.c <- sienaAlgorithmCreate(nsub=4, n3=1000, seed=1265) > ##D (ans.c <- siena07(myalgorithm.c, data=mydata, effects=myeff, batch=TRUE, > ##D returnDeps=TRUE, useCluster=TRUE, nbrNodes=n.clus)) > ##D gofi.1 <- sienaGOF(ans.c, TriadCensus, verbose=TRUE, varName="mynet1") > ##D cl <- makeCluster(n.clus) > ##D gofi.cl <- sienaGOF(ans.c, TriadCensus, varName="mynet1", cluster=cl) > ##D cl2 <- makeCluster(2) > ##D gofi.cl2 <- sienaGOF(ans.c, TriadCensus, varName="mynet1", cluster=cl2) > ##D # compare simulation times > ##D attr(gofi.1,"simTime") > ##D attr(gofi.cl,"simTime") > ##D attr(gofi.cl2,"simTime") > ## End(Not run) > > > > > cleanEx() > nameEx("sienaGroupCreate") > ### * sienaGroupCreate > > flush(stderr()); flush(stdout()) > > ### Name: sienaGroupCreate > ### Title: Function to group together several Siena data objects > ### Aliases: sienaGroupCreate sienaGroup > ### Keywords: classes > > ### ** Examples > > Group1 <- sienaDependent(array(c(N3401, HN3401), dim=c(45, 45, 2))) > Group3 <- sienaDependent(array(c(N3403, HN3403), dim=c(37, 37, 2))) > Group4 <- sienaDependent(array(c(N3404, HN3404), dim=c(33, 33, 2))) > Group6 <- sienaDependent(array(c(N3406, HN3406), dim=c(36, 36, 2))) > # Illustration of the use of group-level variables: > # dum1 is a dummy variable for group 1, > # having constant value 1 in group 1, and constant value 0 in the other groups. > dum1.1 <- coCovar(c(rep(1,45)), warn = FALSE) > dum1.3 <- coCovar(c(rep(0,37)), warn = FALSE) > dum1.4 <- coCovar(c(rep(0,33)), warn = FALSE) > dum1.6 <- coCovar(c(rep(0,36)), warn = FALSE) > # In a similar way, dummies for the other groups can be defined. > dataset.1 <- sienaDataCreate(Friends = Group1, dum1 = dum1.1) > dataset.3 <- sienaDataCreate(Friends = Group3, dum1 = dum1.3) > dataset.4 <- sienaDataCreate(Friends = Group4, dum1 = dum1.4) > dataset.6 <- sienaDataCreate(Friends = Group6, dum1 = dum1.6) > (FourGroups <- sienaGroupCreate(list(dataset.1, dataset.3, dataset.4, + dataset.6))) Dependent variables: Friends : oneMode Total number of groups: 4 Total number of periods: 4 Changing covariates: dum1 > class(FourGroups) [1] "sienaGroup" "siena" > # The main effect of the group-level variable is the \code{egoX} effect: > myeff <- getEffects(FourGroups) > (myeff <- includeEffects(myeff, egoX, interaction1 = "dum1")) effectName include fix test initialValue parm 1 dum1 ego TRUE FALSE FALSE 0 0 effectName include fix test initialValue parm 1 constant Friends rate (period 1) TRUE FALSE FALSE 5.36547 0 2 constant Friends rate (period 3) TRUE FALSE FALSE 3.61395 0 3 constant Friends rate (period 5) TRUE FALSE FALSE 2.31656 0 4 constant Friends rate (period 7) TRUE FALSE FALSE 4.74481 0 5 outdegree (density) TRUE FALSE FALSE -1.20784 0 6 reciprocity TRUE FALSE FALSE 0.00000 0 7 dum1 ego TRUE FALSE FALSE 0.00000 0 > > > > cleanEx() > nameEx("sienaNodeSet") > ### * sienaNodeSet > > flush(stderr()); flush(stdout()) > > ### Name: sienaNodeSet > ### Title: Function to create a node set > ### Aliases: sienaNodeSet > ### Keywords: classes > > ### ** Examples > > senders <- sienaNodeSet(50, nodeSetName="senders") > receivers <- sienaNodeSet(30, nodeSetName="receivers") > senders.attribute <- coCovar(rep(1:10, each=5), nodeSet="senders") > receivers.attribute <- coCovar(rep(1:5, each=6), nodeSet="receivers") > mynet <- sienaDependent(array(c(s501[,1:30], s502[,1:30]), dim=c(50, 30, 2)), + nodeSet=c("senders", "receivers")) > (mydata <- sienaDataCreate(mynet, senders.attribute, receivers.attribute, + nodeSets=list(senders, receivers))) Dependent variables: mynet Number of observations: 2 Nodesets senders receivers Number of nodes 50 30 Dependent variable mynet Type bipartite Observations 2 First nodeset senders Second nodeset receivers Densities 0.045 0.043 Constant covariates: senders.attribute, receivers.attribute > > > > cleanEx() > nameEx("sienaTimeTest") > ### * sienaTimeTest > > flush(stderr()); flush(stdout()) > > ### Name: sienaTimeTest > ### Title: Functions to assess and account for time heterogeneity of > ### parameters > ### Aliases: sienaTimeTest > ### Keywords: tests > > ### ** Examples > > ## Estimate a restricted model > myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=50, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > # Short estimation not for practice, just for having a quick demonstration > mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > mydata <- sienaDataCreate(mynet1) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 > ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) Start phase 0 theta: -1.47 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 1% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 3% Phase 1 Iteration 20 Progress: 4% Phase 1 Iteration 25 Progress: 5% Phase 1 Iteration 30 Progress: 6% Phase 1 Iteration 35 Progress: 7% Phase 1 Iteration 40 Progress: 8% Phase 1 Iteration 45 Progress: 9% Phase 1 Iteration 50 Progress: 11% theta: -1.671 0.193 0.253 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 42% Phase 2 Subphase 1 Iteration 2 Progress: 43% theta -1.760 0.339 0.368 ac 1.66 1.17 1.06 Phase 2 Subphase 1 Iteration 3 Progress: 43% Phase 2 Subphase 1 Iteration 4 Progress: 43% theta -2.038 0.786 0.739 ac 0.159 1.367 0.409 Phase 2 Subphase 1 Iteration 5 Progress: 43% Phase 2 Subphase 1 Iteration 6 Progress: 43% theta -2.206 1.337 0.633 ac 0.431 1.058 0.205 Phase 2 Subphase 1 Iteration 7 Progress: 44% Phase 2 Subphase 1 Iteration 8 Progress: 44% theta -2.443 1.925 0.705 ac 0.477 1.059 0.210 Phase 2 Subphase 1 Iteration 9 Progress: 44% Phase 2 Subphase 1 Iteration 10 Progress: 44% theta -2.585 2.198 0.728 ac 0.513 1.060 0.217 theta -2.717 2.467 0.623 ac -0.46151 -0.00125 -0.63767 theta: -2.717 2.467 0.623 Start phase 3 Phase 3 Iteration 50 Progress 100% > > ## Conduct the score-type test to assess whether heterogeneity is present. > tt <- sienaTimeTest(ans) > summary(tt) Joint significance test of time heterogeneity: chi-squared = 3.96, d.f. = 3, p= 0.2656, where H0: The following parameters are zero: (1) (*)Dummy2:outdegree (density) (2) (*)Dummy2:reciprocity (3) (*)Dummy2:transitive triplets Individual significance tests and one-step estimators: Initial Est. One Step Est. p-Value outdegree (density) -2.7171 -2.4028 0.0000 reciprocity 2.4673 1.7847 0.0000 transitive triplets 0.6228 0.6136 0.0000 (*)Dummy2:outdegree (density) 0.0000 -0.4670 0.7120 (*)Dummy2:reciprocity 0.0000 1.1353 0.2710 (*)Dummy2:transitive triplets 0.0000 0.0175 0.4390 Effect-wise joint significance tests (i.e. each effect across all dummies): chi-sq. df p-value outdegree (density) 0.14 1 0.708 reciprocity 1.21 1 0.271 transitive triplets 0.60 1 0.439 Period-wise joint significance tests (i.e. each period across all parameters): chi-sq. df p-value Period 1 3.96 3 0.266 Period 2 3.96 3 0.266 Use the following indices for plotting: (1) outdegree (density) (2) reciprocity (3) transitive triplets If you would like to fit time dummies to your model, use the includeTimeDummy function. Type "?sienaTimeTest" for more information on this output. > > ## Suppose that we wish to include time dummies. > ## Add them in the following way: > myeff <- includeTimeDummy(myeff, recip, transTrip, timeDummy="2") name effectName functionName mynet1.obj.eval.2 mynet1 reciprocity Number of reciprocated ties mynet1.obj.eval.3 mynet1 transitive triplets Number of transitive triplets shortName interaction1 interaction2 type basicRate include mynet1.obj.eval.2 recip eval FALSE TRUE mynet1.obj.eval.3 transTrip eval FALSE TRUE randomEffects fix test timeDummy initialValue parm mynet1.obj.eval.2 FALSE FALSE FALSE 2 0 0 mynet1.obj.eval.3 FALSE FALSE FALSE 2 0 0 functionType period rateType untrimmedValue effect1 effect2 mynet1.obj.eval.2 objective 0 0 0 mynet1.obj.eval.3 objective 0 0 0 effect3 interactionType local setting effectFn statisticFn mynet1.obj.eval.2 0 dyadic TRUE NULL NULL mynet1.obj.eval.3 0 TRUE NULL NULL netType groupName group effectNumber mynet1.obj.eval.2 oneMode Group1 1 15 mynet1.obj.eval.3 oneMode Group1 1 21 > ans2 <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) Start phase 0 theta: -1.47 0.00 0.00 0.00 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 4% Phase 1 Iteration 30 Progress: 5% Phase 1 Iteration 35 Progress: 6% Phase 1 Iteration 40 Progress: 6% Phase 1 Iteration 45 Progress: 7% Phase 1 Iteration 50 Progress: 8% theta: -1.6966 0.4402 0.2559 -0.0394 0.1616 0.0000 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 56% Phase 2 Subphase 1 Iteration 2 Progress: 56% theta -1.79250 0.68481 0.38294 -0.00735 0.21975 0.00000 ac 0.375 1.266 1.208 0.683 0.602 0.915 Phase 2 Subphase 1 Iteration 3 Progress: 56% Phase 2 Subphase 1 Iteration 4 Progress: 56% theta -2.1092 1.4208 0.6970 0.0971 0.1811 0.0000 ac 0.743 1.300 0.872 0.269 2.296 2.483 Phase 2 Subphase 1 Iteration 5 Progress: 56% Phase 2 Subphase 1 Iteration 6 Progress: 56% theta -2.294 1.967 0.583 0.239 0.175 0.000 ac 0.98253 1.01909 0.46622 0.13440 -1.21475 0.00952 Phase 2 Subphase 1 Iteration 7 Progress: 56% Phase 2 Subphase 1 Iteration 8 Progress: 57% theta -2.474 2.415 0.556 0.437 -0.258 0.000 ac 0.842 0.874 0.496 -0.297 -0.463 -0.476 Phase 2 Subphase 1 Iteration 9 Progress: 57% Phase 2 Subphase 1 Iteration 10 Progress: 57% theta -2.6353 2.6400 0.6296 0.4925 0.0253 0.0000 ac 0.8291 0.8263 0.3330 -0.2249 -0.3614 -0.0823 Phase 2 Subphase 1 Iteration 100 Progress: 73% theta -2.7153 2.5201 0.6832 0.2056 0.0513 0.0000 ac 0.1164 -0.0397 -0.2367 -0.3432 -0.2324 -0.0996 theta -2.6890 2.5094 0.6123 0.2326 0.0109 0.0000 ac -0.00815 -0.14522 -0.28753 -0.39446 -0.32650 -0.18409 theta: -2.6890 2.5094 0.6123 0.2326 0.0109 0.0000 Start phase 3 Phase 3 Iteration 50 Progress 100% > > ## Re-assess the time heterogeneity > (tt2 <- sienaTimeTest(ans2)) Joint significance test of time heterogeneity: chi-squared = 1.75, d.f. = 1, p= 0.1857, where H0: The following parameters are zero: (1) (*)Dummy2:outdegree (density) > > ## And so on.. > > ## A demonstration of the plotting facilities, on a larger dataset: > ## (Of course pasting these identical sets of three waves after each other > ## in a sequence of six is not really meaningful. It's just a demonstration.) > > myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=50, seed=654, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > mynet1 <- sienaDependent(array(c(s501, s502, s503, s501, s503, s502), + dim=c(50, 50, 6))) > mydata <- sienaDataCreate(mynet1) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip, balance) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 2 balance TRUE FALSE FALSE 0 0 > myeff <- includeTimeDummy(myeff, density, timeDummy="all") name effectName functionName shortName mynet1.obj.eval.1 mynet1 outdegree (density) Number of ties density interaction1 interaction2 type basicRate include mynet1.obj.eval.1 eval FALSE TRUE randomEffects fix test timeDummy initialValue parm mynet1.obj.eval.1 TRUE FALSE FALSE all -1.490548 0 functionType period rateType untrimmedValue effect1 effect2 mynet1.obj.eval.1 objective -1.490548 0 0 effect3 interactionType local setting effectFn statisticFn mynet1.obj.eval.1 0 dyadic TRUE NULL NULL netType groupName group effectNumber mynet1.obj.eval.1 oneMode Group1 1 15 > myeff <- includeTimeDummy(myeff, recip, timeDummy="2,3,5") name effectName functionName shortName mynet1.obj.eval.2 mynet1 reciprocity Number of reciprocated ties recip interaction1 interaction2 type basicRate include mynet1.obj.eval.2 eval FALSE TRUE randomEffects fix test timeDummy initialValue parm mynet1.obj.eval.2 FALSE FALSE FALSE 2,3,5 0 0 functionType period rateType untrimmedValue effect1 effect2 mynet1.obj.eval.2 objective 0 0 0 effect3 interactionType local setting effectFn statisticFn mynet1.obj.eval.2 0 dyadic TRUE NULL NULL netType groupName group effectNumber mynet1.obj.eval.2 oneMode Group1 1 18 > myeff <- includeTimeDummy(myeff, balance, timeDummy="4") name effectName functionName shortName interaction1 mynet1.obj.eval.12 mynet1 balance Amount of balance balance interaction2 type basicRate include randomEffects fix mynet1.obj.eval.12 eval FALSE TRUE FALSE FALSE test timeDummy initialValue parm functionType period mynet1.obj.eval.12 FALSE 4 0 0 objective rateType untrimmedValue effect1 effect2 effect3 mynet1.obj.eval.12 0 0 0 0 interactionType local setting effectFn statisticFn netType mynet1.obj.eval.12 FALSE NULL NULL oneMode groupName group effectNumber mynet1.obj.eval.12 Group1 1 51 > ## Not run: > ##D (ansp <- siena07(myalgorithm, data=mydata, effects=myeff)) > ##D ttp <- sienaTimeTest(ansp, effects=1:4) > ##D > ##D ## Pairwise plots show > ##D plot(ttp, pairwise=TRUE) > ##D > ##D ## Time test plots show > ##D plot(ttp, effects=1:4, dims=c(2,2)) > ## End(Not run) > > ## Instead of working with includeTimeDummy, > ## you can also define time dummies explicitly; > ## this may give more control and more clarity: > dum2 <- matrix(c(0,1,0,0,0), nrow=50, ncol=5, byrow=TRUE) > dum3 <- matrix(c(0,0,1,0,0), nrow=50, ncol=5, byrow=TRUE) > dum4 <- matrix(c(0,0,0,1,0), nrow=50, ncol=5, byrow=TRUE) > dum5 <- matrix(c(0,0,0,0,1), nrow=50, ncol=5, byrow=TRUE) > time2 <- varCovar(dum2) > time3 <- varCovar(dum3) > time4 <- varCovar(dum4) > time5 <- varCovar(dum5) > mydata <- sienaDataCreate(mynet1, time2, time3, time4, time5) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip, balance) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 2 balance TRUE FALSE FALSE 0 0 > ## corresponding to includeTimeDummy(myeff, density, timeDummy="all"): > myeff <- includeEffects(myeff, egoX, interaction1='time2') effectName include fix test initialValue parm 1 time2 ego TRUE FALSE FALSE 0 0 > myeff <- includeEffects(myeff, egoX, interaction1='time3') effectName include fix test initialValue parm 1 time3 ego TRUE FALSE FALSE 0 0 > myeff <- includeEffects(myeff, egoX, interaction1='time4') effectName include fix test initialValue parm 1 time4 ego TRUE FALSE FALSE 0 0 > myeff <- includeEffects(myeff, egoX, interaction1='time5') effectName include fix test initialValue parm 1 time5 ego TRUE FALSE FALSE 0 0 > ## corresponding to myeff <- includeTimeDummy(myeff, recip, timeDummy="2,3,5"): > myeff <- includeInteraction(myeff, egoX, recip, interaction1=c('time2', '')) effectName include fix test initialValue parm effect1 effect2 1 time2 ego x reciprocity TRUE FALSE FALSE 0 0 254 22 > myeff <- includeInteraction(myeff, egoX, recip, interaction1=c('time3', '')) effectName include fix test initialValue parm effect1 effect2 1 time3 ego x reciprocity TRUE FALSE FALSE 0 0 428 22 > myeff <- includeInteraction(myeff, egoX, recip, interaction1=c('time5', '')) effectName include fix test initialValue parm effect1 effect2 1 time5 ego x reciprocity TRUE FALSE FALSE 0 0 776 22 > ## corresponding to myeff <- includeTimeDummy(myeff, balance, timeDummy="4"): > myeff <- includeInteraction(myeff, egoX, balance, interaction1=c('time4', '')) effectName include fix test initialValue parm effect1 effect2 1 time4 ego x balance TRUE FALSE FALSE 0 0 602 55 > ## Not run: > ##D (anspp <- siena07(myalgorithm, data=mydata, effects=myeff)) > ##D ## anspp contains identical results as ansp above. > ## End(Not run) > > ## A demonstration of RateX heterogeneity. > ## Not run: > ##D mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3))) > ##D myccov <- coCovar(s50a[,1]) > ##D mydata <- sienaDataCreate(mynet1, myccov) > ##D myeff <- getEffects(mydata) > ##D myeff <- includeEffects(myeff, transTrip, balance) > ##D myeff <- includeTimeDummy(myeff, RateX, type="rate", interaction1="myccov") > ##D (ans <- siena07(myalgorithm, data=mydata, effects=myeff)) > ## End(Not run) > > > > cleanEx() > nameEx("simstats0c") > ### * simstats0c > > flush(stderr()); flush(stdout()) > > ### Name: simstats0c > ### Title: Versions of FRAN > ### Aliases: simstats0c maxlikec initializeFRAN terminateFRAN > ### Keywords: models > > ### ** Examples > > > mynet1 <- sienaNet(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > mydata <- sienaDataCreate(mynet1) > myeff <- getEffects(mydata) > myeff <- includeEffects(myeff, transTrip) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 > myalgorithm <- sienaAlgorithmCreate(fn=simstats0c, nsub=2, n3=100, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) Start phase 0 theta: -0.56 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 0% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 1% Phase 1 Iteration 15 Progress: 2% Phase 1 Iteration 20 Progress: 3% Phase 1 Iteration 25 Progress: 3% Phase 1 Iteration 30 Progress: 4% Phase 1 Iteration 35 Progress: 4% Phase 1 Iteration 40 Progress: 5% Phase 1 Iteration 45 Progress: 6% Phase 1 Iteration 50 Progress: 6% theta: -0.791 0.123 0.101 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 26% Phase 2 Subphase 1 Iteration 2 Progress: 26% theta -0.962 0.344 0.172 ac 0.619 0.957 1.473 Phase 2 Subphase 1 Iteration 3 Progress: 26% Phase 2 Subphase 1 Iteration 4 Progress: 26% theta -1.386 1.106 0.282 ac 1.081 0.956 1.569 Phase 2 Subphase 1 Iteration 5 Progress: 26% Phase 2 Subphase 1 Iteration 6 Progress: 26% theta -1.651 1.517 0.323 ac 1.238 0.992 1.170 Phase 2 Subphase 1 Iteration 7 Progress: 26% Phase 2 Subphase 1 Iteration 8 Progress: 26% theta -1.781 1.646 0.325 ac 1.116 1.033 0.923 Phase 2 Subphase 1 Iteration 9 Progress: 27% Phase 2 Subphase 1 Iteration 10 Progress: 27% theta -1.854 1.615 0.335 ac 1.087 1.023 0.921 Phase 2 Subphase 1 Iteration 200 Progress: 52% theta -1.743 1.213 0.331 ac 0.1897 -0.0826 -0.0735 theta -1.760 1.328 0.322 ac 0.1637 -0.1393 -0.0966 theta: -1.760 1.328 0.322 Start phase 2.2 Phase 2 Subphase 2 Iteration 1 Progress: 54% Phase 2 Subphase 2 Iteration 2 Progress: 54% Phase 2 Subphase 2 Iteration 3 Progress: 54% Phase 2 Subphase 2 Iteration 4 Progress: 54% Phase 2 Subphase 2 Iteration 5 Progress: 55% Phase 2 Subphase 2 Iteration 6 Progress: 55% Phase 2 Subphase 2 Iteration 7 Progress: 55% Phase 2 Subphase 2 Iteration 8 Progress: 55% Phase 2 Subphase 2 Iteration 9 Progress: 55% Phase 2 Subphase 2 Iteration 10 Progress: 55% Phase 2 Subphase 2 Iteration 200 Progress: 81% theta -1.778 1.359 0.321 ac 0.04432 -0.18519 -0.00982 theta -1.747 1.311 0.324 ac 0.0344 -0.1253 -0.0346 theta: -1.747 1.311 0.324 Start phase 3 Phase 3 Iteration 100 Progress 100% > > > > cleanEx() > nameEx("summary.iwlsm") > ### * summary.iwlsm > > flush(stderr()); flush(stdout()) > > ### Name: summary.iwlsm > ### Title: Summary method for Iterative Weighted Least Squares Models > ### Aliases: summary.iwlsm print.summary.iwlsm > ### Keywords: methods > > ### ** Examples > > ## Not run: > ##D ##not enough data here for a sensible example, but shows the idea. > ##D myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100) > ##D mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > ##D mynet2 <- sienaDependent(array(c(s502, s503), dim=c(50, 50, 2))) > ##D mydata1 <- sienaDataCreate(mynet1) > ##D mydata2 <- sienaDataCreate(mynet2) > ##D myeff1 <- getEffects(mydata1) > ##D myeff2 <- getEffects(mydata2) > ##D myeff1 <- setEffect(myeff1, transTrip, fix=TRUE, test=TRUE) > ##D myeff2 <- setEffect(myeff2, transTrip, fix=TRUE, test=TRUE) > ##D myeff1 <- setEffect(myeff1, cycle3, fix=TRUE, test=TRUE) > ##D myeff2 <- setEffect(myeff2, cycle3, fix=TRUE, test=TRUE) > ##D ans1 <- siena07(myalgorithm, data=mydata1, effects=myeff1, batch=TRUE) > ##D ans2 <- siena07(myalgorithm, data=mydata2, effects=myeff2, batch=TRUE) > ##D meta <- siena08(ans1, ans2) > ##D metadf <- split(meta$thetadf, meta$thetadf$effects)[[1]] > ##D metalm <- iwlsm(theta ~ tconv, metadf, ses=se^2) > ##D summary(metalm) > ## End(Not run) > > > > cleanEx() > nameEx("updateTheta") > ### * updateTheta > > flush(stderr()); flush(stdout()) > > ### Name: updateTheta > ### Title: A function to update the initial values of theta, and a function > ### to update an effects object. > ### Aliases: updateTheta updateSpecification > ### Keywords: models > > ### ** Examples > > ## For updateTheta: > mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > mydata <- sienaDataCreate(mynet1) > myeff1 <- getEffects(mydata) > myeff1 <- includeEffects(myeff1, transTrip) effectName include fix test initialValue parm 1 transitive triplets TRUE FALSE FALSE 0 0 > myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=100, projname=NULL) If you use this algorithm object, siena07 will create/use an output file Siena.txt . > ans <- siena07(myalgorithm, data=mydata, effects=myeff1, batch=TRUE) Start phase 0 theta: -0.56 0.00 0.00 Start phase 1 Phase 1 Iteration 1 Progress: 0% Phase 1 Iteration 2 Progress: 0% Phase 1 Iteration 3 Progress: 1% Phase 1 Iteration 4 Progress: 1% Phase 1 Iteration 5 Progress: 1% Phase 1 Iteration 10 Progress: 2% Phase 1 Iteration 15 Progress: 3% Phase 1 Iteration 20 Progress: 4% Phase 1 Iteration 25 Progress: 5% Phase 1 Iteration 30 Progress: 6% Phase 1 Iteration 35 Progress: 7% Phase 1 Iteration 40 Progress: 8% Phase 1 Iteration 45 Progress: 9% Phase 1 Iteration 50 Progress: 10% theta: -0.7836 0.3204 0.0869 Start phase 2.1 Phase 2 Subphase 1 Iteration 1 Progress: 38% Phase 2 Subphase 1 Iteration 2 Progress: 38% theta -0.949 0.592 0.160 ac 0.294 1.488 5.468 Phase 2 Subphase 1 Iteration 3 Progress: 39% Phase 2 Subphase 1 Iteration 4 Progress: 39% theta -1.480 1.463 0.304 ac 0.796 1.490 1.900 Phase 2 Subphase 1 Iteration 5 Progress: 39% Phase 2 Subphase 1 Iteration 6 Progress: 39% theta -1.813 1.769 0.377 ac 0.844 0.961 0.375 Phase 2 Subphase 1 Iteration 7 Progress: 39% Phase 2 Subphase 1 Iteration 8 Progress: 40% theta -1.938 1.773 0.372 ac 0.712 0.765 0.139 Phase 2 Subphase 1 Iteration 9 Progress: 40% Phase 2 Subphase 1 Iteration 10 Progress: 40% theta -2.021 1.652 0.335 ac 0.6064 0.7383 0.0468 Phase 2 Subphase 1 Iteration 200 Progress: 78% theta -1.755 1.143 0.348 ac 0.136 -0.119 -0.151 theta -1.750 1.294 0.328 ac 0.114 -0.140 -0.136 theta: -1.750 1.294 0.328 Start phase 3 Phase 3 Iteration 100 Progress 100% > ans$theta [1] -1.749908 1.294314 0.327780 > (myeff <- updateTheta(myeff1, ans)) effectName include fix test initialValue parm 1 basic rate parameter mynet1 TRUE FALSE FALSE 3.09277 0 2 outdegree (density) TRUE FALSE FALSE -1.74991 0 3 reciprocity TRUE FALSE FALSE 1.29431 0 4 transitive triplets TRUE FALSE FALSE 0.32778 0 > ## > ## For updateSpecification: > myeff2 <- getEffects(mydata) > myeff2 <- includeEffects(myeff2, inPop) effectName include fix test initialValue parm 1 indegree - popularity TRUE FALSE FALSE 0 0 > updateSpecification(myeff2, myeff1) 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 indegree - popularity TRUE FALSE FALSE 0.00000 0 > # Create (meaningless) two-dimensional dependent network > mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2))) > mynet2 <- sienaDependent(array(c(s503, s501), dim=c(50, 50, 2))) > mydata12 <- sienaDataCreate(mynet1, mynet2) > myeff12 <- getEffects(mydata12) > myeff.new <- getEffects(mydata12) > (myeff12 <- includeEffects(myeff12, inPop, outPop, outAct)) effectName include fix test initialValue parm 1 mynet1: indegree - popularity TRUE FALSE FALSE 0 0 2 mynet1: outdegree - popularity TRUE FALSE FALSE 0 0 3 mynet1: outdegree - activity TRUE FALSE FALSE 0 0 name effectName include fix test initialValue parm 1 mynet1 basic rate parameter mynet1 TRUE FALSE FALSE 4.69604 0 2 mynet1 mynet1: outdegree (density) TRUE FALSE FALSE -1.48852 0 3 mynet1 mynet1: reciprocity TRUE FALSE FALSE 0.00000 0 4 mynet1 mynet1: indegree - popularity TRUE FALSE FALSE 0.00000 0 5 mynet1 mynet1: outdegree - popularity TRUE FALSE FALSE 0.00000 0 6 mynet1 mynet1: outdegree - activity TRUE FALSE FALSE 0.00000 0 7 mynet2 basic rate parameter mynet2 TRUE FALSE FALSE 5.43044 0 8 mynet2 mynet2: outdegree (density) TRUE FALSE FALSE -1.54214 0 9 mynet2 mynet2: reciprocity TRUE FALSE FALSE 0.00000 0 > # update myeff.new only for mynet1: > updateSpecification(myeff.new, myeff12) name effectName include fix test initialValue parm 1 mynet1 basic rate parameter mynet1 TRUE FALSE FALSE 4.69604 0 2 mynet1 mynet1: outdegree (density) TRUE FALSE FALSE -1.48852 0 3 mynet1 mynet1: reciprocity TRUE FALSE FALSE 0.00000 0 4 mynet1 mynet1: indegree - popularity TRUE FALSE FALSE 0.00000 0 5 mynet1 mynet1: outdegree - popularity TRUE FALSE FALSE 0.00000 0 6 mynet1 mynet1: outdegree - activity TRUE FALSE FALSE 0.00000 0 7 mynet2 basic rate parameter mynet2 TRUE FALSE FALSE 5.43044 0 8 mynet2 mynet2: outdegree (density) TRUE FALSE FALSE -1.54214 0 9 mynet2 mynet2: reciprocity TRUE FALSE FALSE 0.00000 0 > # update myeff.new for all dependent networks: > (myeff.updated <- updateSpecification(myeff.new, myeff12, "all")) name effectName include fix test initialValue parm 1 mynet1 basic rate parameter mynet1 TRUE FALSE FALSE 4.69604 0 2 mynet1 mynet1: outdegree (density) TRUE FALSE FALSE -1.48852 0 3 mynet1 mynet1: reciprocity TRUE FALSE FALSE 0.00000 0 4 mynet1 mynet1: indegree - popularity TRUE FALSE FALSE 0.00000 0 5 mynet1 mynet1: outdegree - popularity TRUE FALSE FALSE 0.00000 0 6 mynet1 mynet1: outdegree - activity TRUE FALSE FALSE 0.00000 0 7 mynet2 basic rate parameter mynet2 TRUE FALSE FALSE 5.43044 0 8 mynet2 mynet2: outdegree (density) TRUE FALSE FALSE -1.54214 0 9 mynet2 mynet2: reciprocity TRUE FALSE FALSE 0.00000 0 10 mynet2 mynet2: indegree - popularity TRUE FALSE FALSE 0.00000 0 11 mynet2 mynet2: outdegree - popularity TRUE FALSE FALSE 0.00000 0 12 mynet2 mynet2: outdegree - activity TRUE FALSE FALSE 0.00000 0 > # use multivariate effects object to update univariate effects object: > myeff1 <- getEffects(sienaDataCreate(mynet1)) > updateSpecification(myeff1, myeff.updated) effectName include fix test initialValue parm 1 basic rate parameter mynet1 TRUE FALSE FALSE 4.69604 0 2 outdegree (density) TRUE FALSE FALSE -1.48852 0 3 reciprocity TRUE FALSE FALSE 0.00000 0 4 indegree - popularity TRUE FALSE FALSE 0.00000 0 5 outdegree - popularity TRUE FALSE FALSE 0.00000 0 6 outdegree - activity TRUE FALSE FALSE 0.00000 0 > > > > cleanEx() > nameEx("varCovar") > ### * varCovar > > flush(stderr()); flush(stdout()) > > ### Name: varCovar > ### Title: Function to create a changing covariate object. > ### Aliases: varCovar > ### Keywords: classes > > ### ** Examples > > > myvarCovar <- varCovar(s50a) > senders <- sienaNodeSet(50, nodeSetName="senders") > receivers <- sienaNodeSet(30, nodeSetName="receivers") > senders.covariate <- varCovar(s50a, nodeSet="senders") > receivers.covariate <- varCovar(s50s[1:30,], nodeSet="receivers") > > > > cleanEx() > nameEx("varDyadCovar") > ### * varDyadCovar > > flush(stderr()); flush(stdout()) > > ### Name: varDyadCovar > ### Title: Function to create a changing dyadic covariate object. > ### Aliases: varDyadCovar > ### Keywords: classes > > ### ** Examples > > > mydyadvar <- varDyadCovar(array(c(s501, s502), dim=c(50, 50, 2))) > > > > > cleanEx() > nameEx("xtable") > ### * xtable > > flush(stderr()); flush(stdout()) > > ### Name: xtable > ### Title: Access xtable in package xtable > ### Aliases: xtable > ### Keywords: print > > ### ** Examples > > > ## The function is currently defined as > function (x, ...) + { + xtable::xtable(x, ...) + } function (x, ...) { xtable::xtable(x, ...) } > ## Not run: > ##D myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100) > ##D mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2))) > ##D mydata <- sienaDataCreate(mynet1) > ##D myeff <- getEffects(mydata) > ##D ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE) > ##D ans > ##D summary(ans) > ##D xtable(ans, type="html", file="ans.html") > ## End(Not run) > > > > ### *