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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 5 18:31:35 CEST 2009


Author: ripleyrm
Date: 2009-08-05 18:31:33 +0200 (Wed, 05 Aug 2009)
New Revision: 8

Modified:
   pkg/RSiena/DESCRIPTION
   pkg/RSiena/R/siena01.r
   pkg/RSiena/man/sienaModelOptions.Rd
Log:
Add number of processors to the model options screen

Modified: pkg/RSiena/DESCRIPTION
===================================================================
--- pkg/RSiena/DESCRIPTION	2009-08-02 13:51:38 UTC (rev 7)
+++ pkg/RSiena/DESCRIPTION	2009-08-05 16:31:33 UTC (rev 8)
@@ -14,4 +14,3 @@
 LazyLoad: yes
 LazyData: yes
 URL: http://www.stats.ox.ac.uk/~snijders/siena
-Packaged: 2009-08-02 13:34:06 UTC; ruth

Modified: pkg/RSiena/R/siena01.r
===================================================================
--- pkg/RSiena/R/siena01.r	2009-08-02 13:51:38 UTC (rev 7)
+++ pkg/RSiena/R/siena01.r	2009-08-05 16:31:33 UTC (rev 8)
@@ -48,6 +48,8 @@
     ph2spinVar  <-  NULL
     rsspinVar <- NULL
     rsVar <- NULL
+    clustVar  <-  NULL
+    clustspinVar <- NULL
     derivVar <- NULL
     ph3spinVar <- NULL
     maxdfVar <- NULL
@@ -424,7 +426,15 @@
         {
             model$randomSeed <- as.numeric(tclvalue(rsspinVar))
         }
-        model$FinDiff.method <- tclvalue(derivVar) == '0. crude Monte Carlo'
+         if (tclvalue(clustVar) == '0')
+        {
+            model$nbrClusters <- 1
+        }
+        else
+        {
+            model$nbrClusters <- as.numeric(tclvalue(clustspinVar))
+        }
+       model$FinDiff.method <- tclvalue(derivVar) == '0. crude Monte Carlo'
         model$n3 <- as.numeric(tclvalue(ph3spinVar))
         degs <- rep(0, nMaxDegree)
         for (i in 1:nMaxDegree)
@@ -484,10 +494,20 @@
         {
             ##create mymodel
             mymodel <<- modelFromTcl()
-            if (inherits(resp <- try(siena07(mymodel, data=mydata,
-                                             effects=myeff),
-                                     silent=TRUE), "try-error"))
+            if (mymodel$nbrClusters > 1)
             {
+                resp <- try(siena07(mymodel, data=mydata, effects=myeff,
+                                    useCluster=TRUE, initC=TRUE,
+                                    noClusters=mymodel$nbrClusters),
+                            silent=TRUE)
+            }
+            else
+            {
+                resp <- try(siena07(mymodel, data=mydata, effects=myeff),
+                            silent=TRUE)
+            }
+            if (inherits(resp, "try-error"))
+            {
                 tkmessageBox(message=resp, icon="error")
             }
             else ## update the thetas to use next time
@@ -543,6 +563,19 @@
                 tkgrid(rsspin, row=3, column=1)
             }
         }
+        clustersFn <- function()
+        {
+            val <- as.numeric(tclvalue(clustVar))
+            if (val == 0)
+            {
+                tkgrid.forget(clustspin)
+                tclvalue(clustspinVar) <<- 0
+            }
+            else
+            {
+                tkgrid(clustspin, row=4, column=1)
+            }
+        }
         returnFn <- function()
         {
             ans <- tkmessageBox(message="Do you want to save the model?",
@@ -736,6 +769,17 @@
                             textvariable=rsspinVar, cursor="arrow")
         tkgrid(rs, row=3, sticky='w')
 
+        ##create and display fields for number of processors entry
+        clustVar <<- tclVar()
+        tclvalue(clustVar) <<- '0'
+        clust <- tkcheckbutton(optf,
+                               text=' Number of processors: ',
+                               variable=clustVar,
+                               command=clustersFn)
+        clustspinVar <<- tclVar()
+        clustspin <-  tkwidget(optf, 'spinbox', from=2, to=1000, width=10,
+                            textvariable=clustspinVar, cursor="arrow")
+        tkgrid(clust, row=4, sticky='w')
         ##create and display field for derivative method
         derivlab <- tklabel(optf, text=' Derivative method ')
         derivlist <- c('0. crude Monte Carlo',

Modified: pkg/RSiena/man/sienaModelOptions.Rd
===================================================================
--- pkg/RSiena/man/sienaModelOptions.Rd	2009-08-02 13:51:38 UTC (rev 7)
+++ pkg/RSiena/man/sienaModelOptions.Rd	2009-08-05 16:31:33 UTC (rev 8)
@@ -8,9 +8,29 @@
 \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.
-
+  
+  Various parameters can be set on the upper part of the screen:
+  \describe{
+	\item{Estimation Method}{0 for Unconditional fitting, 1 for
+	  Conditional. If there are multiple dependent variables, a list will be
+	  displayed from which to choose.}
+	\item{Standard starting value}{If checked, the estimation will ignore
+	  the initial values of the parameters in the effects object, and use
+	  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
+	  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
+	  Robbins-Monro algorithm. Will be multiplied by the number of
+	  processors before use.}
+	\item{Number of phase 2 subphases}{Default 4. To omit phase 2, set this
+	  to 0.}
+	\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