An example of a basic sequence of commands for estimating a basic model by function siena07()
of RSiena
. With a lot of use of help pages; this can be skipped as you like. Note that lines starting with # are comment lines, not commands.
What is your current working directory?
getwd()
#> [1] "C:/Users/Tom.Snijders/AppData/Local/Temp/RtmpUXNCro/Rbuild429870dc3d8d/RSiena/vignettes"
If you wish it to be different, change it by
# setwd()
In my case:
# setwd("C:\\Users\\tom.snijders\\Documents\\Siena\\s50_script")
Note the double backslashes used for R.
If you have internet access, you can download the data from the Siena website (“Data sets” tab) http://www.stats.ox.ac.uk/~snijders/siena/s50_data.zip and unzip it in your working directory. The data description is at http://www.stats.ox.ac.uk/~snijders/siena/s50_data.htm
Then you can read the data files by the commands (this can be replaced by using the internal data set, see below)
# friend.data.w1 <- as.matrix(read.table("s50-network1.dat"))
# friend.data.w2 <- as.matrix(read.table("s50-network2.dat"))
# friend.data.w3 <- as.matrix(read.table("s50-network3.dat"))
# drink <- as.matrix(read.table("s50-alcohol.dat"))
# smoke <- as.matrix(read.table("s50-smoke.dat"))
But without internet access, the data can be obtained from within RSiena (see below), because this is an internal data set.
library(RSiena)
# Now we use the internally available s50 data set.
# Look at its description:
?s50# 3 waves, 50 actors
# Look at the start and end of the first wave matrix
head(s501)
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21
#> 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0
#> 2 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0
#> 3 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
#> 4 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
#> 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 6 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
#> V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 V32 V33 V34 V35 V36 V37 V38 V39 V40
#> 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 5 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
#> 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> V41 V42 V43 V44 V45 V46 V47 V48 V49 V50
#> 1 0 0 0 0 0 0 0 0 0 0
#> 2 0 0 0 0 0 0 0 0 0 0
#> 3 0 0 0 0 0 0 0 0 0 0
#> 4 0 0 0 0 0 0 0 0 0 0
#> 5 0 0 0 0 0 0 0 0 0 0
#> 6 0 0 0 0 0 0 0 0 0 0
tail(s501)
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21
#> 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 46 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 V32 V33 V34 V35 V36 V37 V38 V39 V40
#> 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
#> 46 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
#> 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> V41 V42 V43 V44 V45 V46 V47 V48 V49 V50
#> 45 0 0 0 0 0 1 1 0 0 0
#> 46 0 0 0 0 1 0 0 0 1 0
#> 47 0 0 0 0 0 0 0 0 0 0
#> 48 0 0 0 0 0 1 0 0 1 0
#> 49 0 0 0 0 0 1 0 1 0 0
#> 50 0 0 0 0 0 0 0 0 0 0
# and at the alcohol variable
s50a#> V1 V2 V3
#> 1 3 1 3
#> 2 2 2 2
#> 3 2 3 3
#> 4 2 3 2
#> 5 3 3 4
#> 6 4 4 4
#> 7 4 4 3
#> 8 4 5 4
#> 9 2 2 2
#> 10 4 5 4
#> 11 5 5 5
#> 12 5 5 5
#> 13 3 2 2
#> 14 3 4 3
#> 15 4 4 5
#> 16 4 5 4
#> 17 2 4 4
#> 18 4 3 3
#> 19 3 5 5
#> 20 2 3 3
#> 21 1 1 3
#> 22 3 2 3
#> 23 4 4 2
#> 24 3 3 3
#> 25 3 4 4
#> 26 4 4 3
#> 27 2 2 3
#> 28 2 2 4
#> 29 3 3 3
#> 30 1 3 4
#> 31 4 4 4
#> 32 4 2 4
#> 33 3 4 3
#> 34 2 2 2
#> 35 3 3 4
#> 36 4 4 4
#> 37 2 2 3
#> 38 3 3 4
#> 39 2 2 3
#> 40 1 1 1
#> 41 4 3 4
#> 42 4 5 5
#> 43 2 2 4
#> 44 5 5 5
#> 45 2 2 2
#> 46 2 2 2
#> 47 2 2 2
#> 48 2 3 4
#> 49 1 2 3
#> 50 1 2 3
# Now define the objects with the same names as above
# (this step is superfluous if you read the data already).
s501
friend.data.w1 <- s502
friend.data.w2 <- s503
friend.data.w3 <- s50a
drink <- s50s smoke <-
Now the data must be given the specific roles of variables in an RSiena analysis.
?sienaDependent# First create a 50 * 50 * 3 array composed of the 3 adjacency matrices
array( c( friend.data.w1, friend.data.w2, friend.data.w3 ),
friendshipData <-dim = c( 50, 50, 3 ) )
# and next give this the role of the dependent variable:
sienaDependent(friendshipData) friendship <-
What did we construct?
friendship
We also must prepare the objects that will be the explanatory variables.
We use smoking for wave 1 as a constant actor covariate:
coCovar( smoke[ , 1 ] )
smoke1 <-# A variable actor covariate is defined for drinking:
varCovar( drink )
alcohol <-# (This choice is purely for the purpose of illustration here.)
Put the variables together in the data set for analysis
?sienaDataCreate sienaDataCreate( friendship, smoke1, alcohol )
mydata <-# Check what we have
mydata#> Dependent variables: friendship
#> Number of observations: 3
#>
#> Nodeset Actors
#> Number of nodes 50
#>
#> Dependent variable friendship
#> Type oneMode
#> Observations 3
#> Nodeset Actors
#> Densities 0.046 0.047 0.05
#>
#> Constant covariates: smoke1
#> Changing covariates: alcohol
You can get an outline of the data set with some basic descriptives from
print01Report( mydata, modelname="s50")
# For the model specification we need to create the effects object
getEffects( mydata )
myeff <-# All the effects that are available given the structure
# of this data set can be seen from
effectsDocumentation(myeff)
# For a precise description of all effects, see Chapter 12 in the RSiena manual.
# A basic specification of the structural effects:
?includeEffects includeEffects( myeff, transTrip, cycle3)
myeff <-#> effectName include fix test initialValue parm
#> 1 transitive triplets TRUE FALSE FALSE 0 0
#> 2 3-cycles TRUE FALSE FALSE 0 0
# and some covariate effects:
includeEffects( myeff, egoX, altX, simX, interaction1 = "alcohol" )
myeff <-#> effectName include fix test initialValue parm
#> 1 alcohol alter TRUE FALSE FALSE 0 0
#> 2 alcohol ego TRUE FALSE FALSE 0 0
#> 3 alcohol similarity TRUE FALSE FALSE 0 0
includeEffects( myeff, simX, interaction1 = "smoke1" )
myeff <-#> effectName include fix test initialValue parm
#> 1 smoke1 similarity TRUE FALSE FALSE 0 0
myeff#> effectName include fix test initialValue parm
#> 1 constant friendship rate (period 1) TRUE FALSE FALSE 4.69604 0
#> 2 constant friendship 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 3-cycles TRUE FALSE FALSE 0.00000 0
#> 7 smoke1 similarity TRUE FALSE FALSE 0.00000 0
#> 8 alcohol alter TRUE FALSE FALSE 0.00000 0
#> 9 alcohol ego TRUE FALSE FALSE 0.00000 0
#> 10 alcohol similarity TRUE FALSE FALSE 0.00000 0
Create object with algorithm settings Accept defaults but specify name for output file (which you may replace by any name you prefer)
?sienaAlgorithmCreate sienaAlgorithmCreate( projname = 's50' )
myalgorithm <-#> If you use this algorithm object, siena07 will create an output file s50.txt .
?siena07 siena07( myalgorithm, data = mydata, effects = myeff)
ans <-
ans#> Estimates, standard errors and convergence t-ratios
#>
#> Estimate Standard Convergence
#> Error t-ratio
#>
#> Rate parameters:
#> 0.1 Rate parameter period 1 6.6488 ( 1.1597 )
#> 0.2 Rate parameter period 2 5.2851 ( 0.8996 )
#>
#> Other parameters:
#> 1. eval outdegree (density) -2.7440 ( 0.1256 ) -0.0886
#> 2. eval reciprocity 2.4506 ( 0.2155 ) -0.0398
#> 3. eval transitive triplets 0.6692 ( 0.1474 ) -0.0578
#> 4. eval 3-cycles -0.0989 ( 0.2951 ) -0.0545
#> 5. eval smoke1 similarity 0.2023 ( 0.2061 ) -0.0258
#> 6. eval alcohol alter -0.0130 ( 0.0674 ) 0.0215
#> 7. eval alcohol ego 0.0505 ( 0.0714 ) -0.0321
#> 8. eval alcohol similarity 0.7377 ( 0.3033 ) -0.0772
#>
#> Overall maximum convergence ratio: 0.1803
#>
#>
#> Total of 2355 iteration steps.
This gives results from a random starting point. To use a fixed starting point, use the “seed” parameter:
# myalgorithm <- sienaAlgorithmCreate( projname = 's50', seed=435123 )
For checking convergence, look at the ‘Overall maximum convergence ratio’ mentioned under the parameter estimates.
It can also be shown by requesting 0.1803416
If this is less than 0.25, convergence is good. If convergence is inadequate, estimate once more, using the result obtained as the “previous answer” from which estimation continues:
siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans)
ans <-
ans#> Estimates, standard errors and convergence t-ratios
#>
#> Estimate Standard Convergence
#> Error t-ratio
#>
#> Rate parameters:
#> 0.1 Rate parameter period 1 6.6232 ( 1.1692 )
#> 0.2 Rate parameter period 2 5.3234 ( 0.8868 )
#>
#> Other parameters:
#> 1. eval outdegree (density) -2.7325 ( 0.1249 ) -0.0159
#> 2. eval reciprocity 2.4283 ( 0.2174 ) 0.0045
#> 3. eval transitive triplets 0.6415 ( 0.1459 ) -0.0087
#> 4. eval 3-cycles -0.0376 ( 0.2937 ) 0.0165
#> 5. eval smoke1 similarity 0.2010 ( 0.1984 ) 0.0139
#> 6. eval alcohol alter -0.0117 ( 0.0790 ) 0.0190
#> 7. eval alcohol ego 0.0555 ( 0.0799 ) -0.0265
#> 8. eval alcohol similarity 0.7300 ( 0.2858 ) 0.0214
#>
#> Overall maximum convergence ratio: 0.2360
#>
#>
#> Total of 2454 iteration steps.
# If convergence is good, you can look at the estimates.
# More extensive results
summary(ans)
#> Estimates, standard errors and convergence t-ratios
#>
#> Estimate Standard Convergence
#> Error t-ratio
#>
#> Rate parameters:
#> 0.1 Rate parameter period 1 6.6232 ( 1.1692 )
#> 0.2 Rate parameter period 2 5.3234 ( 0.8868 )
#>
#> Other parameters:
#> 1. eval outdegree (density) -2.7325 ( 0.1249 ) -0.0159
#> 2. eval reciprocity 2.4283 ( 0.2174 ) 0.0045
#> 3. eval transitive triplets 0.6415 ( 0.1459 ) -0.0087
#> 4. eval 3-cycles -0.0376 ( 0.2937 ) 0.0165
#> 5. eval smoke1 similarity 0.2010 ( 0.1984 ) 0.0139
#> 6. eval alcohol alter -0.0117 ( 0.0790 ) 0.0190
#> 7. eval alcohol ego 0.0555 ( 0.0799 ) -0.0265
#> 8. eval alcohol similarity 0.7300 ( 0.2858 ) 0.0214
#>
#> Overall maximum convergence ratio: 0.2360
#>
#>
#> Total of 2454 iteration steps.
#>
#> Covariance matrix of estimates (correlations below diagonal)
#>
#> 0.016 -0.017 -0.005 0.002 -0.001 0.000 -0.001 -0.007
#> -0.615 0.047 0.007 -0.020 0.001 0.000 0.002 -0.003
#> -0.277 0.215 0.021 -0.036 -0.001 0.000 -0.001 -0.001
#> 0.053 -0.306 -0.850 0.086 -0.002 -0.001 0.002 0.009
#> -0.060 0.030 -0.037 -0.041 0.039 0.005 0.002 -0.010
#> 0.016 -0.015 0.016 -0.057 0.320 0.006 -0.003 -0.002
#> -0.090 0.116 -0.122 0.073 0.152 -0.450 0.006 0.001
#> -0.201 -0.042 -0.012 0.102 -0.170 -0.070 0.033 0.082
#>
#> Derivative matrix of expected statistics X by parameters:
#>
#> 282.325 223.142 469.493 150.503 26.051 18.528 30.955 19.725
#> 126.367 135.084 239.293 79.339 13.147 4.709 6.197 8.885
#> 327.361 296.361 1093.473 350.068 32.110 57.228 67.494 16.403
#> 161.703 153.738 529.010 177.714 16.165 25.211 26.342 7.165
#> 22.788 18.520 38.906 12.394 40.152 -52.788 -47.420 5.213
#> 19.771 24.132 93.886 32.200 -50.955 334.078 229.139 1.636
#> 25.256 20.419 106.420 32.227 -43.279 233.814 315.603 -0.626
#> 19.092 15.906 13.796 4.216 5.427 -3.235 -2.663 14.792
#>
#> Covariance matrix of X (correlations below diagonal):
#>
#> 445.621 387.594 1054.657 340.705 39.678 48.694 62.428 29.355
#> 0.927 392.404 1032.751 338.141 34.833 56.519 63.321 26.448
#> 0.789 0.823 4012.814 1304.428 87.018 219.494 230.301 51.250
#> 0.779 0.824 0.994 429.332 27.670 73.177 73.481 16.251
#> 0.272 0.255 0.199 0.193 47.662 -70.644 -66.307 6.610
#> 0.107 0.132 0.160 0.163 -0.473 468.227 378.248 1.521
#> 0.140 0.152 0.172 0.168 -0.456 0.829 444.356 1.746
#> 0.349 0.335 0.203 0.197 0.240 0.018 0.021 15.913
Still more extensive results are given in the output file s50.out in the current directory.
Note that by putting an R command between parentheses (….), the result will also be printed to the screen. Next add the transitive reciprocated triplets effect, an interaction between transitive triplets and reciprocity,
includeEffects( myeff, transRecTrip))
(myeff <-#> effectName include fix test initialValue parm
#> 1 transitive recipr. triplets TRUE FALSE FALSE 0 0
#> effectName include fix test initialValue parm
#> 1 constant friendship rate (period 1) TRUE FALSE FALSE 4.69604 0
#> 2 constant friendship 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 transitive recipr. triplets TRUE FALSE FALSE 0.00000 0
#> 7 3-cycles TRUE FALSE FALSE 0.00000 0
#> 8 smoke1 similarity TRUE FALSE FALSE 0.00000 0
#> 9 alcohol alter TRUE FALSE FALSE 0.00000 0
#> 10 alcohol ego TRUE FALSE FALSE 0.00000 0
#> 11 alcohol similarity TRUE FALSE FALSE 0.00000 0
siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans))
(ans1 <-#> Estimates, standard errors and convergence t-ratios
#>
#> Estimate Standard Convergence
#> Error t-ratio
#>
#> Rate parameters:
#> 0.1 Rate parameter period 1 6.2277 ( 1.0265 )
#> 0.2 Rate parameter period 2 5.0783 ( 0.8455 )
#>
#> Other parameters:
#> 1. eval outdegree (density) -2.9396 ( 0.1480 ) 0.0078
#> 2. eval reciprocity 2.8939 ( 0.2620 ) 0.0092
#> 3. eval transitive triplets 0.9081 ( 0.1525 ) -0.0089
#> 4. eval transitive recipr. triplets -0.9095 ( 0.2708 ) -0.0219
#> 5. eval 3-cycles 0.5079 ( 0.2953 ) -0.0214
#> 6. eval smoke1 similarity 0.1663 ( 0.2136 ) 0.0006
#> 7. eval alcohol alter -0.0234 ( 0.0785 ) 0.0208
#> 8. eval alcohol ego 0.0440 ( 0.0835 ) 0.0226
#> 9. eval alcohol similarity 0.7201 ( 0.2985 ) -0.0481
#>
#> Overall maximum convergence ratio: 0.1236
#>
#>
#> Total of 2677 iteration steps.
# If necessary, repeat the estimation with the new result:
siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans1))
(ans1 <-#> Estimates, standard errors and convergence t-ratios
#>
#> Estimate Standard Convergence
#> Error t-ratio
#>
#> Rate parameters:
#> 0.1 Rate parameter period 1 6.2272 ( 1.0380 )
#> 0.2 Rate parameter period 2 5.1382 ( 0.8566 )
#>
#> Other parameters:
#> 1. eval outdegree (density) -2.9398 ( 0.1493 ) 0.0056
#> 2. eval reciprocity 2.8891 ( 0.2599 ) 0.0548
#> 3. eval transitive triplets 0.8849 ( 0.1479 ) 0.0591
#> 4. eval transitive recipr. triplets -0.8820 ( 0.2745 ) 0.0828
#> 5. eval 3-cycles 0.5357 ( 0.3010 ) 0.0659
#> 6. eval smoke1 similarity 0.1632 ( 0.2199 ) -0.0139
#> 7. eval alcohol alter -0.0222 ( 0.0795 ) 0.0636
#> 8. eval alcohol ego 0.0425 ( 0.0754 ) 0.0151
#> 9. eval alcohol similarity 0.7210 ( 0.3068 ) -0.0575
#>
#> Overall maximum convergence ratio: 0.2006
#>
#>
#> Total of 2448 iteration steps.
This might still not have an overall maximum convergence ratio less than 0.25. If not, you could go on once more.
Inspect the file s50.txt in your working directory and understand the meaning of its contents.
To have a joint test of the three effects of alcohol:
?Multipar.RSiena
Multipar.RSiena(ans1, 7:9)
Focusing on alcohol similarity, the effect is significant; diluting the effects of alcohol by also considering ego and alter, the three effects simultaneously are not significant.
Drop the effect of smoke1 similarity and estimate the model again. Do this by the function setEffects() using the <
Change the three effects of alcohol to the single effect of alcohol similarity, and estimate again.
Now we redefine the role of alcohol drinking as a dependent behaviour variable.
# Once again, look at the help file
?sienaDependent# now paying special attention to the <<type>> parameter.
sienaDependent( drink, type = "behavior" ) drinking <-
Put the variables together in the data set for analysis
sienaDataCreate( friendship, smoke1, drinking )
NBdata <-
NBdata#> Dependent variables: friendship, drinking
#> Number of observations: 3
#>
#> Nodeset Actors
#> Number of nodes 50
#>
#> Dependent variable friendship
#> Type oneMode
#> Observations 3
#> Nodeset Actors
#> Densities 0.046 0.047 0.05
#>
#> Dependent variable drinking
#> Type behavior
#> Observations 3
#> Nodeset Actors
#> Range 1 - 5
#>
#> Constant covariates: smoke1
getEffects( NBdata )
NBeff <-effectsDocumentation(NBeff)
includeEffects( NBeff, transTrip, transRecTrip )
NBeff <-#> effectName include fix test initialValue parm
#> 1 transitive triplets TRUE FALSE FALSE 0 0
#> 2 transitive recipr. triplets TRUE FALSE FALSE 0 0
includeEffects( NBeff, egoX, egoSqX, altX, altSqX, diffSqX,
NBeff <-interaction1 = "drinking" )
#> effectName include fix test initialValue parm
#> 1 drinking alter TRUE FALSE FALSE 0 0
#> 2 drinking squared alter TRUE FALSE FALSE 0 0
#> 3 drinking ego TRUE FALSE FALSE 0 0
#> 4 drinking squared ego TRUE FALSE FALSE 0 0
#> 5 drinking diff. squared TRUE FALSE FALSE 0 0
includeEffects( NBeff, egoX, altX, simX, interaction1 = "smoke1" )
NBeff <-#> effectName include fix test initialValue parm
#> 1 smoke1 alter TRUE FALSE FALSE 0 0
#> 2 smoke1 ego TRUE FALSE FALSE 0 0
#> 3 smoke1 similarity TRUE FALSE FALSE 0 0
NBeff#> name effectName include fix test
#> 1 friendship constant friendship rate (period 1) TRUE FALSE FALSE
#> 2 friendship constant friendship rate (period 2) TRUE FALSE FALSE
#> 3 friendship outdegree (density) TRUE FALSE FALSE
#> 4 friendship reciprocity TRUE FALSE FALSE
#> 5 friendship transitive triplets TRUE FALSE FALSE
#> 6 friendship transitive recipr. triplets TRUE FALSE FALSE
#> 7 friendship smoke1 alter TRUE FALSE FALSE
#> 8 friendship smoke1 ego TRUE FALSE FALSE
#> 9 friendship smoke1 similarity TRUE FALSE FALSE
#> 10 friendship drinking alter TRUE FALSE FALSE
#> 11 friendship drinking squared alter TRUE FALSE FALSE
#> 12 friendship drinking ego TRUE FALSE FALSE
#> 13 friendship drinking squared ego TRUE FALSE FALSE
#> 14 friendship drinking diff. squared TRUE FALSE FALSE
#> 15 drinking rate drinking (period 1) TRUE FALSE FALSE
#> 16 drinking rate drinking (period 2) TRUE FALSE FALSE
#> 17 drinking drinking linear shape TRUE FALSE FALSE
#> 18 drinking drinking quadratic shape TRUE FALSE FALSE
#> initialValue parm
#> 1 4.69604 0
#> 2 4.32885 0
#> 3 -1.46770 0
#> 4 0.00000 0
#> 5 0.00000 0
#> 6 0.00000 0
#> 7 0.00000 0
#> 8 0.00000 0
#> 9 0.00000 0
#> 10 0.00000 0
#> 11 0.00000 0
#> 12 0.00000 0
#> 13 0.00000 0
#> 14 0.00000 0
#> 15 0.70571 0
#> 16 0.84939 0
#> 17 0.32237 0
#> 18 0.00000 0
# For including effects also for the dependent behaviour variable, see
?includeEffects includeEffects( NBeff, avAlt, name="drinking",
NBeff <-interaction1 = "friendship" )
#> effectName include fix test initialValue parm
#> 1 drinking average alter TRUE FALSE FALSE 0 0
NBeff#> name effectName include fix test
#> 1 friendship constant friendship rate (period 1) TRUE FALSE FALSE
#> 2 friendship constant friendship rate (period 2) TRUE FALSE FALSE
#> 3 friendship outdegree (density) TRUE FALSE FALSE
#> 4 friendship reciprocity TRUE FALSE FALSE
#> 5 friendship transitive triplets TRUE FALSE FALSE
#> 6 friendship transitive recipr. triplets TRUE FALSE FALSE
#> 7 friendship smoke1 alter TRUE FALSE FALSE
#> 8 friendship smoke1 ego TRUE FALSE FALSE
#> 9 friendship smoke1 similarity TRUE FALSE FALSE
#> 10 friendship drinking alter TRUE FALSE FALSE
#> 11 friendship drinking squared alter TRUE FALSE FALSE
#> 12 friendship drinking ego TRUE FALSE FALSE
#> 13 friendship drinking squared ego TRUE FALSE FALSE
#> 14 friendship drinking diff. squared TRUE FALSE FALSE
#> 15 drinking rate drinking (period 1) TRUE FALSE FALSE
#> 16 drinking rate drinking (period 2) TRUE FALSE FALSE
#> 17 drinking drinking linear shape TRUE FALSE FALSE
#> 18 drinking drinking quadratic shape TRUE FALSE FALSE
#> 19 drinking drinking average alter TRUE FALSE FALSE
#> initialValue parm
#> 1 4.69604 0
#> 2 4.32885 0
#> 3 -1.46770 0
#> 4 0.00000 0
#> 5 0.00000 0
#> 6 0.00000 0
#> 7 0.00000 0
#> 8 0.00000 0
#> 9 0.00000 0
#> 10 0.00000 0
#> 11 0.00000 0
#> 12 0.00000 0
#> 13 0.00000 0
#> 14 0.00000 0
#> 15 0.70571 0
#> 16 0.84939 0
#> 17 0.32237 0
#> 18 0.00000 0
#> 19 0.00000 0
# Define an algorithm with a new project name
sienaAlgorithmCreate( projname = 's50_NB' )
myalgorithm1 <-#> If you use this algorithm object, siena07 will create an output file s50_NB.txt .
# Estimate again, using the second algorithm right from the start.
siena07( myalgorithm1, data = NBdata, effects = NBeff)
NBans <-# You may improve convergence (considering the overall maximum
# convergence ratio) by repeated estimation in the same way as above.
# Look at results
NBans#> Estimates, standard errors and convergence t-ratios
#>
#> Estimate Standard Convergence
#> Error t-ratio
#> Network Dynamics
#> 1. rate constant friendship rate (period 1) 6.3315 ( 1.1202 ) 0.0392
#> 2. rate constant friendship rate (period 2) 5.0594 ( 0.8609 ) -0.0319
#> 3. eval outdegree (density) -2.8298 ( 0.2408 ) 0.0138
#> 4. eval reciprocity 2.8344 ( 0.3002 ) 0.0500
#> 5. eval transitive triplets 0.8913 ( 0.1597 ) 0.0633
#> 6. eval transitive recipr. triplets -0.5034 ( 0.2548 ) 0.0797
#> 7. eval smoke1 alter 0.0783 ( 0.1585 ) -0.0466
#> 8. eval smoke1 ego -0.0124 ( 0.1615 ) -0.0618
#> 9. eval smoke1 similarity 0.2517 ( 0.2629 ) 0.0480
#> 10. eval drinking alter -0.0678 ( 0.1207 ) -0.0544
#> 11. eval drinking squared alter -0.1173 ( 0.1290 ) -0.0013
#> 12. eval drinking ego 0.0453 ( 0.1214 ) -0.0431
#> 13. eval drinking squared ego 0.2308 ( 0.1087 ) -0.0010
#> 14. eval drinking diff. squared -0.1038 ( 0.0529 ) 0.0111
#>
#> Behavior Dynamics
#> 15. rate rate drinking (period 1) 1.3376 ( 0.3510 ) 0.0363
#> 16. rate rate drinking (period 2) 1.8235 ( 0.5306 ) -0.0178
#> 17. eval drinking linear shape 0.4025 ( 0.2209 ) -0.0787
#> 18. eval drinking quadratic shape -0.5610 ( 0.2814 ) 0.0427
#> 19. eval drinking average alter 1.2454 ( 0.6931 ) 0.0041
#>
#> Overall maximum convergence ratio: 0.1988
#>
#>
#> Total of 3427 iteration steps.
# Make a nicer listing of the results
siena.table(NBans, type="html", sig=TRUE)
This produces an html file; siena.table can also produce a LaTeX file.
Replace the average alter effect by average similarity (avSim) or total similarity (totSim) and estimate the model again.
Add the effect of smoking on drinking and estimate again.
Read Sections 13.3 and 13.4 of the Siena Manual, download scripts SelectionTables.r
and InfluenceTables.r
from the Siena website, and make plots of the selection table and influence table for drinking.