[Rsiena-commits] r107 - in pkg/RSienaTest: . R doc inst/doc man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 21 19:00:40 CEST 2010


Author: ripleyrm
Date: 2010-06-21 19:00:38 +0200 (Mon, 21 Jun 2010)
New Revision: 107

Added:
   pkg/RSienaTest/man/includeTimeDummy.Rd
Modified:
   pkg/RSienaTest/DESCRIPTION
   pkg/RSienaTest/NAMESPACE
   pkg/RSienaTest/R/sienaTimeTest.r
   pkg/RSienaTest/changeLog
   pkg/RSienaTest/doc/s_man400.tex
   pkg/RSienaTest/inst/doc/s_man400.pdf
   pkg/RSienaTest/man/plot.sienaTimeTest.Rd
   pkg/RSienaTest/man/setEffect.Rd
   pkg/RSienaTest/man/sienaTimeTest.Rd
Log:
Reinstated includeTimeDummy

Modified: pkg/RSienaTest/DESCRIPTION
===================================================================
--- pkg/RSienaTest/DESCRIPTION	2010-06-18 13:21:56 UTC (rev 106)
+++ pkg/RSienaTest/DESCRIPTION	2010-06-21 17:00:38 UTC (rev 107)
@@ -1,8 +1,8 @@
 Package: RSienaTest
 Type: Package
 Title: Siena - Simulation Investigation for Empirical Network Analysis
-Version: 1.0.12.105
-Date: 2010-06-18
+Version: 1.0.12.107
+Date: 2010-06-21
 Author: Various
 Depends: R (>= 2.9.0), xtable
 Imports: Matrix

Modified: pkg/RSienaTest/NAMESPACE
===================================================================
--- pkg/RSienaTest/NAMESPACE	2010-06-18 13:21:56 UTC (rev 106)
+++ pkg/RSienaTest/NAMESPACE	2010-06-21 17:00:38 UTC (rev 107)
@@ -5,7 +5,7 @@
 sienaGroupCreate,  sienaModelCreate, sienaNet, sienaNodeSet, #simstats0c,
        varCovar, varDyadCovar, setEffect, includeEffects, includeInteraction,
        effectsDocumentation, sienaDataConstraint, #maxlikefn,
-       installGui, siena08, iwlsm, sienaTimeTest)
+       installGui, siena08, iwlsm, sienaTimeTest, includeTimeDummy)
 
 import(Matrix)
 import(xtable)

Modified: pkg/RSienaTest/R/sienaTimeTest.r
===================================================================
--- pkg/RSienaTest/R/sienaTimeTest.r	2010-06-18 13:21:56 UTC (rev 106)
+++ pkg/RSienaTest/R/sienaTimeTest.r	2010-06-21 17:00:38 UTC (rev 107)
@@ -760,4 +760,40 @@
 		}
 		list(effects=effects, data=data)
 	}
-}
\ No newline at end of file
+}
+##@includeTimeDummy DataCreate
+includeTimeDummy <- function(myeff, ..., timeDummy="all", name=myeff$name[1],
+		type="eval", interaction1="", interaction2="", include=TRUE,
+		character=FALSE)
+{
+
+	if (character)
+	{
+		dots <- sapply(list(...), function(x)x)
+	}
+	else
+	{
+		dots <- substitute(list(...))[-1] ##first entry is the word 'list'
+	}
+	if (length(dots) == 0)
+	{
+		stop("need some effect short names")
+	}
+	if (!character)
+	{
+		effectNames <- sapply(dots, function(x)deparse(x))
+	}
+	else
+	{
+		effectNames <- dots
+	}
+	use <- myeff$shortName %in% effectNames &
+			myeff$type==type &
+			myeff$name==name &
+			myeff$interaction1 == interaction1 &
+			myeff$interaction2 == interaction2
+	myeff[use, "timeDummy"] <- timeDummy
+    myeff[use, "include"] <- include
+    print.data.frame(myeff[use,])
+	myeff
+}

Modified: pkg/RSienaTest/changeLog
===================================================================
--- pkg/RSienaTest/changeLog	2010-06-18 13:21:56 UTC (rev 106)
+++ pkg/RSienaTest/changeLog	2010-06-21 17:00:38 UTC (rev 107)
@@ -1,3 +1,9 @@
+2010-06-21 R-forge revision 107 RSienaTest only
+
+	* NAMESPACE, R/sienaTimeTest.r, man/includeTimeDummy.Rd,
+	man/sienaTimeTest.Rd, man/plot.sienaTimeTest.Rd, man/setEffect.Rd,
+	CHANGELOG, doc/s_man400.tex : Reinstated includeTimeDummy.
+
 2010-06-18 R-forge revision 106
 
 	* DESCRIPTION: new version numbers: added 105 to end.

Modified: pkg/RSienaTest/doc/s_man400.tex
===================================================================
--- pkg/RSienaTest/doc/s_man400.tex	2010-06-18 13:21:56 UTC (rev 106)
+++ pkg/RSienaTest/doc/s_man400.tex	2010-06-21 17:00:38 UTC (rev 107)
@@ -180,7 +180,9 @@
 statistical estimation of models for the evolution of social
 networks according to the dynamic actor-oriented model of \citet{Snijders01,
 Snijders05} and \citet{SnijdersEA07}.
-This is the manual for \SI version 4, which is a contributed package to
+This is the manual for \SI version 4,
+also called \rs,
+which is a contributed package to
 the statistical system \Rn.
 The manual is based on the earlier manual for \SI version 3,
 and also contains contributions written for that manual by
@@ -323,10 +325,11 @@
 {\color{section0}\LARGE\bf\noindent
 Part I\\[1.5ex] Minimal Introduction to \SI  \\[1.8ex]}
 \end{screen}
-The following is a minimal cookbook-style
+We start with a minimal cookbook-style
 introduction for getting started with \SI using
-the graphical user interface (\emph{gui}) {siena.exe}. Later sections explain
-other ways to run \si. If you are looking for help with a specific problem, read
+the graphical user interface (\emph{gui}) {siena.exe}. In Section~\ref{S_SR}
+we explain how to run \SI from within \Rn.
+If you are looking for help with a specific problem, read
 the section \ref{sec:problems}.
 
 \section{Getting started with \SI}
@@ -336,7 +339,7 @@
 \label{Gui}
 \begin{enumerate}
 \item % Install the \RS version of \Rn.
-  Install \R (version 2.9.0 or later). Note that if this leads to any
+  Install \R (most recent version). Note that if this leads to any
   problems or questions, \R has an extensive list of `frequently asked
   questions' which may contain adequate help for you.\\
   Start \Rn, click on \sfn{Packages} and
@@ -386,7 +389,7 @@
 \label{fig:siena1}
   \end{figure}
 \item \label{it:prob} If you do not see this screen, navigate in MyComputer to your \Rn{}
-  distribution (probably somewhere like \textsf{c:/Program Files/R/R-2.9.0}),
+  distribution (probably somewhere like \textsf{C:/Program Files/R/R-2.11.1}),
   then move to the \textsf{bin} folder and double click on \textsf{RSetReg.exe}.
 \item Then try running siena again.
 \item If the initial screen appears correctly, then check your working directory
@@ -415,7 +418,7 @@
 
 \subsection{Using the graphical user interface from Mac or Linux}
 \begin{enumerate}
-\item Install \R (version 2.9.0 or greater) as appropriate for your computer.
+\item Install \R (most recent version) as appropriate for your computer.
 \item Within \Rn, type\\
   \sfn{install.packages("RSiena")}\\
 To use the latest beta version, use\\
@@ -436,8 +439,8 @@
   (optional) part of the R installation on Mac. On Linux, you may need to
   install Tcl/tk and the extra Tcl/tk package \sfn{tktable}. On
   Ubuntu Linux, the following commands will do what is
-  necessary:\protect\footnote{Thanks to Michael Schweinberger and Krists
-    Boitmanis for supplying these.}
+  necessary (perhaps version numbers must be adapted):\protect\footnote{Thanks
+  to Michael Schweinberger and Krists Boitmanis for supplying these commands.}
 \begin{verbatim}
 sudo apt-get install tk8.5
 sudo apt-get install libtktable2.9
@@ -528,7 +531,7 @@
  \label{fig:siena2}
 \end{figure}
 
-
+\newpage
 \subsection{Running the Estimation Program}
 \label{estgui}
 \begin{enumerate}
@@ -685,6 +688,7 @@
 \bigskip
 
 \subsection{Using \SI within \Rn}
+\label{S_SR}
 
 There are two alternatives, depending on your familiarity with \Rn.
 
@@ -760,16 +764,23 @@
 \subsubsection{An example \R script for getting started}
 \label{S_Rscript}
 
-The following is an example \R script,
-which one may use to get started with \rs.
-The appendix contains a list of \RS functions which may be consulted
+The best way to get acquainted with \RS is perhaps
+going through the script below, which is also available
+from the `RSiena scripts' page of the \RS website.
+The script is written so as to be useful for novice
+as well as experienced \R users.
+The `RSiena scripts' page of the \RS website
+also contains some other scripts that may be useful.
+The appendix of this manual contains a list of \RS functions which may be consulted
 in addition to this script.
 
 \begin{verbatim}
-#####################################GENERAL###################################
+###################################### GENERAL #################################
 
 # This is an R script for getting started with RSiena, written by
 # Robin Gauthier, Tom Snijders, Ruth Ripley, and Josh Lospinoso.
+# Version 09-06-2010.
+
 # Lines starting with # are not processed by R but treated as comments.
 # The script has a lot of explanation of R possibilities that will be
 # familiar for readers well acquainted with R, and can be skipped by them.
@@ -812,6 +823,7 @@
 # The best is to read this script and execute it line by line
 # (or command by command) as you go.
 
+
 #################### CALLING THE DATA AND PRELIMINARY MANIPULATIONS ###########
 
 # The library command loads the packages needed during the session.
@@ -947,6 +959,7 @@
         friend1.data.w2 <- friend.data.w2[use, use]
         drink1 <- drink[use, ]
 
+
 ############ GIVING THE DATA THEIR ROLES AS VARIABLES IN A SIENA MODEL #########
 
 # A number of objects need to be created in R, as preparations to letting siena07
@@ -1006,17 +1019,16 @@
 # You can infer that oneMode is the default type from the fact
 # that it is mentioned first.
 
-# To create bipartite network objects you need two nodesets and must create
-# the node sets too eg:
+# To create bipartite network objects you need two node sets and must create
+# the node sets too. The following is an example
+# (not really meaningful, just for the syntax):
 
-        friendship <- sienaNet(array(c(friend.data.w1, friend.data.w2),
-                               dim=c(50, 50, 2)), nodeSet=c("senders", "receivers"))
+        bfriendship <- sienaNet(array(c(friend.data.w1, friend.data.w2, friend.data.w3),
+                               dim=c(50, 50, 3)),
+                               "bipartite", nodeSet=c("senders", "receivers"))
         senders <- sienaNodeSet(50, nodeSetName="senders")
         receivers <- sienaNodeSet(50, nodeSetName="receivers")
-        mydata <- sienaDataCreate(friendship, alcohol,
-        nodeSets=list(senders, receivers))
 
-
 # B.
 # Second we construct objects for the explanatory (independent) variables.
 # From the help request
@@ -1072,6 +1084,11 @@
 # If you would like to use different names, you could request this as follows:
 #        mydata <- sienaDataCreate(nominations = friendship, smoke1, drinking = alcohol)
 
+# For bipartite networks you would have to specify the node sets, e.g.,
+
+        mybidata <- sienaDataCreate(bfriendship, alcohol,
+                                    nodeSets=list(senders, receivers))
+
 # This finishes the data specification. Now we have to specify the model.
 
 # D.
@@ -1299,6 +1316,7 @@
 
         myeff <- setEffect(myeff, denseTriads, include=FALSE, 6)
 
+
 ########################### ESTIMATION OF PARAMETERS ###########################
 
 # Parameters of the model are estimated by the function siena07.
@@ -1315,13 +1333,25 @@
 # New estimation runs will append to it.
 # A new call to print01Report will overwrite it!
 
-        mymodel <- sienaModelCreate(useStdInits = TRUE, projname = 's50_3')
+        mymodel <- sienaModelCreate(useStdInits = FALSE, projname = 's50_3')
 
-# siena07 actually fits the specified model to the data
+# The useStdInits parameter determines the initial values used for
+# the estimation algorithm.
+# If useStdInits = TRUE, standard initial values are used;
+# if useStdInits = FALSE, the initial values are used that are contained
+# in the "initialValue" column of the effects object,
+# which were reported above by the information request
+#       myeff
+# Below we shall see how these initial values can be altered.
 
+# The function siena07 actually fits the specified model to the data
+
         ans1 <- siena07(mymodel, data=mydata, effects=myeff, batch=FALSE, verbose=FALSE)
 
 # (ans for "answer").
+# It produces a so-called sienaFit object, here called ans1;
+# and it fills in a few things in the sienaEffects object myeff,
+# if this is the first use of myeff in a siena07 call.
 # By using various different effects objects, i.e., with different names,
 # you can switch between specifications.
 # The batch=FALSE parameters will give a graphical user interface being opened;
@@ -1358,34 +1388,84 @@
 # rather a lot of communication between multiple processes
 # so it might be better to avoid using the two options together.
 
+
 ################### LOOKING AT THE RESULTS ################################
 
-# Depending on the random seed and the model specification,
+# The most basic description of the results is obtained by requesting
+
+        ans1
+
+# Depending on the random number seed and the model specification,
 # the results could be something like the following.
+# (I used the random number seed with value 123456 by adding
+#  seed=123456 in the call of sienaModelCreate;
+#  doing this will exactly replicate the results below;
+#  but it is not advisable always to use the same value
+#  of the random number seed.)
 
-#Rates and standard errors
+# Estimates, standard errors and t-statistics for convergence
+#
+#                                        Estimate   Standard   t statistic
+#                                                     Error
+#
+# Rate parameters:
+#   0.1      Rate parameter period 1      6.6109  ( 1.1307   )
+#   0.2      Rate parameter period 2      5.1446  ( 0.8749   )
+#
+# Other parameters:
+#   1.  eval outdegree (density)         -2.7188  ( 0.1183   )  0.0275
+#   2.  eval reciprocity                  2.4229  ( 0.2277   )  0.0248
+#   3.  eval transitive triplets          0.6398  ( 0.1513   )  0.0204
+#   4.  eval 3-cycles                    -0.0696  ( 0.3072   )  0.0327
+#   5.  eval smoke1 similarity            0.2449  ( 0.2024   ) -0.0759
+#   6.  eval alcohol alter               -0.0272  ( 0.0646   )  0.0435
+#   7.  eval alcohol ego                  0.0418  ( 0.0708   )  0.0586
+#   8.  eval alcohol ego x alcohol alter  0.1275  ( 0.0510   )  0.0138
+#
+# Total of 1988 iteration steps.
 
-#1 rate basic rate parameter friendship      7.19745  (   1.46778 )
-#2 eval outdegree (density)                 -1.64754  (   0.21366 )
-#3 eval reciprocity                          2.09008  (   0.38726 )
-#4 eval transitive triplets                  0.27810  (   0.16612 )
-#5 eval 3-cycles                             0.50407  (   0.37948 )
-#6 eval transitive ties                      0.63643  (   0.23843 )
-#7 eval indegree - popularity                0.04709  (   0.02693 )
-#8 eval outdegree - popularity              -0.26251  (   0.66212 )
-#9 eval indegree - activity                 -0.17380  (   0.01324 )
-#10 eval outdegree - activity               -0.06880  (   0.06258 )
-#11 eval in-in degree^(1/2) assortativity     0.03142  (   0.90979 )
-#12 eval alcohol alter                      -0.08973  (   0.13641 )
-#13 eval alcohol ego                         0.03142  (   0.10044 )
-#14 eval alcohol similarity                  1.10065  (   0.72948 )
+# A more extensive report is obtained by
 
-# The results can be viewed in the output file s50_3.out.
-# They can also be accessed in various ways within R.
+        summary(ans1)
 
-# With function siena07 we made ans1 as the object containing
-# all the results of the estimation. For example,
+# The results can also be viewed externally in the output file s50_3.out
+# which is written in the current directory.
+# It is advisable that you have a look at all three reports and
+# understand how information is organized in each of them.
 
+# To understand the table above, note that the "t statistic"
+# is the t-statistic for convergence checking,
+# not the t statistic for testing the significance of this effect!
+# (See Section 6.2.1 of the manual.)
+# In the external output file, these are called
+# "t-ratios for deviations from targets".
+# The rule of thumb is that all t-ratios for convergence
+# should ideally be less than 0.1 in absolute value;
+# this signifies good convergence of the algorithm.
+# In the example here, this is the case.
+# If this would not be the case, the best thing to do would be
+# to continue the estimation, using the estimates produced here,
+# and contained in ans1, as the new initial values.
+# This is done by the option prevAns as in
+
+        ans1 <- siena07(mymodel, data=mydata, effects=myeff, prevAns=ans1)
+
+# the parameter estimates in ans1 then are  extracted and
+# used in the new estimation,
+# and moreover Phase 1 will be omitted from the algorithm,
+# as derivatives and covariance matrix are used from the previous run.
+# This should be used only if the model specification in myeff
+# has not changed, and if the provisional parameter estimates obtained
+# in ans1 are resaonable; if they are not reasonable,
+# omit the prevAns option, use
+#       mymodel$useStdInits <- TRUE
+# to get back on track, and return later to
+#       mymodel$useStdInits <- TRUE
+# See below for further advice about initial values.
+
+# The results of the estimation can also be accessed in various ways within R.
+# For example,
+
         ans1$theta
 
 # contains the vector of parameter estimates while
@@ -1393,50 +1473,47 @@
         ans1$covtheta
 
 # contains the covariance matrix of the estimates.
-# There are several `methods' available for the object containing the results of
-# the estimation.
 
-        ans1
+# A table formatted for inclusion in a LaTeX document is produced by
 
-# will produce a short table.
-# Note that the "t statistic" is the t-statistic for convergence checking,
-# not the t statistic for testing the significance of this effect!
-# (See Section 6.2.1 of the manual.)
-
-        summary(ans1)
-
-# will produce a longer report, and
-
         xtable(ans1)
 
-# will produce a table formatted for inclusion in a LaTeX document
-# or formatted in html. Use e.g.
+# and this function can also produce a table in html, or write to file; e.g.:
 
         xtable(ans1, type='html')
+        xtable(ans1, file='ff.tex')
 
-# to get html, and e.g.
+# At http://cran.r-project.org/web/packages/xtable you can find
+# a set of vignettes for the xtable package, the xtable gallery,
+# which gives more options.
 
-        xtable(ans1, file='ff.tex')
 
-# to write the results to a file.
+############## MORE ON INITIALIZING PARAMETERS FOR ESTIMATION ########
 
-# These results currently contain a column with t ratios for convergence,
-# which are not to be confused for the t ratios to test the significance of the effects.
-# This will be changed in future versions.
-
-# The option useStdInits = TRUE, used above in sienaModelCreate, will make
+# Above we treated the use of the prevAns option in siena07.
+# Another and more flexible way for determining initial values is by
+# using the useStdInits element of the model object,
+# and the initial values in the effects object.
+# This is done as follows.
+# The option useStdInits = TRUE in sienaModelCreate, will make
 # each estimation run start with standard initial values.
-# If you wish to start the next estimation with the results
-# produced by the previous estimation, first change this option:
+# The option useStdInits = TRUE makes the estimation start
+# with the initial values in the effects object.
+# You can switch between these by commands such as
 
-        mymodel$useStdInits <- FALSE
+#       mymodel$useStdInits <- FALSE
+#       mymodel$useStdInits <- TRUE
 
-# and then initialise the next estimation by the current results.
-# If you used conditional estimation (as here was the default), then request:
-        myeff$initialValue[myeff$include] <- c(ans1$rate, ans1$theta)
+# Putting the estimates from the results object ans1 into the
+# effects object myeff, if ans1 used conditional estimation, is done by
+#       myeff$initialValue[myeff$include] <- ans1$theta
+# and if conditional estimation was used, conditioning on the first
+# dependent network, by
+#       myeff$initialValue[myeff$include] <- c(ans1$rate, ans1$theta)
+# Recall that the function c() combines its arguments into one column vector.
+# A check that the effects object contains the new initial values is made by
 
-# and if you used unconditional estimation:
-#        myeff$initialValue[myeff$include] <- ans1$theta
+        myeff
 
 # By using a different vector instead of ans1$theta you can
 # initialise differently.
@@ -1445,36 +1522,41 @@
 # or until you change the useStdInits option.
 # Also note that you should do this before changing the model,
 # because else the vectors will have incompatible lengths.
+
+# A utility for directly extracting estimates from a sienaFit object
+# and copying these estimates to initial values in a sienaEffects object
+# is the function transferEstimates contained in the utilities file
+# on the "RSiena scripts" page of the Siena website,
+# http://www.stats.ox.ac.uk/~snijders/siena/
+
 # When unsatisfactory convergence was obtained, the first thing to do is
 # to run siena07 repeatedly with useStdInits=FALSE,
 # updating the initial values with the results of the last estimation
-# as indicated here, and continuing until convergence is satisfactory,
+# as indicated here (usually prevAns is the easiest way),
+# and continuing until convergence is satisfactory,
 # as indicated by the t-ratios for convergence all being less than
-# a value such as 0.10.
+# a value of about 0.10.
 
-# You can use the prevAns= option in siena07 to supply the result of a
-# previous run from which to extract the theta estimates
-# and the derivatives. Phase 1 will be omitted in this case.
 
 ################# TESTING FOR TIME HETEROGENEITY #####################
- 
+
 # Now suppose also that you have a network with more than two time periods.
 # There are facilities available for dealing with the possibility that
 # parameters of effects may differ over time. This is demonstrated here.
 # This is further documented in Section 5.7 of the manual.
- 
+
 # Load a dataset with three time periods. Here, we use the s50 dataset
 # which is included with RSiena
 
     mynet2 <- sienaNet(array(c(s501, s502, s503), dim=c(50, 50, 3)))
- 
+
 # Set up your data objects and effects objects as before:
- 
+
     mydata2 <- sienaDataCreate(mynet2)
     myeff2 <- getEffects(mydata2)
 
 # Try out the includeEffects function for adding effects.
- 
+
     myeff2 <- includeEffects(myeff2, transTrip, balance)
 
 # This function provides a clean interface to include effects which is
@@ -1487,9 +1569,9 @@
  
     mymodel2 <- sienaModelCreate(fn=simstats0c, nsub=4, n3=1000)
     ans2 <- siena07(mymodel2, data=mydata2, effects=myeff2, batch=TRUE)
- 
+
 # Conduct the score type test to assess whether heterogeneity is present.
- 
+
     tt2 <- sienaTimeTest(ans2)
 
 # There are a number of score type tests conducted with this command.
@@ -1523,11 +1605,11 @@
 # new effects object to prepare another estimation
  
     myeff3 <- myeff2
-    myeff3<- setEffect(myeff3, recip, timeDummy="2")
-    myeff3<- setEffect(myeff3, balance, timeDummy="2")
- 
+    myeff3<- includeTimeDummy(myeff3, recip, timeDummy="2")
+    myeff3<- includeTimeDummy(myeff3, balance, timeDummy="2")
+
 # And estimate the new model:
- 
+
     ans3 <- siena07(mymodel2, data=mydata2, effects=myeff3, batch=TRUE)
 
 # And so on:
@@ -1536,21 +1618,7 @@
     plot(tt3, effects=1:4, dims=c(2,2))
 
 
-######################### QUITTING          ##########################
 
-# If you save the history and the workspace before quitting,
-# you will later be able to go on and utilize what you did earlier.
-# Another way of storing things is by the functions dput() and dget()
-# which save objects in the form of files which you then
-# can call back later; use
-#       ?dput
-# to get more information about this.
-# It will often be useful to emply different objects for different
-# specifications, e.g., using myeff1, myeff2, ..., ans1, ans2, ...
-# (or using more informative names).
-# You quit by the function
-#       q()
-
 ######################### USING FEWER WAVES ##########################
 
 # For this data set (s50) we have a changing actor covariate, so that is what we elaborate.
@@ -1568,8 +1636,56 @@
 
         alcohol <- varCovar(val = drink[,1:2])
 
+
+######################## FIXING PARAMETERS ##############################
+
+# It is possible to fix parameters at some value, e.g., 0,
+# and test this value without estimating it.
+# This is explained in the RSiena manual.
+# A utility for specifying the effects object in this way
+# is the function fixEffects contained in the utilities file
+# on the "RSiena scripts" page of the Siena website,
+# http://www.stats.ox.ac.uk/~snijders/siena/
+
+
+######################### QUITTING          ##########################
+
+
+# It will often be useful to employ different objects for different
+# specifications, e.g., by using myeff1, myeff2, ..., ans1, ans2, ...
+# (or by using more informative names).
+# This can help to get more clarity of what you are doing within a session,
+# and you can also save such objects and then use them again
+# in a later session.
+
+# If you save the history and the workspace before quitting,
+# you will later be able to go on and utilize what you did earlier.
+# See
+#      ?save
+#      ?savehistory
+# You can also save objects during a session for future use.
+# For example, save a sienaFit object by
+       save(ans1,file="saved_ans.Rdata")
+# Then in a later session the function call
+       load("saved_ans.Rdata")
+# makes available the object ans1, as can be checked by then requesting
+       ans1
+# A utility for saving a sienaFit object and the corresponding effects object
+# is the function saveSienaFit contained in the utilities file
+# on the "RSiena scripts" page of the Siena website,
+# http://www.stats.ox.ac.uk/~snijders/siena/
+
+# Another way of storing things is by the functions dput() and dget()
+# which save objects in the form of files which you then
+# can read as a text file and call back later; use
+#       ?dput
+# to get more information about this.
+# However, dput leads to larger files than save.
+# You quit by the function
+#       q()
+
+
 # TO BE CONTINUED
-# FOR EXAMPLE plot.sociomatrix FROM SNA
 
 #######################VIEWING THE NETWORK IN R#######################
 
@@ -1832,7 +1948,7 @@
   file if you are not using the gui.)
 \item[Check your version of \Rn] When there is a new version or revision of \RS
   it will only be available to you automatically if you are running the most
-  recent major version of \Rn, currently 2.10. (You can force an installation if
+  recent major version of \Rn. (You can force an installation if
   necessary by downloading the tarball or binary and installing from that, but
   it is better to update your \Rn.)
 \item [Check both repositories] We have two repositories in use for \rs: CRAN
@@ -1877,8 +1993,8 @@
 
 
 The main output is written to a text file named \textsf{{\em
-pname}.out}, where \textsf{{\em pname}} is the root name of the
-file specifying the data files (if any).
+pname}.out}, where \textsf{{\em pname}} is the name
+specified in the call of \textsf{sienaModelCreate()}.
 
 \begin{print}
 \newpage
@@ -3794,9 +3910,9 @@
 with time dummies. You
 can include these in your model simply via the function
 \begin{verbatim}
-myeffects <- setEffect(myeffects, density, timeDummy="2,3,6")
+myeffects <- includeTimeDummy(myeffects, density, reciprocity, timeDummy="2,3,6")
 \end{verbatim}
-which would add three time dummied density effects.
+which would add three time dummy terms to each effect listed in the function.
 
 We recommend that you start with simple models, and use the score type test for
 assessing heterogeneity, i.e., if \texttt{ans} is the object of results produced
@@ -4842,7 +4958,7 @@
 If as a consequence of this analysis you wish to add time dummy terms,
 this may be done via
 \begin{verbatim}
-myeff <- setEffect(myeff, recip, timeDummy="2")
+myeff <- includeTimeDummy(myeff, recip, balance, timeDummy="2")
 ans3 <- siena07(mymodel, data=mydata, effects=myeff, batch=TRUE)
 \end{verbatim}
 and testing again,
@@ -5437,7 +5553,7 @@
 \item Analyzing the different networks separately, without any assumption
       that parameters are the same but using the same model specification,
       and post-processing the output files by a meta-analysis
-      using \textsf{Siena08}.
+      using \textsf{siena08}.
       This is explained in Section~\ref{S_Siena08}.
 \end{enumerate}
 The first and second options will yield nearly the same results, with the
@@ -5514,12 +5630,12 @@
 \subsection{Meta-analysis of Siena results}
 \label{S_Siena08}
 
-The program \textsf{Siena08.exe} is a relatively simple
+The function \textsf{siena08} is a relatively simple
 multilevel extension to \si.
-   This program must be run independently,
-   after having obtained estimates for a common model
-   estimated for several data sets.
-   \textsf{Siena08} combines
+It combines estimates for a common model
+   estimated for several data sets,
+   that must have been obtained earlier.
+   This function combines
    the estimates in a meta-analysis or multilevel analysis
    according to the methods of \citet{SnijdersBaerveldt03},
    and according to a Fisher-type combination of one-sided $p$-values.
@@ -5528,21 +5644,7 @@
    and (briefly) in \citet[Chapter 3]{SnijdersBosker99}).
    Some more information is at the \SI website.
 
-   For \SI version 4 the program \textsf{Siena08.exe} still must be
-   checked and adapted. We hope that its role will be taken over
-   by new functions in \rs.
-
-   All \SI output files to be used must already exist,
-   and the \emph{last estimation results} in these output files will be used.
-   It is required that all these last estimation runs
-   have the same set of estimated parameters, and of
-   parameters tested by score tests.
-   The program does not check that the score tests (if any)
-   in the output files
-   refer to the same parameters.
-   It is also required that the decimal separator is a point, not a comma.
-   (This depends on your Windows settings; if your output files have commas,
-   just change all commas into points using an editor.)
+\iffalse
    The \textsf{Siena08} project is the collection of output files
    to be combined, which is defined in the project \textsf{.mli} file.
 
@@ -5592,6 +5694,7 @@
 %   the data set included in the zip file \textsf{Siena08.zip} with project \textsf{CB}
 %   and the subprojects \textsf{CB1\ CB3\ CB4}~.
 \bigskip
+\fi
 
 \iffalse
 
@@ -5784,6 +5887,15 @@
 \fi
 For non-directed networks, the same formulae are used,
 unless a different formula is given explicitly.
+\medskip
+
+\noindent
+\textbf{\emph{Structural effects}}
+\medskip
+
+\noindent
+Structural effects are the effects depending on the network only.
+
 \begin{enumerate}
  \item {\em out-degree effect} or \emph{density effect},
  \hypertarget{T_density}{defined by the out-degree} \\
@@ -5989,7 +6101,13 @@
 
 \setcounter{savenumi}{\value{enumi}}
 \end{enumerate}
-\smallskip
+\medskip
+
+\noindent
+\textbf{\emph{Dyadic covariate effects}}
+\medskip
+
+\noindent
 The effects for a dyadic covariate $w_{ij}$ are
 \begin{enumerate}
 \setcounter{enumi}{\value{savenumi}}
@@ -6124,7 +6242,13 @@
 
 \setcounter{savenumi}{\value{enumi}}
 \end{enumerate}
-\smallskip
+\medskip
+
+\noindent
+\textbf{\emph{Monadic covariate effects}}
+\medskip
+
+\noindent
 For actor-dependent covariates $v_j$ (recall that these are
 centered internally by \si) as well as for dependent behavior
 variables (for notational simplicity here also denoted $v_j$;
@@ -6202,8 +6326,80 @@
  to whom $i$ is tied indirectly (at a geodesic distance of 2),\\
  $s^{\rm net}_{i\vit}(x) = \sum_j (1 -x_{ij})
                       \big( \max_h x_{ih}x_{hj} \big) v_j $.
+\setcounter{savenumi}{\value{enumi}}
+\end{enumerate}
 
+\noindent
+The following group of effects uses an auxiliary variable $\breve v_i$ which
+can be called ``alters' $v$-average''.
+It is described as the average value of $v_j$ for those
+to whom $i$ is tied, and defined mathematically by
+\begin{equation}
+  \breve v_i = \left\{\begin{array}{ll} \displaystyle
+         \frac{\sum_j x_{ij}v_j}{x_{i+}}  &  \text{ if } x_{i+} > 0     \\
+         0                                &  \text{ if } x_{i+} = 0  .
+  \end{array}   \right.            \label{alt_av}
+\end{equation}
+(Since $v$ is centered, the value of 0 in case $x_{i+} = 0$ is also the mean value
+of the original variable.)\\
+(It may be noted that this constructed variable $\breve v_i$
+will not itself have exactly a zero mean generally.)
+
+Note that this value is being updated during the simulations.
+Network changes will change $\breve v_i$; if $v_i$ is a dependent behavior
+variable, then behaviour changes will also change $\breve v_i$.
+
+In the following list, there is no ego effect, because the ego effect
+of $\breve v_i$ would be the same as the alter effect of $v_i$.
+
+\begin{enumerate}
+\setcounter{enumi}{\value{savenumi}}
+
+\item \emph{covariate - alter at distance 2},
+      defined as the sum of alters' covariate-average over all actors
+      to whom $i$ has a tie,
+\[
+ s^{\rm net}_{i\vit}(x) = \sum_j x_{ij} \breve v_j
+\]
+
+\item \emph{covariate - similarity at distance 2},
+      defined as the sum of centered similarity
+      values for alters' covariate-average between $i$ and all actors
+      $j$ to whom $i$ has a tie,
+\[
+ s^{\rm net}_{i\vit}(x) = \sum_j x_{ij} ({\rm sim}(\breve v)_{ij}
+  - \widehat{{\rm sim}(\breve v)}) \ ,
+\]
+ where the similarity scores ${\rm sim}(\breve v)_{ij}$ are defined as
+\[
+{\rm sim}(\breve v)_{ij}=
+ \frac{\Delta-\vert \breve v_i - \breve v_j \vert}{\Delta} \ ,
+\]
+ while
+ $\Delta=\max_{ij}\vert v_i - v_j \vert$ is the observed range of the
+ \emph{original} covariate $v$, and\\
+ $\widehat{{\rm sim}(\breve v)}$ is the
+ \emph{observed} mean of all these similarity scores;
+ this observed mean is defined by calculating the $\breve v_i$ values
+ for each of the observations $t_1$ to $t_{M-1}$, and averaging
+ these \\
+ $(M-1)n(n-1)$ (or $(M-1)n(n-1)/2$) similarity values.
+\end{enumerate}
 \iffalse
+If there are multiple networks, their roles can be crossed here --
+the alters' covariate average is calculated
+in turn, respectively, for each dependent network variable;
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rsiena -r 107


More information about the Rsiena-commits mailing list