[Rsiena-commits] r272 - in pkg: RSiena RSiena/R RSiena/man RSienaTest RSienaTest/R RSienaTest/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 17 22:14:58 CEST 2014


Author: natalie
Date: 2014-04-17 22:14:57 +0200 (Thu, 17 Apr 2014)
New Revision: 272

Added:
   pkg/RSiena/man/sienaRIDynamics.Rd
   pkg/RSienaTest/man/sienaRIDynamics.Rd
Modified:
   pkg/RSiena/ChangeLog
   pkg/RSiena/DESCRIPTION
   pkg/RSiena/NAMESPACE
   pkg/RSiena/R/sienaRIDynamics.r
   pkg/RSiena/man/sienaRI.Rd
   pkg/RSienaTest/ChangeLog
   pkg/RSienaTest/DESCRIPTION
   pkg/RSienaTest/NAMESPACE
   pkg/RSienaTest/R/sienaRIDynamics.r
   pkg/RSienaTest/man/sienaRI.Rd
Log:
added sienaRIDynamics.Rd

Modified: pkg/RSiena/ChangeLog
===================================================================
--- pkg/RSiena/ChangeLog	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSiena/ChangeLog	2014-04-17 20:14:57 UTC (rev 272)
@@ -1,3 +1,10 @@
+2014-04-17 R-Forge Revision 272
+Changes in RSiena and RSienaTest:
+   * sienaRIDynamics.Rd: added
+   * sienaRIDynamics.r: small changes
+   * NAMESPACE: added entries sienaRIDynamics with the corresponding 
+     print, summary, and plot methods.
+
 2014-04-17 R-Forge Revision 271
 Changes in RSiena and RSienaTest:
    * Added component se to sienaFit objects

Modified: pkg/RSiena/DESCRIPTION
===================================================================
--- pkg/RSiena/DESCRIPTION	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSiena/DESCRIPTION	2014-04-17 20:14:57 UTC (rev 272)
@@ -1,7 +1,7 @@
 Package: RSiena
 Type: Package
 Title: Siena - Simulation Investigation for Empirical Network Analysis
-Version: 1.1-271
+Version: 1.1-272
 Date: 2014-04-17
 Author: Ruth Ripley, Krists Boitmanis, Tom A.B. Snijders
 Depends: R (>= 2.15.0)

Modified: pkg/RSiena/NAMESPACE
===================================================================
--- pkg/RSiena/NAMESPACE	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSiena/NAMESPACE	2014-04-17 20:14:57 UTC (rev 272)
@@ -7,7 +7,7 @@
        varCovar, varDyadCovar, setEffect, includeEffects, includeInteraction,
        effectsDocumentation, sienaDataConstraint, print.xtable.sienaFit,
        installGui, siena08, iwlsm, sienaTimeTest, includeTimeDummy, 
-       sienaGOF, descriptives.sienaGOF, sienaRI, sparseMatrixExtraction,
+       sienaGOF, descriptives.sienaGOF, sienaRI, sienaRIDynamics, sparseMatrixExtraction,
        networkExtraction, behaviorExtraction,
        OutdegreeDistribution, IndegreeDistribution, BehaviorDistribution,
        siena.table, xtable,
@@ -52,4 +52,7 @@
 S3method(summary, sienaRI)
 S3method(print, sienaRI)
 S3method(plot, sienaRI)
+S3method(summary, sienaRIDynamics)
+S3method(print, sienaRIDynamics)
+S3method(plot, sienaRIDynamics)
 S3method(print, chains.data.frame)

Modified: pkg/RSiena/R/sienaRIDynamics.r
===================================================================
--- pkg/RSiena/R/sienaRIDynamics.r	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSiena/R/sienaRIDynamics.r	2014-04-17 20:14:57 UTC (rev 272)
@@ -10,7 +10,7 @@
 # *****************************************************************************/
 
 ##@sienaRIDynamics. Use as RSiena:::sienaRIDynamics()
-sienaRIDynamics <- function(data, ans=NULL, effects=NULL, algorithm=NULL, theta=NULL , depvar=NULL, intervalsPerPeriod=NULL)
+sienaRIDynamics <- function(data, ans=NULL, theta=NULL, algorithm=NULL, effects=NULL, depvar=NULL, intervalsPerPeriod=NULL)
 {
 	if(length(data$depvars)>1){
 		if(is.null(depvar)){
@@ -277,12 +277,44 @@
 
 
 ##@plot.sienaRIDynamics Methods
-plot.sienaRIDynamics <- function(x, staticValues = NULL, file = NULL, col = NULL, ylim=NULL, width = NULL, height = NULL, legend = TRUE, legendColumns = NULL, legendHeight = NULL, cex.legend = NULL, ...)
+plot.sienaRIDynamics <- function(x, staticRI = NULL, file = NULL, col = NULL, ylim=NULL, width = NULL, height = NULL, legend = TRUE, legendColumns = NULL, legendHeight = NULL, cex.legend = NULL, ...)
 { 
-	if (!inherits(x, "sienaRIDynamics"))
+	if(!inherits(x, "sienaRIDynamics"))
 	{
 		stop("x is not of class 'sienaRIDynamics' ")
 	}
+	if(!is.null(staticRI))
+	{
+		if(!inherits(staticRI, "sienaRI"))
+		{
+			warning("staticRI is not of class 'sienaRI' and is therefore ignored")
+			staticValues <- NULL
+		}else{	
+			if(staticRI$dependentVariable != x$dependentVariable)
+			{
+				warning("staticRI does not correspond to x and is therefore ignored,\n staticRI and x do not refer to the same dependent variable")
+				staticValues <- NULL
+			}
+			else if(length(staticRI$effectNames) != length(x$effectNames) || sum(x$effectNames==staticRI$effectNames)!=length(x$effectNames))
+			{
+				warning("staticRI does not correspond to x and is therefore ignored,\n staticRI and x do not refer to the same effects")
+				staticValues <- NULL
+			}
+			else if(length(staticRI$expectedRI)-1 != length(x$intervalValues))
+			{
+				warning("staticRI does not correspond to x and is therefore ignored,\n staticRI and x do not refer to the same number of observation moments")
+				staticValues <- NULL
+			}
+			else
+			{
+				staticValues <- staticRI$expectedRI
+			}
+		}
+	}
+	else
+	{
+		staticValues <- NULL
+	}
 	if(legend)
 	{
 		if(!is.null(legendColumns))
@@ -441,13 +473,18 @@
 			points(ts(t(values[[period]]))[,eff], col = cl[eff], type = "p", pch = 20)
 			if(!is.null(staticValues))
 			{
-				points(xy.coords(1,staticValues[eff]),col = cl[eff], type = "p", pch = 1, cex = 1.75)
+				points(xy.coords(1,staticValues[[period]][eff]),col = cl[eff], type = "p", pch = 1, cex = 1.75)
 			}
 		}
 		ax <- ((ylim[1]*10):(ylim[2]*10))/10
 		if(period==1){
-			axis(4, ax, labels = FALSE)
-			axis(2, ax)
+			if(period == periods){
+				axis(4, ax)
+				axis(2, ax)
+			}else{
+				axis(4, ax, labels = FALSE)
+				axis(2, ax)
+			}
 		}else if(period == periods){
 			axis(4, ax)
 			axis(2, ax, labels = FALSE)

Modified: pkg/RSiena/man/sienaRI.Rd
===================================================================
--- pkg/RSiena/man/sienaRI.Rd	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSiena/man/sienaRI.Rd	2014-04-17 20:14:57 UTC (rev 272)
@@ -6,7 +6,7 @@
 \title{Functions to assess the relative importance of effects at observation moments}
 \description{
  The function \code{sienaRI} returns the relative importance of effects of a SAOM according to the measure of relative importance described in
- Section 3.2 of Indlekofer and Brandes (2013). 
+ Section 3.1 of Indlekofer and Brandes (2013). 
  The measure is based on the influence of effects on potential tie change or behavior change
  decisions of individual actors in network at the given observation moments. It takes the data as well as the complete model specification into account. Therefore, necessary arguments are the analysed data given as a \code{siena} data object as well as the complete model specification represented either by an estimated \code{sienaFit} object or by the triple consisting of a suitable parameter vector \code{theta} and the corresponding \code{sienaAlgorithm} and \code{sienaEffects} objects.
  }
@@ -49,7 +49,7 @@
 \value{
  If the model contains only one dependent variable, \code{sienaRI} returns an object of class \code{sienaRI}. Otherwise, it returns a list of objects of class \code{sienaRI}, each corresponding to one dependent variable.
  
- A returned \code{sienaRI} object stores the expected relative importances of effects of one dependent variable at observation moments as defined in Section 3.2 of Indlekofer and Brandes (2013).
+ A returned \code{sienaRI} object stores the expected relative importances of effects of one dependent variable at observation moments as defined in Section 3.1 of Indlekofer and Brandes (2013).
 
 A \code{sienaRI} object consists of following components:
     \describe{
@@ -57,7 +57,7 @@
     \item{- \code{effectNames}}{the names of considered effects.}
     \item{- \code{RIActors}}{is a list that contains the expected relative importances of effects for each potential actor decision at observation moments.}
     \item{- \code{expectedRI}}{is a list that contains the expected relative importances of effects aggregated over all actors in each network observations. More precisely, it contains the averages of the actor related values in \code{RIActors}.}
-    \item{- \code{absoluteSumActors}}{is a list that contains the sum of the (unstandardized) L1-differences calculated for each potential actor decision at observation moments. (Cf. Section 3.2 of Indlekofer and Brandes (2013))}
+    \item{- \code{absoluteSumActors}}{is a list that contains the sum of the (unstandardized) L1-differences calculated for each potential actor decision at observation moments. (Cf. Section 3.1 of Indlekofer and Brandes (2013))}
     \item{- \code{entropyActors}}{is a list that contains the entropy of each potential actor decision at observation moments.}
     }
 }
@@ -70,7 +70,7 @@
 }
 }
 \author{Natalie Indlekofer}
-\seealso{\code{sienaRIDynamics}}
+\seealso{\code{\link{sienaRIDynamics}}}
 \examples{
 myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100)
 mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2)))

Added: pkg/RSiena/man/sienaRIDynamics.Rd
===================================================================
--- pkg/RSiena/man/sienaRIDynamics.Rd	                        (rev 0)
+++ pkg/RSiena/man/sienaRIDynamics.Rd	2014-04-17 20:14:57 UTC (rev 272)
@@ -0,0 +1,132 @@
+\name{sienaRIDynamics}
+\alias{sienaRIDynamics}
+\alias{plot.sienaRIDynamics}
+\title{Functions to assess the dynamics of relative importance of effects between observation moments}
+\description{
+ The function \code{sienaRIDynamics} returns the relative importance of effects in a SAOM according to the measure of relative importance described in Indlekofer and Brandes (2013). 
+ More precisely, it returns aggregates of relative importances over simulated micro-steps between observation moments as described in Section 3.2 of the above paper.  
+ The measure is based on the influence of effects on simulated micro-steps and takes the complete model specification into account. 
+ Therefore, required arguments are the analysed data given as a \code{siena} data object (necessary for the micro-steps simulations) 
+ as well as the complete model specification represented either by an estimated \code{sienaFit} object or by the triple consisting of a suitable parameter vector \code{theta} 
+ and the corresponding \code{sienaAlgorithm} and \code{sienaEffects} objects.
+ }
+\usage{
+function(data, ans=NULL, theta=NULL, algorithm=NULL, effects=NULL, depvar=NULL, intervalsPerPeriod=NULL)
+\method{plot}{sienaRIDynamics}(x, staticRI=NULL, file=NULL, col=NULL, ylim=NULL, width=NULL, height=NULL, legend=TRUE, legendColumns=NULL, legendHeight=NULL, cex.legend=NULL, \dots)
+}
+\arguments{
+  \item{data}{\code{siena} data object representing the analyzed data and resulting from a call to \code{\link{sienaDataCreate}}.}
+  \item{ans}{\code{sienaFit} object resulting from a call to \code{\link{siena07}}. 
+  The \code{sienaFit} object contains all necessary information on the model specification, in particular, the vector of parameter values \code{ans$theta}, 
+  the used algorithm for estimation \code{ans$x}, and information on included model effects \code{ans$effects}. 
+  If \code{ans} is a valid \code{sienaFit} object, the calculations of relative importances are based on \code{ans$theta}, \code{ans$x}, and \code{ans$effects}. 
+  Alternatively, the necessary information can be given directly as a suitable parameter vector \code{theta}, a \code{sienaAlgorithm} object, and a \code{sienaEffects} object. 
+  In this case, \code{ans} has to be unspecified (i.e., \code{ans=NULL}).}
+  \item{theta}{Vector of parameter values of effects included in the model. Length of \code{theta} has to be equal to the number of included effects
+   (rate effects as well as evaluation effects).}
+  \item{algorithm}{\code{sienaAlgorithm} object as resulting from a call to \code{\link{sienaAlgorithmCreate}}. 
+  Works only for estimation by Method of Moments (i.e., if  \code{maxlike = FALSE}).}
+  \item{effects}{\code{sienaEffects} object specifying which effects are included the model.}
+  \item{depvar}{If the model contains more than one dependent variable, 
+  it has to be specified for which dependent variable the relative importances of associated effects should be determined. 
+  Only those simulated micro-steps that refer to the selected dependent variable are considered in the aggregated values of relative importance of the corresponding effects.
+  If \code{depvar=NULL}, relative importances will be determined for the first element in the list of dependent variables of \code{data} (\code{attr(data$depvars,"names")[1]}).}
+  \item{intervalsPerPeriod}{For analyzing the dynamics of relative importances between observation moments, the time interval between observation moments is divided into 
+  \code{intervalsPerPeriod} subintervals. The values of relative importance are aggregated over all micro-steps of one subinterval. Default value is 10 subintervals per period.}
+  \item{x}{\code{sienaRIDynamics} object resulting from a call to \code{sienaRIDynamics}.}
+    \item{staticRI}{\code{\link{sienaRI}} object corresponding to the same model and data as x. 
+  If \code{staticRI} is specified, the expected relative importances of effects at observation moment are indicated in the plot by circlets at the beginning of each period.}
+  \item{file}{Name (path) of a pdf-file indicating whether the plot should be stored in a file. 
+  If \code{file=NULL}, the plot will be opened in a separate window. Otherwise a pdf with the given name will be created in the working directory or at the given path.}
+  \item{col}{Colors used in the plot. If \code{col=NULL} a default color scheme is used.}
+  \item{ylim}{A vector of two numbers specifying the maximum and minimum value of the y-range visible in the plot. If \code{ylim=NULL} default values are used.}
+  \item{width}{Width of the plot. If \code{width=NULL} a default value is used.}
+  \item{height}{Height of the plot. If \code{height=NULL} a default value is used.}
+  \item{legend}{Boolean: if \code{TRUE} a legend is added to the plot. \code{x$effectNames} are used as labels.}
+  \item{legendColumns}{Number of columns in legend. If \code{legendColumns=NULL} a default value is used. Only effective if \code{legend=TRUE}.}
+  \item{legendHeight}{Height of legend. If \code{legendHeight=NULL} a default value is used. Only effective if \code{legend=TRUE}.}
+  \item{cex.legend}{Specifies the relative font size of legend labels.}
+  \item{\dots}{Other arguments.}
+}
+\details{
+\code{sienaRIDynamics} takes the data as well as the complete model specification into account. 
+Therefore, necessary arguments are the analyzed data given as a \code{siena} data object as well as the complete model specification 
+represented either by an estimated \code{sienaFit} object or by the triple consisting of a suitable parameter vector \code{theta} 
+and the corresponding \code{sienaAlgorithm} and \code{sienaEffects} objects.
+
+Note that \code{sienaRIDynamics} works only with Method of Moments (i.e., for \code{sienaAlgorithm} objects with \code{maxlike = FALSE}).
+
+If \code{ans} is a valid \code{sienaFit} object that resulted from a call to \code{\link{siena07}} with unconditional estimation (i.e., for \code{sienaAlgorithm} objects with \code{cond = FALSE}), 
+the calculations of relative importances are based on \code{ans$theta}, \code{ans$x}, and \code{ans$effects}. 
+(Note that if the estimation of \code{ans} has been conditional on a dependent variable, it is necessary to give the associated \code{sienaEffects} object
+explicitly to \code{sienaRIDynamics}). 
+
+Alternatively, the necessary information can be given directly as a suitable parameter vector \code{theta} (containing necessary rate and evaluation parameters), 
+a \code{sienaAlgorithm} object, and a \code{sienaEffects} object. In this case, \code{ans} has to be unspecified, i.e., \code{ans=NULL}.
+}
+\value{
+\code{sienaRIDynamics} returns an object of class \code{sienaRIDynamics}. 
+ 
+ A returned \code{sienaRIDynamics} object stores the relative importances of effects in simulated micro-steps aggregated to \code{intervalsPerPeriod}
+  averages per period. For details, see Section 3.2 of Indlekofer and Brandes (2013).
+
+A \code{sienaRIDynamics} object consists of following components:
+    \describe{
+    \item{- \code{intervalValues}}{the relative importances of included effects for simulated micro-steps of the considered dependent variable aggregated over subintervals.}
+    \item{- \code{dependentVariable}}{the name of the dependent variable the results refer to.}
+    \item{- \code{effectNames}}{the names of considered effects.}
+    }
+}
+
+\references{
+\itemize{
+Indlekofer, N. and Brandes, U., 
+ \dQuote{Relative Importance of Effects in Stochastic Actor-oriented Models.}
+ Network Science, 1 (3), 2013.
+}
+}
+\author{Natalie Indlekofer}
+\seealso{\code{\link{sienaRI}}}
+\examples{
+myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100, cond=FALSE)
+mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2)))
+mydata <- sienaDataCreate(mynet1)
+myeff <- getEffects(mydata)
+myeff <- includeEffects(myeff, density, recip, transTies, nbrDist2)
+ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE)
+
+RIDynamics1 <- sienaRIDynamics(mydata, ans=ans)
+RIDynamics1
+\dontrun{
+plot(RIDynamics1)
+}
+
+myalgorithm2 <- sienaAlgorithmCreate(nsub=2, n3=100, cond=TRUE)
+ans2 <- siena07(myalgorithm2, data=mydata, effects=myeff, batch=TRUE)
+
+RIDynamics2 <- sienaRIDynamics(mydata, ans=ans2, effects=myeff)
+RIDynamics2
+
+RIDynamics3<-sienaRIDynamics(data=mydata, theta=c(ans2$rate,ans2$theta), algorithm=myalgorithm2, effects=myeff, intervalsPerPeriod=4)
+RIDynamics3
+
+myalgorithm3 <- sienaAlgorithmCreate(nsub=2, n3=50)
+mynet2 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3)))
+mybeh <- sienaDependent(s50a, type="behavior")
+mydata2 <- sienaDataCreate(mynet2, mybeh)
+myeff2 <- getEffects(mydata2)
+myeff2 <- includeEffects(myeff2, density, recip, transTies, transTrip, nbrDist2)
+ans3 <- siena07(myalgorithm3, data=mydata2, effects=myeff2, batch=TRUE)
+
+RIDynamics4 <- sienaRIDynamics(mydata2, ans=ans3, depvar="mybeh")
+RIDynamics4
+
+RIDynamics5 <- sienaRIDynamics(mydata2, ans=ans3, depvar="mynet2")
+RIDynamics5
+RI <- sienaRI(mydata2, ans=ans3)
+\dontrun{
+plot(RIDynamics5, staticRI=RI[[1]])
+}
+
+}
+\keyword{models}
\ No newline at end of file

Modified: pkg/RSienaTest/ChangeLog
===================================================================
--- pkg/RSienaTest/ChangeLog	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSienaTest/ChangeLog	2014-04-17 20:14:57 UTC (rev 272)
@@ -1,3 +1,10 @@
+2014-04-17 R-Forge Revision 272
+Changes in RSiena and RSienaTest:
+   * sienaRIDynamics.Rd: added
+   * sienaRIDynamics.r: small changes
+   * NAMESPACE: added entries sienaRIDynamics with the corresponding 
+     print, summary, and plot methods.
+     
 2014-04-17 R-Forge Revision 271
 Changes in RSiena and RSienaTest:
    * Added component se to sienaFit objects

Modified: pkg/RSienaTest/DESCRIPTION
===================================================================
--- pkg/RSienaTest/DESCRIPTION	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSienaTest/DESCRIPTION	2014-04-17 20:14:57 UTC (rev 272)
@@ -1,7 +1,7 @@
 Package: RSienaTest
 Type: Package
 Title: Siena - Simulation Investigation for Empirical Network Analysis
-Version: 1.1-271
+Version: 1.1-272
 Date: 2014-04-17
 Author: Ruth Ripley, Krists Boitmanis, Tom A.B. Snijders
 Depends: R (>= 2.15.0)

Modified: pkg/RSienaTest/NAMESPACE
===================================================================
--- pkg/RSienaTest/NAMESPACE	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSienaTest/NAMESPACE	2014-04-17 20:14:57 UTC (rev 272)
@@ -7,7 +7,7 @@
        varCovar, varDyadCovar, setEffect, includeEffects, includeInteraction,
        effectsDocumentation, sienaDataConstraint, print.xtable.sienaFit,
        installGui, siena08, iwlsm, sienaTimeTest, includeTimeDummy,
-       sienaGOF, descriptives.sienaGOF, sienaRI, sparseMatrixExtraction,
+       sienaGOF, descriptives.sienaGOF, sienaRI, sienaRIDynamics, sparseMatrixExtraction,
        networkExtraction, behaviorExtraction,
        OutdegreeDistribution, IndegreeDistribution, BehaviorDistribution,
        xtable, algorithms, profileLikelihoods, siena.table,
@@ -52,6 +52,9 @@
 S3method(summary, sienaRI)
 S3method(print, sienaRI)
 S3method(plot, sienaRI)
+S3method(summary, sienaRIDynamics)
+S3method(print, sienaRIDynamics)
+S3method(plot, sienaRIDynamics)
 S3method(print, chains.data.frame)
 S3method(print, sienaBayesFit)
 S3method(print, summary.sienaBayesFit)

Modified: pkg/RSienaTest/R/sienaRIDynamics.r
===================================================================
--- pkg/RSienaTest/R/sienaRIDynamics.r	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSienaTest/R/sienaRIDynamics.r	2014-04-17 20:14:57 UTC (rev 272)
@@ -9,8 +9,8 @@
 # * in sequences of simulated micro-steps 
 # *****************************************************************************/
 
-##@sienaRIDynamics. Use as RSiena:::sienaRIDynamics()
-sienaRIDynamics <- function(data, ans=NULL, effects=NULL, algorithm=NULL, theta=NULL , depvar=NULL, intervalsPerPeriod=NULL)
+##@sienaRIDynamics. Use as RSienaTest:::sienaRIDynamics()
+sienaRIDynamics <- function(data, ans=NULL, theta=NULL, algorithm=NULL, effects=NULL, depvar=NULL, intervalsPerPeriod=NULL)
 {
 	if(length(data$depvars)>1){
 		if(is.null(depvar)){
@@ -46,10 +46,10 @@
 			}
 			effs <- effects
 		}else{
-		if(!is.null(algorithm)||!is.null(theta)||!is.null(effects))
-		{
-			warning("some information are multiply defined \n results will be based on 'theta', 'algorithm', and 'effects' stored in 'ans' (as 'ans$theta', 'ans$x', 'ans$effects')")
-		}
+			if(!is.null(algorithm)||!is.null(theta)||!is.null(effects))
+			{
+				warning("some information are multiply defined \n results will be based on 'theta', 'algorithm', and 'effects' stored in 'ans' (as 'ans$theta', 'ans$x', 'ans$effects')")
+			}
 			effs <- ans$effects
 		}	
 		if(!is.null(intervalsPerPeriod))
@@ -277,12 +277,44 @@
 
 
 ##@plot.sienaRIDynamics Methods
-plot.sienaRIDynamics <- function(x, staticValues = NULL, file = NULL, col = NULL, ylim=NULL, width = NULL, height = NULL, legend = TRUE, legendColumns = NULL, legendHeight = NULL, cex.legend = NULL, ...)
+plot.sienaRIDynamics <- function(x, staticRI = NULL, file = NULL, col = NULL, ylim=NULL, width = NULL, height = NULL, legend = TRUE, legendColumns = NULL, legendHeight = NULL, cex.legend = NULL, ...)
 { 
-	if (!inherits(x, "sienaRIDynamics"))
+	if(!inherits(x, "sienaRIDynamics"))
 	{
 		stop("x is not of class 'sienaRIDynamics' ")
 	}
+	if(!is.null(staticRI))
+	{
+		if(!inherits(staticRI, "sienaRI"))
+		{
+			warning("staticRI is not of class 'sienaRI' and is therefore ignored")
+			staticValues <- NULL
+		}else{	
+			if(staticRI$dependentVariable != x$dependentVariable)
+			{
+				warning("staticRI does not correspond to x and is therefore ignored,\n staticRI and x do not refer to the same dependent variable")
+				staticValues <- NULL
+			}
+			else if(length(staticRI$effectNames) != length(x$effectNames) || sum(x$effectNames==staticRI$effectNames)!=length(x$effectNames))
+			{
+				warning("staticRI does not correspond to x and is therefore ignored,\n staticRI and x do not refer to the same effects")
+				staticValues <- NULL
+			}
+			else if(length(staticRI$expectedRI)-1 != length(x$intervalValues))
+			{
+				warning("staticRI does not correspond to x and is therefore ignored,\n staticRI and x do not refer to the same number of observation moments")
+				staticValues <- NULL
+			}
+			else
+			{
+				staticValues <- staticRI$expectedRI
+			}
+		}
+	}
+	else
+	{
+		staticValues <- NULL
+	}
 	if(legend)
 	{
 		if(!is.null(legendColumns))
@@ -441,13 +473,18 @@
 			points(ts(t(values[[period]]))[,eff], col = cl[eff], type = "p", pch = 20)
 			if(!is.null(staticValues))
 			{
-				points(xy.coords(1,staticValues[eff]),col = cl[eff], type = "p", pch = 1, cex = 1.75)
+				points(xy.coords(1,staticValues[[period]][eff]),col = cl[eff], type = "p", pch = 1, cex = 1.75)
 			}
 		}
 		ax <- ((ylim[1]*10):(ylim[2]*10))/10
 		if(period==1){
-			axis(4, ax, labels = FALSE)
-			axis(2, ax)
+			if(period == periods){
+				axis(4, ax)
+				axis(2, ax)
+			}else{
+				axis(4, ax, labels = FALSE)
+				axis(2, ax)
+			}
 		}else if(period == periods){
 			axis(4, ax)
 			axis(2, ax, labels = FALSE)

Modified: pkg/RSienaTest/man/sienaRI.Rd
===================================================================
--- pkg/RSienaTest/man/sienaRI.Rd	2014-04-17 14:30:19 UTC (rev 271)
+++ pkg/RSienaTest/man/sienaRI.Rd	2014-04-17 20:14:57 UTC (rev 272)
@@ -6,15 +6,15 @@
 \title{Functions to assess the relative importance of effects at observation moments}
 \description{
  The function \code{sienaRI} returns the relative importance of effects of a SAOM according to the measure of relative importance described in
- Section 3.2 of Indlekofer and Brandes (2013).
+ Section 3.1 of Indlekofer and Brandes (2013). 
  The measure is based on the influence of effects on potential tie change or behavior change
  decisions of individual actors in network at the given observation moments. It takes the data as well as the complete model specification into account. Therefore, necessary arguments are the analysed data given as a \code{siena} data object as well as the complete model specification represented either by an estimated \code{sienaFit} object or by the triple consisting of a suitable parameter vector \code{theta} and the corresponding \code{sienaAlgorithm} and \code{sienaEffects} objects.
  }
 \usage{
 sienaRI(data, ans=NULL, theta=NULL, algorithm=NULL, effects=NULL)
 \method{plot}{sienaRI}(x, file = NULL, col = NULL, addPieChart = FALSE,
-              radius = 1, width = NULL, height = NULL, legend = TRUE,
-              legendColumns = NULL, legendHeight = NULL,
+              radius = 1, width = NULL, height = NULL, legend = TRUE, 
+              legendColumns = NULL, legendHeight = NULL, 
               cex.legend = NULL, cex.names = NULL,\dots)
 }
 \arguments{
@@ -48,29 +48,29 @@
 }
 \value{
  If the model contains only one dependent variable, \code{sienaRI} returns an object of class \code{sienaRI}. Otherwise, it returns a list of objects of class \code{sienaRI}, each corresponding to one dependent variable.
+ 
+ A returned \code{sienaRI} object stores the expected relative importances of effects of one dependent variable at observation moments as defined in Section 3.1 of Indlekofer and Brandes (2013).
 
- A returned \code{sienaRI} object stores the expected relative importances of effects of one dependent variable at observation moments as defined in Section 3.2 of Indlekofer and Brandes (2013).
-
 A \code{sienaRI} object consists of following components:
     \describe{
     \item{- \code{dependentVariable}}{the name of the corresponding dependent variable.}
     \item{- \code{effectNames}}{the names of considered effects.}
     \item{- \code{RIActors}}{is a list that contains the expected relative importances of effects for each potential actor decision at observation moments.}
     \item{- \code{expectedRI}}{is a list that contains the expected relative importances of effects aggregated over all actors in each network observations. More precisely, it contains the averages of the actor related values in \code{RIActors}.}
-    \item{- \code{absoluteSumActors}}{is a list that contains the sum of the (unstandardized) L1-differences calculated for each potential actor decision at observation moments. (Cf. Section 3.2 of Indlekofer and Brandes (2013))}
+    \item{- \code{absoluteSumActors}}{is a list that contains the sum of the (unstandardized) L1-differences calculated for each potential actor decision at observation moments. (Cf. Section 3.1 of Indlekofer and Brandes (2013))}
     \item{- \code{entropyActors}}{is a list that contains the entropy of each potential actor decision at observation moments.}
     }
 }
 
 \references{
 \itemize{
-Indlekofer, N. and Brandes, U.,
+Indlekofer, N. and Brandes, U., 
  \dQuote{Relative Importance of Effects in Stochastic Actor-oriented Models.}
  Network Science, 1 (3), 2013.
 }
 }
 \author{Natalie Indlekofer}
-\seealso{\code{sienaRIDynamics}}
+\seealso{\code{\link{sienaRIDynamics}}}
 \examples{
 myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100)
 mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2)))

Added: pkg/RSienaTest/man/sienaRIDynamics.Rd
===================================================================
--- pkg/RSienaTest/man/sienaRIDynamics.Rd	                        (rev 0)
+++ pkg/RSienaTest/man/sienaRIDynamics.Rd	2014-04-17 20:14:57 UTC (rev 272)
@@ -0,0 +1,132 @@
+\name{sienaRIDynamics}
+\alias{sienaRIDynamics}
+\alias{plot.sienaRIDynamics}
+\title{Functions to assess the dynamics of relative importance of effects between observation moments}
+\description{
+ The function \code{sienaRIDynamics} returns the relative importance of effects in a SAOM according to the measure of relative importance described in Indlekofer and Brandes (2013). 
+ More precisely, it returns aggregates of relative importances over simulated micro-steps between observation moments as described in Section 3.2 of the above paper.  
+ The measure is based on the influence of effects on simulated micro-steps and takes the complete model specification into account. 
+ Therefore, required arguments are the analysed data given as a \code{siena} data object (necessary for the micro-steps simulations) 
+ as well as the complete model specification represented either by an estimated \code{sienaFit} object or by the triple consisting of a suitable parameter vector \code{theta} 
+ and the corresponding \code{sienaAlgorithm} and \code{sienaEffects} objects.
+ }
+\usage{
+function(data, ans=NULL, theta=NULL, algorithm=NULL, effects=NULL, depvar=NULL, intervalsPerPeriod=NULL)
+\method{plot}{sienaRIDynamics}(x, staticRI=NULL, file=NULL, col=NULL, ylim=NULL, width=NULL, height=NULL, legend=TRUE, legendColumns=NULL, legendHeight=NULL, cex.legend=NULL, \dots)
+}
+\arguments{
+  \item{data}{\code{siena} data object representing the analyzed data and resulting from a call to \code{\link{sienaDataCreate}}.}
+  \item{ans}{\code{sienaFit} object resulting from a call to \code{\link{siena07}}. 
+  The \code{sienaFit} object contains all necessary information on the model specification, in particular, the vector of parameter values \code{ans$theta}, 
+  the used algorithm for estimation \code{ans$x}, and information on included model effects \code{ans$effects}. 
+  If \code{ans} is a valid \code{sienaFit} object, the calculations of relative importances are based on \code{ans$theta}, \code{ans$x}, and \code{ans$effects}. 
+  Alternatively, the necessary information can be given directly as a suitable parameter vector \code{theta}, a \code{sienaAlgorithm} object, and a \code{sienaEffects} object. 
+  In this case, \code{ans} has to be unspecified (i.e., \code{ans=NULL}).}
+  \item{theta}{Vector of parameter values of effects included in the model. Length of \code{theta} has to be equal to the number of included effects
+   (rate effects as well as evaluation effects).}
+  \item{algorithm}{\code{sienaAlgorithm} object as resulting from a call to \code{\link{sienaAlgorithmCreate}}. 
+  Works only for estimation by Method of Moments (i.e., if  \code{maxlike = FALSE}).}
+  \item{effects}{\code{sienaEffects} object specifying which effects are included the model.}
+  \item{depvar}{If the model contains more than one dependent variable, 
+  it has to be specified for which dependent variable the relative importances of associated effects should be determined. 
+  Only those simulated micro-steps that refer to the selected dependent variable are considered in the aggregated values of relative importance of the corresponding effects.
+  If \code{depvar=NULL}, relative importances will be determined for the first element in the list of dependent variables of \code{data} (\code{attr(data$depvars,"names")[1]}).}
+  \item{intervalsPerPeriod}{For analyzing the dynamics of relative importances between observation moments, the time interval between observation moments is divided into 
+  \code{intervalsPerPeriod} subintervals. The values of relative importance are aggregated over all micro-steps of one subinterval. Default value is 10 subintervals per period.}
+  \item{x}{\code{sienaRIDynamics} object resulting from a call to \code{sienaRIDynamics}.}
+    \item{staticRI}{\code{\link{sienaRI}} object corresponding to the same model and data as x. 
+  If \code{staticRI} is specified, the expected relative importances of effects at observation moment are indicated in the plot by circlets at the beginning of each period.}
+  \item{file}{Name (path) of a pdf-file indicating whether the plot should be stored in a file. 
+  If \code{file=NULL}, the plot will be opened in a separate window. Otherwise a pdf with the given name will be created in the working directory or at the given path.}
+  \item{col}{Colors used in the plot. If \code{col=NULL} a default color scheme is used.}
+  \item{ylim}{A vector of two numbers specifying the maximum and minimum value of the y-range visible in the plot. If \code{ylim=NULL} default values are used.}
+  \item{width}{Width of the plot. If \code{width=NULL} a default value is used.}
+  \item{height}{Height of the plot. If \code{height=NULL} a default value is used.}
+  \item{legend}{Boolean: if \code{TRUE} a legend is added to the plot. \code{x$effectNames} are used as labels.}
+  \item{legendColumns}{Number of columns in legend. If \code{legendColumns=NULL} a default value is used. Only effective if \code{legend=TRUE}.}
[TRUNCATED]

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


More information about the Rsiena-commits mailing list