Back to the main Siena page

RSiena scripts

This page presents a number of RSiena scripts. They use data sets that can be downloaded from the Data sets page. Firefox or Chrome may be better than Internet Explorer for showing the scripts presented here.

Remarks about errors or improvements may be sent to the Siena - StOCNET discussion list at In case of an error, please do check that you are using the latest version of RSiena (recognizable from the date, available from the RSiena project at R-Forge) - the error may have been corrected already. Error reports should be accompanied by complete data and scripts which reproduce the error! However, it should be noted that the functions in these scripts do not necessarily work for all (perhaps complicated) model specifications.


    The five introductory scripts mentioned in Section 2.3 of the RSiena users' manual are contained with a sixth piece.

  1. basicRSiena.r
    An example of a basic sequence of commands for estimating a model by function siena07() of RSiena.
  2. Rscript01DataFormat.R with some basic information about R, networks, data formats etc;
    with an example data file arclistdata.dat.
  3. RSienaSNADescriptives.R with some descriptives, using package sna.
  4. Rscript02SienaVariableFormat.R for how to specify data as variables in RSiena, and specify the model; using the s50 data set.
  5. Rscript03SienaRunModel.R for how to carry out the estimation and look at the results;
  6. Rscript04SienaBehaviour.R for how to specify models for dynamics of networks and behaviour;
  7. In addition there are some other scripts.

  8. RscriptSienaMultiple.R for how to specify models for dynamics of multiple networks;
    this uses a manufactured data set (longitudinal, 2 waves, 2 networks);
  9. RscriptSienaTimeTest.R an example of testing time heterogeneity, using the van de Bunt students data set.
  10. RscriptMultipleGroups_meta.R an example of meta-analysis with the metafor package and siena08, and of the multiple group option, using Chris Baerveldt's Dutch Social Behavior data set.
  11. RscriptMultipleGroups.R a more limited example of the multiple group option and of meta-analysis using function siena08, using Chris Baerveldt's Dutch Social Behavior data set.
  12. RscriptSienaOrdered.R an example of modeling a network with ordered ties (i.e., valued ties with a small set of ordered categories), by representing them as multiple, ordered networks, using the van de Bunt students data set.
  13. RscriptSienaBipartite.R an example of co-evolution of a one-mode and a two-mode network, using a set with substance use variables of the Glasgow Teenage Friends and Lifestyle Study data.
  14. Two scripts showing how to analyze a two-mode network as a one-mode network, using structural zeros.
    This sometimes is useful because it opens up some further possibilities to use RSiena options. The scripts use the data set of the Glasgow Teenage Friends and Lifestyle Study.

  15. RscriptSienaSymmetric.R a brief example of modeling a non-directed network, using the s50 data set.
  16. Composition change in a network: R script and data for illustration, also see the slides.
  17. Simulation of networks with a given model specification: NetworkSimulation.R.
  18. Goodness of fit (for RSiena and RSienaTest versions 1.1-227 and later):
    An example script for how to use sienaGOF() is in sienaGOF_new.R.
    This script is not downward compatible to earlier versions of RSiena or RSienaTest.
  19. Random coefficient multilevel estimation of the Stochastic Actor-Oriented Model:


  1. Lab exercise: sex segregation of friendship networks
  2. Some scripts on data conversion: zip archive with examples
  3. Modelling the co-evolution of networks and behaviour: slides and script.
  4. Co-evolution of friendship, alcohol consumption, and musical taste; re-analysis of Steglich, Snijders, and West (2006).
  5. Lab: multiple group analyses
  6. Lab: analysis of multiplex networks
  7. Lab: two-mode network analysis

Here are r scripts for some of the practicals.

Back to the main Siena page