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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 6 17:21:50 CEST 2009


Author: ripleyrm
Date: 2009-08-06 17:21:47 +0200 (Thu, 06 Aug 2009)
New Revision: 9

Modified:
   pkg/RSiena/R/phase3.r
   pkg/RSiena/R/robmon.r
   pkg/RSiena/R/siena07.r
   pkg/RSiena/man/sienaModelOptions.Rd
Log:
Processors on different machines, fix to number of iterations.

Modified: pkg/RSiena/R/phase3.r
===================================================================
--- pkg/RSiena/R/phase3.r	2009-08-05 16:31:33 UTC (rev 8)
+++ pkg/RSiena/R/phase3.r	2009-08-06 15:21:47 UTC (rev 9)
@@ -20,10 +20,28 @@
     int <- z$int
 
     if (x$checktime) z$ctime <- proc.time()[3]
-    z$sf <- matrix(0, nrow = x$n3, ncol = z$pp)
-    z$sf2 <- array(0, dim = c(x$n3, f$observations - 1, z$pp))
-    z$ssc <- array(0, dim = c(x$n3, f$observations - 1, z$pp))
-    z$sdf <- array(0, dim = c(x$n3, z$pp, z$pp))
+    ## fix up iteration numbers if using multiple processors
+    if (10 %% int == 0)
+    {
+        firstNit <- 10
+    }
+    else
+    {
+        firstNit <- 10 + int - 10 %% int
+    }
+    if ((x$n3 - firstNit) %% int == 0)
+    {
+        endNit <- x$n3
+    }
+    else
+    {
+        endNit <- x$n3  + int - (x$n3 - firstNit) %% int
+    }
+    z$n3 <- endNit
+    z$sf <- matrix(0, nrow = z$n3, ncol = z$pp)
+    z$sf2 <- array(0, dim = c(z$n3, f$observations - 1, z$pp))
+    z$ssc <- array(0, dim = c(z$n3, f$observations - 1, z$pp))
+    z$sdf <- array(0, dim = c(z$n3, z$pp, z$pp))
     ## revert to original requested method for phase 3
     z$Deriv <- !x$FinDiff.method
     if (x$FinDiff.method)

Modified: pkg/RSiena/R/robmon.r
===================================================================
--- pkg/RSiena/R/robmon.r	2009-08-05 16:31:33 UTC (rev 8)
+++ pkg/RSiena/R/robmon.r	2009-08-06 15:21:47 UTC (rev 9)
@@ -11,7 +11,7 @@
 ##args:x: model object - intended to be read only
 ##     z: model fitting object
 ## returns updated z
-robmon <- function(z, x, useCluster, noClusters, initC, ...)
+robmon <- function(z, x, useCluster, noClusters, initC, clusterString, ...)
 {
     z$FinDiff.method<- x$FinDiff.method
     z$n <- 0
@@ -38,7 +38,7 @@
         {
             stop("Multiple processors only for simstats0c at present")
         }
-        cl <- makeCluster(rep("localhost", noClusters), type = "SOCK",
+        cl <- makeCluster(clusterString, type = "SOCK",
                           outfile = 'cluster.out')
         clusterSetupRNG(cl, seed = rep(1, 6))
         clusterCall(cl, library, "RSiena", character.only = TRUE)

Modified: pkg/RSiena/R/siena07.r
===================================================================
--- pkg/RSiena/R/siena07.r	2009-08-05 16:31:33 UTC (rev 8)
+++ pkg/RSiena/R/siena07.r	2009-08-06 15:21:47 UTC (rev 9)
@@ -16,7 +16,8 @@
 cf <- NULL
 
 siena07<- function(x, batch = FALSE, verbose = FALSE, useCluster = FALSE,
-                   noClusters = 2, initC=FALSE, tt=NULL,
+                   noClusters = 2, initC=FALSE,
+                   clusterString=rep("localhost", noClusters), tt=NULL,
                    parallelTesting=FALSE, ...)
 {
     exitfn <- function()
@@ -100,7 +101,7 @@
         z$pb <- list(pb=NULL, pbval=0, pbmax=1)
     }
 
-    z <- robmon(z, x, useCluster, noClusters, initC, ...)
+    z <- robmon(z, x, useCluster, noClusters, initC, clusterString,...)
 
     time1 <-  proc.time()['elapsed']
     Report(c("Total computation time", round(time1 - time0, digits=2),

Modified: pkg/RSiena/man/sienaModelOptions.Rd
===================================================================
--- pkg/RSiena/man/sienaModelOptions.Rd	2009-08-05 16:31:33 UTC (rev 8)
+++ pkg/RSiena/man/sienaModelOptions.Rd	2009-08-06 15:21:47 UTC (rev 9)
@@ -8,7 +8,7 @@
 \details{
   Called from the \code{Apply} function in \code{\link{siena01Gui}}. An
   internal function of \code{\link{siena01Gui}}.
-  
+
   Various parameters can be set on the upper part of the screen:
   \describe{
 	\item{Estimation Method}{0 for Unconditional fitting, 1 for
@@ -19,7 +19,7 @@
 	  the default ones.}
 	\item{Specify random seed}{If you wish your run to be repeatable, check
 	  this box and then choose any integer as the seed.}
-	\item{}{Number of processors}{If checked, a box will appear for you to
+	\item{Number of processors}{If checked, a box will appear for you to
 	  select the number of processors to be used. All processes will run on
 	  the same machine.}
 	\item{Initial value of gain parameter}{A parameter to control the
@@ -30,7 +30,7 @@
 	\item{Derivative method}{0 for finite differences, 1 for score
 	  function. Default 1.}
 	\item{Number of phase 3 iterations}{Default 1000.}
-  }  
+  }
   If you wish to restrict the degree of the simulations, enter the value
   in the table on the bottom left.
 



More information about the Rsiena-commits mailing list