[Rsiena-commits] r350 - in pkg: RSiena RSiena/R RSiena/inst RSiena/inst/doc RSiena/man RSienaTest RSienaTest/R RSienaTest/doc RSienaTest/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 16 16:04:34 CEST 2020
Author: tomsnijders
Date: 2020-09-16 16:04:33 +0200 (Wed, 16 Sep 2020)
New Revision: 350
Added:
pkg/RSiena/inst/doc/
pkg/RSiena/inst/doc/basicRSiena.R
pkg/RSiena/inst/doc/basicRSiena.Rmd
pkg/RSiena/inst/doc/basicRSiena.html
pkg/RSiena/inst/doc/index.html
Removed:
pkg/RSiena/vignettes/
Modified:
pkg/RSiena/ChangeLog
pkg/RSiena/DESCRIPTION
pkg/RSiena/NAMESPACE
pkg/RSiena/R/phase2.r
pkg/RSiena/R/robmon.r
pkg/RSiena/R/siena07.r
pkg/RSiena/R/siena07gui.r
pkg/RSiena/R/sienaModelCreate.r
pkg/RSiena/man/RSiena-package.Rd
pkg/RSienaTest/ChangeLog
pkg/RSienaTest/DESCRIPTION
pkg/RSienaTest/NAMESPACE
pkg/RSienaTest/R/phase2.r
pkg/RSienaTest/R/robmon.r
pkg/RSienaTest/R/siena07.r
pkg/RSienaTest/R/siena07gui.r
pkg/RSienaTest/R/sienaModelCreate.r
pkg/RSienaTest/doc/RSiena_Manual.pdf
pkg/RSienaTest/doc/RSiena_Manual.tex
pkg/RSienaTest/man/RSiena-package.Rd
Log:
Version 1.2-27
Modified: pkg/RSiena/ChangeLog
===================================================================
--- pkg/RSiena/ChangeLog 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/ChangeLog 2020-09-16 14:04:33 UTC (rev 350)
@@ -1,4 +1,4 @@
-2020-09-12 R-Forge Revision 348, package version 1.2-26.
+2020-09-16 R-Forge Revision 350, package version 1.2-27.
Changes in RSiena and RSienaTest:
* Changed requirement for tcltk to "Suggests",
and further modified / cleaned up DESCRIPTION.
@@ -18,6 +18,8 @@
by class(...)[1].
* multiplication factor added to print.sienaAlgorithm if maxlike.
* SienaAlgorithmCreate: requirements for mult corrected in help page.
+ * In sienaAlgorithmCreate, use the definitions for projname=NULL
+ also if any environment variable _R_CHECK* is set.
Changes in RSiena:
* Vignette basicRSiena added (was earlier available as a script);
thanks to James Hollway.
Modified: pkg/RSiena/DESCRIPTION
===================================================================
--- pkg/RSiena/DESCRIPTION 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/DESCRIPTION 2020-09-16 14:04:33 UTC (rev 350)
@@ -2,8 +2,8 @@
Package: RSiena
Type: Package
Title: Siena - Simulation Investigation for Empirical Network Analysis
-Version: 1.2-26
-Date: 2020-09-12
+Version: 1.2-27
+Date: 2020-09-16
Authors at R: c(person("Tom A.B.", "Snijders", role = c("cre", "aut"), email = "tom.snijders at nuffield.ox.ac.uk", comment = c(ORCID = "0000-0003-3157-4157")),
person("Christian", "Steglich", role = c("aut","ctb"), comment = c(ORCID = "0000-0002-9097-0873")),
person("Johan", "Koskinen", role = c("aut","ctb"), comment = c(ORCID = "0000-0002-6860-325X")),
@@ -49,6 +49,5 @@
Biarch: yes
NeedsCompilation: yes
BuildResaveData: no
-BuildVignettes: yes
-VignetteBuilder: knitr, rmarkdown
+BuildVignettes: no
URL: http://www.stats.ox.ac.uk/~snijders/siena
Modified: pkg/RSiena/NAMESPACE
===================================================================
--- pkg/RSiena/NAMESPACE 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/NAMESPACE 2020-09-16 14:04:33 UTC (rev 350)
@@ -15,7 +15,7 @@
siena.table, xtable, score.Test, Wald.RSiena, Multipar.RSiena
)
-import(Matrix, tcltk, lattice, parallel, MASS)
+import(Matrix, lattice, parallel, MASS)
importFrom("grDevices", "rgb", "xy.coords")
importFrom("graphics", "axis", "barplot", "contour", "layout", "lines",
"mtext", "pairs", "panel.smooth", "par", "pie", "plot",
Modified: pkg/RSiena/R/phase2.r
===================================================================
--- pkg/RSiena/R/phase2.r 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/R/phase2.r 2020-09-16 14:04:33 UTC (rev 350)
@@ -32,9 +32,9 @@
z$writefreq <- 1
if (!is.batch())
{
- tkconfigure(z$tkvars$earlyEndPhase2,state='normal')
- tkconfigure(z$tkvars$subphase,state='normal')
- tkconfigure(z$tkvars$subphaselabel,state='normal')
+ tcltk::tkconfigure(z$tkvars$earlyEndPhase2,state='normal')
+ tcltk::tkconfigure(z$tkvars$subphase,state='normal')
+ tcltk::tkconfigure(z$tkvars$subphaselabel,state='normal')
}
z$Deriv <- FALSE
msf <- as.matrix(cov(z$sf)) # as.matrix() just in case z$pp = 1
Modified: pkg/RSiena/R/robmon.r
===================================================================
--- pkg/RSiena/R/robmon.r 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/R/robmon.r 2020-09-16 14:04:33 UTC (rev 350)
@@ -38,7 +38,7 @@
}
if (z$maxlike && !is.batch())
{
- tkconfigure(z$tkvars$phaselabel, text="MCMC Burnin")
+ tcltk::tkconfigure(z$tkvars$phaselabel, text="MCMC Burnin")
}
#######################################################
##do initial setup call of FRAN
@@ -50,7 +50,7 @@
z <- initializeFRAN(z, x, initC=FALSE, ...)
if (z$maxlike && !is.batch())
{
- tkconfigure(z$tkvars$phaselabel, text="Phase")
+ tcltk::tkconfigure(z$tkvars$phaselabel, text="Phase")
}
##
##if conditional, FRAN changes z$theta etc
@@ -193,10 +193,10 @@
phase3Only <- FALSE
if (!is.batch())
{
- tkdelete(z$tkvars$subphase, 0, "end")
- tkconfigure(z$tkvars$earlyEndPhase2, state="disabled")
- tkconfigure(z$tkvars$subphase, state="disabled")
- tkconfigure(z$tkvars$subphaselabel, state="disabled")
+ tcltk::tkdelete(z$tkvars$subphase, 0, "end")
+ tcltk::tkconfigure(z$tkvars$earlyEndPhase2, state="disabled")
+ tcltk::tkconfigure(z$tkvars$subphase, state="disabled")
+ tcltk::tkconfigure(z$tkvars$subphaselabel, state="disabled")
}
if (z$AllNowFixed || x$nsub == 0)
{
@@ -258,10 +258,10 @@
{
if (!is.batch())
{
- tkdelete(z$tkvars$subphase,0,'end')
- tkconfigure(z$tkvars$earlyEndPhase2,state='disabled')
- tkconfigure(z$tkvars$subphase,state='disabled')
- tkconfigure(z$tkvars$subphaselabel,state='disabled')
+ tcltk::tkdelete(z$tkvars$subphase,0,'end')
+ tcltk::tkconfigure(z$tkvars$earlyEndPhase2,state='disabled')
+ tcltk::tkconfigure(z$tkvars$subphase,state='disabled')
+ tcltk::tkconfigure(z$tkvars$subphaselabel,state='disabled')
}
break
}
@@ -274,10 +274,10 @@
{
if (!is.batch())
{
- tkdelete(z$tkvars$subphase,0,'end')
- tkconfigure(z$tkvars$earlyEndPhase2, state='disabled')
- tkconfigure(z$tkvars$subphase, state='disabled')
- tkconfigure(z$tkvars$subphaselabel, state='disabled')
+ tcltk::tkdelete(z$tkvars$subphase,0,'end')
+ tcltk::tkconfigure(z$tkvars$earlyEndPhase2, state='disabled')
+ tcltk::tkconfigure(z$tkvars$subphase, state='disabled')
+ tcltk::tkconfigure(z$tkvars$subphaselabel, state='disabled')
}
break
}
@@ -291,11 +291,11 @@
{
if (!is.batch())
{
- tkdelete(z$tkvars$subphase, 0, 'end')
- tkconfigure(z$tkvars$earlyEndPhase2,
+ tcltk::tkdelete(z$tkvars$subphase, 0, 'end')
+ tcltk::tkconfigure(z$tkvars$earlyEndPhase2,
state='disabled')
- tkconfigure(z$tkvars$subphase, state='disabled')
- tkconfigure(z$tkvars$subphaselabel,
+ tcltk::tkconfigure(z$tkvars$subphase, state='disabled')
+ tcltk::tkconfigure(z$tkvars$subphaselabel,
state='disabled')
}
break
@@ -306,11 +306,11 @@
{
if (!is.batch())
{
- tkdelete(z$tkvars$subphase, 0, 'end')
- tkconfigure(z$tkvars$subphase, state='disabled')
- tkconfigure(z$tkvars$subphaselabel,
+ tcltk::tkdelete(z$tkvars$subphase, 0, 'end')
+ tcltk::tkconfigure(z$tkvars$subphase, state='disabled')
+ tcltk::tkconfigure(z$tkvars$subphaselabel,
state='disabled')
- tkconfigure(z$tkvars$earlyEndPhase2,
+ tcltk::tkconfigure(z$tkvars$earlyEndPhase2,
state='disabled')
}
break
@@ -319,10 +319,10 @@
}
if (!is.batch())
{
- tkdelete(z$tkvars$subphase, 0, 'end')
- tkconfigure(z$tkvars$subphase, state='disabled')
- tkconfigure(z$tkvars$subphaselabel, state='disabled')
- tkconfigure(z$tkvars$earlyEndPhase2, state='disabled')
+ tcltk::tkdelete(z$tkvars$subphase, 0, 'end')
+ tcltk::tkconfigure(z$tkvars$subphase, state='disabled')
+ tcltk::tkconfigure(z$tkvars$subphaselabel, state='disabled')
+ tcltk::tkconfigure(z$tkvars$earlyEndPhase2, state='disabled')
}
z<- phase3(z, x, ...)
break
Modified: pkg/RSiena/R/siena07.r
===================================================================
--- pkg/RSiena/R/siena07.r 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/R/siena07.r 2020-09-16 14:04:33 UTC (rev 350)
@@ -279,11 +279,11 @@
## require(tcltk)
if (!is.batch())
{
- tkdelete(z$tkvars$phase, 0, "end")
- tkinsert(z$tkvars$phase, 0, paste(" ", z$Phase))
- tkdelete(z$tkvars$subphase, 0, "end")
- tkdelete(z$tkvars$iteration, 0, "end")
- tkinsert(z$tkvars$iteration, 0, format(0, width=6))
+ tcltk::tkdelete(z$tkvars$phase, 0, "end")
+ tcltk::tkinsert(z$tkvars$phase, 0, paste(" ", z$Phase))
+ tcltk::tkdelete(z$tkvars$subphase, 0, "end")
+ tcltk::tkdelete(z$tkvars$iteration, 0, "end")
+ tcltk::tkinsert(z$tkvars$iteration, 0, format(0, width=6))
}
if (missing(subphase))
{
@@ -297,7 +297,7 @@
{
if (!is.batch())
{
- tkinsert(z$tkvars$subphase, 0, paste(" ", subphase))
+ tcltk::tkinsert(z$tkvars$subphase, 0, paste(" ", subphase))
}
else
{
@@ -310,9 +310,9 @@
{
if (!is.batch())
{
- tkconfigure(z$tkvars$current, height=min(z$pp, 30))
- tkconfigure(z$tkvars$deviation, height=min(z$pp, 30))
- tkconfigure(z$tkvars$quasi, height=min(z$pp, 30))
+ tcltk::tkconfigure(z$tkvars$current, height=min(z$pp, 30))
+ tcltk::tkconfigure(z$tkvars$deviation, height=min(z$pp, 30))
+ tcltk::tkconfigure(z$tkvars$quasi, height=min(z$pp, 30))
}
n1pos <- z$n1 * (z$pp + 1)
z$n2min0 <- 7 + z$pp
@@ -397,8 +397,8 @@
if (!is.batch())
{
DisplayTheta(z)
- tkdelete(z$tkvars$quasi, "1.0", "end")
- tkinsert(z$tkvars$quasi, "1.0", FormatString(z$pp, z$ac))
+ tcltk::tkdelete(z$tkvars$quasi, "1.0", "end")
+ tcltk::tkinsert(z$tkvars$quasi, "1.0", FormatString(z$pp, z$ac))
}
else
{
@@ -424,8 +424,8 @@
{
if (!is.batch())
{
- tkdelete(z$tkvars$current, "1.0", "end")
- tkinsert(z$tkvars$current, "1.0", FormatString(z$pp, z$theta))
+ tcltk::tkdelete(z$tkvars$current, "1.0", "end")
+ tcltk::tkinsert(z$tkvars$current, "1.0", FormatString(z$pp, z$theta))
}
}
@@ -444,8 +444,8 @@
{
if (!is.batch())
{
- tkdelete(z$tkvars$deviations, "1.0", "end")
- tkinsert(z$tkvars$deviations, "1.0", FormatString(z$pp, fra))
+ tcltk::tkdelete(z$tkvars$deviations, "1.0", "end")
+ tcltk::tkinsert(z$tkvars$deviations, "1.0", FormatString(z$pp, fra))
}
}
##@DisplayIteration siena07 Progress reporting
@@ -453,9 +453,9 @@
{
if (!is.batch())
{
- tkdelete(z$tkvars$iteration, 0, "end")
- tkinsert(z$tkvars$iteration, 0, format(z$nit, width=6))
- tcl("update")
+ tcltk::tkdelete(z$tkvars$iteration, 0, "end")
+ tcltk::tkinsert(z$tkvars$iteration, 0, format(z$nit, width=6))
+ tcltk::tcl("update")
}
}
##@Root siena07 Safe square root for compatibility with siena3. Probably not necessary in R.
@@ -470,7 +470,7 @@
if (is.batch())
val <- pb$pbval
else
- val <- as.numeric(tclvalue(tkcget(pb$pb, "-value")))
+ val <- as.numeric(tcltk::tclvalue(tcltk::tkcget(pb$pb, "-value")))
val
}
@@ -483,8 +483,8 @@
}
else
{
- tkconfigure(pb$pb, value=val)
- tcl("update")
+ tcltk::tkconfigure(pb$pb, value=val)
+ tcltk::tcl("update")
}
pb
}
@@ -494,13 +494,13 @@
if (is.batch())
pb$pbmax <- maxvalue
else
- tkconfigure(pb$pb, maximum=maxvalue)
+ tcltk::tkconfigure(pb$pb, maximum=maxvalue)
pb
}
##@tkErrorMessage Miscellaneous Not used
tkErrorMessage <- function()
{
- tkmessageBox(geterrmessage(), icon="error")
+ tcltk::tkmessageBox(geterrmessage(), icon="error")
}
##@errorHandler Miscellaneous Not used
Modified: pkg/RSiena/R/siena07gui.r
===================================================================
--- pkg/RSiena/R/siena07gui.r 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/R/siena07gui.r 2020-09-16 14:04:33 UTC (rev 350)
@@ -34,64 +34,64 @@
if (is.null(tt))
{
## require(tcltk)
- tt <- tktoplevel()
+ tt <- tcltk::tktoplevel()
}
- tkwm.title(tt,'Siena07')
- frame <- tkframe(tt, width=300, height=300, relief='ridge')
- tkpack(frame, side='top', padx=5)
- button1 <- tkbutton(frame, command=myInterrupt, text='Interrupt')
- button2 <- tkbutton(frame, command=myEndPhase2, text='End Phase2',
+ tcltk::tkwm.title(tt,'Siena07')
+ frame <- tcltk::tkframe(tt, width=300, height=300, relief='ridge')
+ tcltk::tkpack(frame, side='top', padx=5)
+ button1 <- tcltk::tkbutton(frame, command=myInterrupt, text='Interrupt')
+ button2 <- tcltk::tkbutton(frame, command=myEndPhase2, text='End Phase2',
state='disabled')
- button3 <- tkbutton(frame, command=myRestart, text='Restart')
- tkgrid.configure(button1, column=1, columnspan=2, row=1, padx=20, pady=20)
- tkgrid.configure(button2, column=3, row=1, padx=20)
- tkgrid.configure(button3, column=4, row=1, padx=20)
- phaselabel <- tklabel(frame, text='Phase')
- subphaselabel <- tklabel(frame, text='Subphase', state='disabled')
- iterationlabel <- tklabel(frame, text='Iteration')
- label1 <- tklabel(frame, text='ProgressBar')
+ button3 <- tcltk::tkbutton(frame, command=myRestart, text='Restart')
+ tcltk::tkgrid.configure(button1, column=1, columnspan=2, row=1, padx=20, pady=20)
+ tcltk::tkgrid.configure(button2, column=3, row=1, padx=20)
+ tcltk::tkgrid.configure(button3, column=4, row=1, padx=20)
+ phaselabel <- tcltk::tklabel(frame, text='Phase')
+ subphaselabel <- tcltk::tklabel(frame, text='Subphase', state='disabled')
+ iterationlabel <- tcltk::tklabel(frame, text='Iteration')
+ label1 <- tcltk::tklabel(frame, text='ProgressBar')
- phase <- tkentry(frame, width=2)
+ phase <- tcltk::tkentry(frame, width=2)
- subphase <- tkentry(frame, width=2, state='disabled')
- iteration <- tkentry(frame, width=6)
- progressbar <- ttkprogressbar(frame, max=2000, length=120)
+ subphase <- tcltk::tkentry(frame, width=2, state='disabled')
+ iteration <- tcltk::tkentry(frame, width=6)
+ progressbar <- tcltk::ttkprogressbar(frame, max=2000, length=120)
- tkgrid.configure(phaselabel, column=1, row=2, pady=5)
- tkgrid.configure(subphaselabel, column=2, row=2)
- tkgrid.configure(iterationlabel, column=3, row=2)
- tkgrid.configure(label1, column=4, row=2, padx=5)
- tkgrid.configure(phase, column=1, row=3, pady=3)
- tkgrid.configure(subphase, column=2, row=3, padx=10)
- tkgrid.configure(iteration, column=3, row=3, padx=10)
+ tcltk::tkgrid.configure(phaselabel, column=1, row=2, pady=5)
+ tcltk::tkgrid.configure(subphaselabel, column=2, row=2)
+ tcltk::tkgrid.configure(iterationlabel, column=3, row=2)
+ tcltk::tkgrid.configure(label1, column=4, row=2, padx=5)
+ tcltk::tkgrid.configure(phase, column=1, row=3, pady=3)
+ tcltk::tkgrid.configure(subphase, column=2, row=3, padx=10)
+ tcltk::tkgrid.configure(iteration, column=3, row=3, padx=10)
- tkgrid.configure(progressbar, column=4, padx=5, row=3)
- label2 <- tklabel(frame, text='Current parameter values')
- label3 <- tklabel(frame, text='Quasi-autocorrelations')
- label4 <- tklabel(frame, text='Deviation values')
+ tcltk::tkgrid.configure(progressbar, column=4, padx=5, row=3)
+ label2 <- tcltk::tklabel(frame, text='Current parameter values')
+ label3 <- tcltk::tklabel(frame, text='Quasi-autocorrelations')
+ label4 <- tcltk::tklabel(frame, text='Deviation values')
- tkgrid.configure(label2, column=1, columnspan=2, row=4, padx=10)
- tkgrid.configure(label3, column=3, row=4, padx=10)
- tkgrid.configure(label4, column=4, row=4, padx=10)
+ tcltk::tkgrid.configure(label2, column=1, columnspan=2, row=4, padx=10)
+ tcltk::tkgrid.configure(label3, column=3, row=4, padx=10)
+ tcltk::tkgrid.configure(label4, column=4, row=4, padx=10)
- text1 <- tktext(frame, height=6, width=14)
+ text1 <- tcltk::tktext(frame, height=6, width=14)
- text2 <- tktext(frame, height=6, width=14)
- text3 <- tktext(frame, height=6, width=14)
- tkgrid.configure(text1, column=1, columnspan=2, row=5, padx=20, pady=5)
+ text2 <- tcltk::tktext(frame, height=6, width=14)
+ text3 <- tcltk::tktext(frame, height=6, width=14)
+ tcltk::tkgrid.configure(text1, column=1, columnspan=2, row=5, padx=20, pady=5)
- tkgrid.configure(text2, column=3, row=5, padx=20)
- tkgrid.configure(text3, column=4, row=5, padx=20)
- ilcampo <- tclVar()
- tcl("image", "create", "photo", ilcampo, file=imagepath)
- frame2 <- tkframe(tt, width=300, height=300, relief='ridge')
- tkpack(frame2, side='bottom', padx=5)
- imgAsLabel <- tklabel(frame2, image=ilcampo)
- tkgrid.configure(imgAsLabel, pady=10)
- tkinsert(phase, 0, ' 1')
- tkgrab.set(tt)
- tcl('update')
- tkfocus(tt)
+ tcltk::tkgrid.configure(text2, column=3, row=5, padx=20)
+ tcltk::tkgrid.configure(text3, column=4, row=5, padx=20)
+ ilcampo <- tcltk::tclVar()
+ tcltk::tcl("image", "create", "photo", ilcampo, file=imagepath)
+ frame2 <- tcltk::tkframe(tt, width=300, height=300, relief='ridge')
+ tcltk::tkpack(frame2, side='bottom', padx=5)
+ imgAsLabel <- tcltk::tklabel(frame2, image=ilcampo)
+ tcltk::tkgrid.configure(imgAsLabel, pady=10)
+ tcltk::tkinsert(phase, 0, ' 1')
+ tcltk::tkgrab.set(tt)
+ tcltk::tcl('update')
+ tcltk::tkfocus(tt)
list(tt=tt, pb=progressbar, earlyEndPhase2=button2, current=text1,
quasi=text2, deviations=text3, phase=phase, subphase=subphase,
iteration=iteration, subphaselabel=subphaselabel,
@@ -99,6 +99,6 @@
}
-#tkconfigure(button2,state='normal')
+#tcltk::tkconfigure(button2,state='normal')
Modified: pkg/RSiena/R/sienaModelCreate.r
===================================================================
--- pkg/RSiena/R/sienaModelCreate.r 2020-09-12 19:26:11 UTC (rev 349)
+++ pkg/RSiena/R/sienaModelCreate.r 2020-09-16 14:04:33 UTC (rev 350)
@@ -25,13 +25,23 @@
lessMem=FALSE)
{
model <- NULL
- if (is.null(projname))
+ checking <- any(grepl("_R_CHECK", names(Sys.getenv())))
+ if (is.null(projname) | checking)
{
model$projname <- tempfile("Siena")
- cat('If you use this algorithm object, siena07 will create/use an output file',
+ if (checking)
+ {
+ cat('If you use this algorithm object, siena07 will create/use an output file',
+ paste('Siena','.txt',sep=''),'.\n')
+
+ }
+ else
+ {
+ cat('If you use this algorithm object, siena07 will create/use an output file',
paste(model$projname,'.txt',sep=''),'.\n')
cat('This is a temporary file for this R session.\n')
}
+ }
else
{
if (is.character(projname))
Added: pkg/RSiena/inst/doc/basicRSiena.R
===================================================================
--- pkg/RSiena/inst/doc/basicRSiena.R (rev 0)
+++ pkg/RSiena/inst/doc/basicRSiena.R 2020-09-16 14:04:33 UTC (rev 350)
@@ -0,0 +1,133 @@
+## ----setup, include = FALSE---------------------------------------------------
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+
+## -----------------------------------------------------------------------------
+getwd()
+
+## -----------------------------------------------------------------------------
+# setwd()
+
+## -----------------------------------------------------------------------------
+# setwd("C:\\Users\\tom.snijders\\Documents\\Siena\\s50_script")
+
+## -----------------------------------------------------------------------------
+# friend.data.w1 <- as.matrix(read.table("s50-network1.dat"))
+# friend.data.w2 <- as.matrix(read.table("s50-network2.dat"))
+# friend.data.w3 <- as.matrix(read.table("s50-network3.dat"))
+# drink <- as.matrix(read.table("s50-alcohol.dat"))
+# smoke <- as.matrix(read.table("s50-smoke.dat"))
+
+## -----------------------------------------------------------------------------
+library(RSiena)
+# Now we use the internally available s50 data set.
+# Look at its description:
+?s50
+# 3 waves, 50 actors
+# Look at the start and end of the first wave matrix
+head(s501)
+tail(s501)
+# and at the alcohol variable
+s50a
+# Now define the objects with the same names as above
+# (this step is superfluous if you read the data already).
+ friend.data.w1 <- s501
+ friend.data.w2 <- s502
+ friend.data.w3 <- s503
+ drink <- s50a
+ smoke <- s50s
+
+## -----------------------------------------------------------------------------
+?sienaDependent
+# First create a 50 * 50 * 3 array composed of the 3 adjacency matrices
+friendshipData <- array( c( friend.data.w1, friend.data.w2, friend.data.w3 ),
+ dim = c( 50, 50, 3 ) )
+# and next give this the role of the dependent variable:
+ friendship <- sienaDependent(friendshipData)
+
+## -----------------------------------------------------------------------------
+smoke1 <- coCovar( smoke[ , 1 ] )
+# A variable actor covariate is defined for drinking:
+alcohol <- varCovar( drink )
+# (This choice is purely for the purpose of illustration here.)
+
+## -----------------------------------------------------------------------------
+?sienaDataCreate
+mydata <- sienaDataCreate( friendship, smoke1, alcohol )
+# Check what we have
+mydata
+
+## -----------------------------------------------------------------------------
+print01Report( mydata, modelname="s50")
+# For the model specification we need to create the effects object
+myeff <- getEffects( mydata )
+# All the effects that are available given the structure
+# of this data set can be seen from
+effectsDocumentation(myeff)
+# For a precise description of all effects, see Chapter 12 in the RSiena manual.
+# A basic specification of the structural effects:
+?includeEffects
+myeff <- includeEffects( myeff, transTrip, cycle3)
+# and some covariate effects:
+myeff <- includeEffects( myeff, egoX, altX, simX, interaction1 = "alcohol" )
+myeff <- includeEffects( myeff, simX, interaction1 = "smoke1" )
+myeff
+
+## -----------------------------------------------------------------------------
+?sienaAlgorithmCreate
+myalgorithm <- sienaAlgorithmCreate( projname = 's50' )
+
+## -----------------------------------------------------------------------------
+?siena07
+ans <- siena07( myalgorithm, data = mydata, effects = myeff)
+ans
+
+## -----------------------------------------------------------------------------
+ans <- siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans)
+ans
+# If convergence is good, you can look at the estimates.
+# More extensive results
+summary(ans)
+
+## -----------------------------------------------------------------------------
+(myeff <- includeEffects( myeff, transRecTrip))
+(ans1 <- siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans))
+# If necessary, repeat the estimation with the new result:
+(ans1 <- siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans1))
+
+## -----------------------------------------------------------------------------
+# Once again, look at the help file
+?sienaDependent
+# now paying special attention to the <<type>> parameter.
+drinking <- sienaDependent( drink, type = "behavior" )
+
+## -----------------------------------------------------------------------------
+NBdata <- sienaDataCreate( friendship, smoke1, drinking )
+NBdata
+NBeff <- getEffects( NBdata )
+effectsDocumentation(NBeff)
+NBeff <- includeEffects( NBeff, transTrip, transRecTrip )
+NBeff <- includeEffects( NBeff, egoX, egoSqX, altX, altSqX, diffSqX,
+ interaction1 = "drinking" )
+NBeff <- includeEffects( NBeff, egoX, altX, simX, interaction1 = "smoke1" )
+NBeff
+# For including effects also for the dependent behaviour variable, see
+?includeEffects
+NBeff <- includeEffects( NBeff, avAlt, name="drinking",
+ interaction1 = "friendship" )
+NBeff
+# Define an algorithm with a new project name
+myalgorithm1 <- sienaAlgorithmCreate( projname = 's50_NB' )
+
+# Estimate again, using the second algorithm right from the start.
+NBans <- siena07( myalgorithm1, data = NBdata, effects = NBeff)
+# You may improve convergence (considering the overall maximum
+# convergence ratio) by repeated estimation in the same way as above.
+
+# Look at results
+NBans
+# Make a nicer listing of the results
+siena.table(NBans, type="html", sig=TRUE)
+
Property changes on: pkg/RSiena/inst/doc/basicRSiena.R
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: pkg/RSiena/inst/doc/basicRSiena.Rmd
===================================================================
--- pkg/RSiena/inst/doc/basicRSiena.Rmd (rev 0)
+++ pkg/RSiena/inst/doc/basicRSiena.Rmd 2020-09-16 14:04:33 UTC (rev 350)
@@ -0,0 +1,294 @@
+---
+title: "BasicRSiena"
+author: "Tom Snijders"
+date: "August 9, 2020"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{BasicRSiena}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r setup, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+```
+
+An example of a basic sequence of commands
+for estimating a basic model by function `siena07()` of `RSiena`.
+With a lot of use of help pages; this can be skipped as you like.
+Note that lines starting with # are comment lines, not commands.
+
+What is your current working directory?
+
+```{r}
+getwd()
+```
+
+If you wish it to be different, change it by
+
+```{r}
+# setwd()
+```
+
+In my case:
+
+```{r}
+# setwd("C:\\Users\\tom.snijders\\Documents\\Siena\\s50_script")
+```
+
+Note the double backslashes used for R.
+
+# Define data sets
+
+If you have internet access, you can download the data
+from the Siena website ("Data sets" tab)
+http://www.stats.ox.ac.uk/~snijders/siena/s50_data.zip
+and unzip it in your working directory.
+The data description is at
+http://www.stats.ox.ac.uk/~snijders/siena/s50_data.htm
+
+Then you can read the data files by the commands
+(this can be replaced by using the internal data set, see below)
+```{r}
+# friend.data.w1 <- as.matrix(read.table("s50-network1.dat"))
+# friend.data.w2 <- as.matrix(read.table("s50-network2.dat"))
+# friend.data.w3 <- as.matrix(read.table("s50-network3.dat"))
+# drink <- as.matrix(read.table("s50-alcohol.dat"))
+# smoke <- as.matrix(read.table("s50-smoke.dat"))
+```
+
+But without internet access, the data can be obtained
+from within RSiena (see below), because this is an internal data set.
+
+```{r}
+library(RSiena)
+# Now we use the internally available s50 data set.
+# Look at its description:
+?s50
+# 3 waves, 50 actors
+# Look at the start and end of the first wave matrix
+head(s501)
+tail(s501)
+# and at the alcohol variable
+s50a
+# Now define the objects with the same names as above
+# (this step is superfluous if you read the data already).
+ friend.data.w1 <- s501
+ friend.data.w2 <- s502
+ friend.data.w3 <- s503
+ drink <- s50a
+ smoke <- s50s
+```
+
+Now the data must be given the specific roles of variables
+in an RSiena analysis.
+
+# Dependent variable
+
+```{r}
+?sienaDependent
+# First create a 50 * 50 * 3 array composed of the 3 adjacency matrices
+friendshipData <- array( c( friend.data.w1, friend.data.w2, friend.data.w3 ),
+ dim = c( 50, 50, 3 ) )
+# and next give this the role of the dependent variable:
+ friendship <- sienaDependent(friendshipData)
+```
+
+What did we construct?
+```
+friendship
+```
+
+We also must prepare the objects that will be the explanatory variables.
+
+# Actor covariates
+
+We use smoking for wave 1 as a constant actor covariate:
+
+```{r}
+smoke1 <- coCovar( smoke[ , 1 ] )
+# A variable actor covariate is defined for drinking:
+alcohol <- varCovar( drink )
+# (This choice is purely for the purpose of illustration here.)
+```
+
+Put the variables together in the data set for analysis
+
+```{r}
+?sienaDataCreate
+mydata <- sienaDataCreate( friendship, smoke1, alcohol )
+# Check what we have
+mydata
+```
+
+You can get an outline of the data set with some basic descriptives from
+
+```{r}
+print01Report( mydata, modelname="s50")
+# For the model specification we need to create the effects object
+myeff <- getEffects( mydata )
+# All the effects that are available given the structure
+# of this data set can be seen from
+effectsDocumentation(myeff)
+# For a precise description of all effects, see Chapter 12 in the RSiena manual.
+# A basic specification of the structural effects:
+?includeEffects
+myeff <- includeEffects( myeff, transTrip, cycle3)
+# and some covariate effects:
+myeff <- includeEffects( myeff, egoX, altX, simX, interaction1 = "alcohol" )
+myeff <- includeEffects( myeff, simX, interaction1 = "smoke1" )
+myeff
+```
+
+Create object with algorithm settings
+Accept defaults but specify name for output file
+(which you may replace by any name you prefer)
+
+```{r}
+?sienaAlgorithmCreate
+myalgorithm <- sienaAlgorithmCreate( projname = 's50' )
+```
+
+# Estimate parameters
+
+```{r}
+?siena07
+ans <- siena07( myalgorithm, data = mydata, effects = myeff)
+ans
+```
+
+This gives results from a random starting point.
+To use a fixed starting point, use the "seed" parameter:
+```
+# myalgorithm <- sienaAlgorithmCreate( projname = 's50', seed=435123 )
+```
+
+For checking convergence, look at the
+'Overall maximum convergence ratio' mentioned under the parameter estimates.
+
+It can also be shown by requesting
+`r ans$tconv.max`
+
+If this is less than 0.25, convergence is good.
+If convergence is inadequate, estimate once more,
+using the result obtained as the "previous answer"
+from which estimation continues:
+
+```{r}
+ans <- siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans)
+ans
+# If convergence is good, you can look at the estimates.
+# More extensive results
+summary(ans)
+```
+
+Still more extensive results are given in the output file
+s50.out in the current directory.
+
+Note that by putting an R command between parentheses (....),
+the result will also be printed to the screen.
+Next add the transitive reciprocated triplets effect,
+an interaction between transitive triplets and reciprocity,
+
+```{r}
+(myeff <- includeEffects( myeff, transRecTrip))
+(ans1 <- siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans))
+# If necessary, repeat the estimation with the new result:
+(ans1 <- siena07( myalgorithm, data = mydata, effects = myeff, prevAns=ans1))
+```
+
+This might still not have an overall maximum convergence ratio
+less than 0.25. If not, you could go on once more.
+
+Inspect the file s50.txt in your working directory
+and understand the meaning of its contents.
+
+To have a joint test of the three effects of alcohol:
+
+```
+?Multipar.RSiena
+Multipar.RSiena(ans1, 7:9)
+```
+
+Focusing on alcohol similarity, the effect is significant;
+diluting the effects of alcohol by also considering ego and alter,
+the three effects simultaneously are not significant.
+
+# Assignment 1
+
+## 1a.
+
+Drop the effect of smoke1 similarity and estimate the model again.
+Do this by the function setEffects() using the <<include>> parameter.
+Give the changed effects object and the new answer object new names,
+such as effects1 and ans1, to distinguish them.
+
+## 1b.
+
+Change the three effects of alcohol to the single effect
+of alcohol similarity, and estimate again.
+
+# Networks and behavior study
+
+Now we redefine the role of alcohol drinking
+as a dependent behaviour variable.
+
+```{r}
+# Once again, look at the help file
+?sienaDependent
+# now paying special attention to the <<type>> parameter.
+drinking <- sienaDependent( drink, type = "behavior" )
+```
+
+Put the variables together in the data set for analysis
+
+```{r}
+NBdata <- sienaDataCreate( friendship, smoke1, drinking )
+NBdata
+NBeff <- getEffects( NBdata )
+effectsDocumentation(NBeff)
+NBeff <- includeEffects( NBeff, transTrip, transRecTrip )
+NBeff <- includeEffects( NBeff, egoX, egoSqX, altX, altSqX, diffSqX,
+ interaction1 = "drinking" )
+NBeff <- includeEffects( NBeff, egoX, altX, simX, interaction1 = "smoke1" )
+NBeff
+# For including effects also for the dependent behaviour variable, see
+?includeEffects
+NBeff <- includeEffects( NBeff, avAlt, name="drinking",
+ interaction1 = "friendship" )
+NBeff
+# Define an algorithm with a new project name
+myalgorithm1 <- sienaAlgorithmCreate( projname = 's50_NB' )
+
+# Estimate again, using the second algorithm right from the start.
+NBans <- siena07( myalgorithm1, data = NBdata, effects = NBeff)
+# You may improve convergence (considering the overall maximum
+# convergence ratio) by repeated estimation in the same way as above.
+
+# Look at results
+NBans
+# Make a nicer listing of the results
+siena.table(NBans, type="html", sig=TRUE)
+```
+
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rsiena -r 350
More information about the Rsiena-commits
mailing list