From noreply at r-forge.r-project.org Tue Jul 13 16:53:29 2021 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 13 Jul 2021 16:53:29 +0200 (CEST) Subject: [Rsiena-commits] r354 - in pkg/RSienaTest: . R man Message-ID: <20210713145329.6828A180836@r-forge.r-project.org> Author: tomsnijders Date: 2021-07-13 16:53:29 +0200 (Tue, 13 Jul 2021) New Revision: 354 Modified: pkg/RSienaTest/ChangeLog pkg/RSienaTest/DESCRIPTION pkg/RSienaTest/R/sienaBayes.r pkg/RSienaTest/man/RSiena-package.Rd pkg/RSienaTest/man/extract.sienaBayes.Rd Log: RSienaTest new version Modified: pkg/RSienaTest/ChangeLog =================================================================== --- pkg/RSienaTest/ChangeLog 2021-04-14 15:46:25 UTC (rev 353) +++ pkg/RSienaTest/ChangeLog 2021-07-13 14:53:29 UTC (rev 354) @@ -1,3 +1,8 @@ +2021-07-13 R-Forge Revision 354, package version 1.2-30. +Changes in RSienaTest: + * sienaBayes: adaptation of nwarm and nmain + at the end of initializeBayes dropped. + 2021-04-14 R-Forge Revision 353, package version 1.2-29. Changes in RSienaTest: * sienaBayes: break out of prewarming if in 2 consecutive steps Modified: pkg/RSienaTest/DESCRIPTION =================================================================== --- pkg/RSienaTest/DESCRIPTION 2021-04-14 15:46:25 UTC (rev 353) +++ pkg/RSienaTest/DESCRIPTION 2021-07-13 14:53:29 UTC (rev 354) @@ -2,8 +2,8 @@ Package: RSienaTest Type: Package Title: Siena - Simulation Investigation for Empirical Network Analysis -Version: 1.2-29 -Date: 2021-04-14 +Version: 1.2-30 +Date: 2021-07-13 Authors at R: c(person("Tom", "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")), Modified: pkg/RSienaTest/R/sienaBayes.r =================================================================== --- pkg/RSienaTest/R/sienaBayes.r 2021-04-14 15:46:25 UTC (rev 353) +++ pkg/RSienaTest/R/sienaBayes.r 2021-07-13 14:53:29 UTC (rev 354) @@ -160,9 +160,9 @@ } else { - desired <- c(rep(trunc(target[1]*totruns), z$nGroup), + desired <- c(rep(trunc(target[1]*totruns), z$nGroup), rep(trunc(target[2]*totruns), 2)) - } + } iter <- 0 nearGoal <- rep(FALSE, z$nGroup+2) farFromGoal <- rep(TRUE, z$nGroup+2) @@ -782,7 +782,7 @@ } ##@averageTheta internal sienaBayes; algorithm to average past theta values - averageTheta <- function() + averageTheta <- function(z) { thetaMean <- rep(NA, z$pp) for (group in 1:z$nGroup) @@ -791,7 +791,7 @@ z$ThinParameters[, group, !z$generalParametersInGroup, drop=FALSE], na.rm=TRUE) } - if ((priorRatesFromData <0) | incidentalBasicRates) + if ((z$priorRatesFromData <0) | z$incidentalBasicRates) { # then (z$set1)&(!z$basicRate) == (z$set1); just for clarity we write: thetaMean[(z$set1)&(!z$basicRate)] <- colMeans( @@ -826,7 +826,7 @@ } else { - z$theta <<- averageTheta() + z$theta <<- averageTheta(z) } save(z,file="PartialBayesResult.RData") z$theta <<- saveTheta @@ -1259,7 +1259,7 @@ scf <- (2.38^2)/z$TruNumPars # theoretically optimal value according to Roberts & Rosenthal, 2001 # Also see page 99 (in chapter by Rosenthal) of the Chapman & Hall -# Handbook of Markov Chain Monte Carlo, 2011. +# Handbook of Markov Chain Monte Carlo, 2011. # Until RSienaTest version 1.2-25, the scale factors were initialized # at 2.38/sqrt(z$TruNumPars); but this should be (2.38^2)/z$TruNumPars, # because they are applied to the variance. @@ -1453,7 +1453,7 @@ } else { - z$theta <- averageTheta() + z$theta <- averageTheta(z) } z$frequentist <- frequentist z$FRAN <- NULL @@ -1975,7 +1975,7 @@ startupPrec <- prec[objective, objective] priorPrec <- matrix(0, sum(objective), sum(objective)) diag(priorPrec) <- 0.01 # a prior variance of 100 if nothing else is said -# In the following line, up to version 1.2-25, the ginv was missing!!! +# In the following line, up to version 1.2-25, the ginv was missing!!! priorPrec[randomInObjective, randomInObjective] <- ginv(z$priorSigma[objectiveInRandom, objectiveInRandom]) for (i in seq(along=z$set2prior)) @@ -2215,7 +2215,7 @@ z$TruNumPars <- sum(!z$basicRate ) } scf <- (2.38^2)/z$TruNumPars -# theoretically optimal value according to Roberts & Rosenthal, 2001; +# theoretically optimal value according to Roberts & Rosenthal, 2001; # also see earlier occurrence of 2.38. z$scaleFactors <- rep(scf, z$nGroup) if (z$p2 > 0) @@ -2369,28 +2369,29 @@ lengthPhase1 <- round(nmain/5) lengthPhase3 <- round(nmain/5) } - if ((nwarm + lengthPhase1 + 5 + lengthPhase3) > nmain) - { - nwarm <- max(5, - round(nwarm*nmain/(nwarm + 2*lengthPhase1+lengthPhase3))) - oldLengthPhase1 <- lengthPhase1 - lengthPhase1 <- max(5, - round(lengthPhase1*nmain/(nwarm + 2*lengthPhase1+lengthPhase3))) - lengthPhase3 <- max(5, - round(lengthPhase3*nmain/(nwarm + 2*oldLengthPhase1+lengthPhase3))) - nmain <<- nwarm + 2*lengthPhase1 + lengthPhase3 - cat("Iteration numbers adapted:\n") - cat("nwarm = ", nwarm, "; nmain = ", nmain) - if (frequentist) - { - cat(", lengthPhase1 = ", lengthPhase1, - "; lengthPhase3 = ", lengthPhase3, ".\n") - } - else - { - cat(".\n") - } - } +# adaptation of nwarn and nmain skipped version +# if ((nwarm + lengthPhase1 + 5 + lengthPhase3) > nmain) +# { +# nwarm <- max(5, +# round(nwarm*nmain/(nwarm + 2*lengthPhase1+lengthPhase3))) +# oldLengthPhase1 <- lengthPhase1 +# lengthPhase1 <- max(5, +# round(lengthPhase1*nmain/(nwarm + 2*lengthPhase1+lengthPhase3))) +# lengthPhase3 <- max(5, +# round(lengthPhase3*nmain/(nwarm + 2*oldLengthPhase1+lengthPhase3))) +# nmain <<- nwarm + 2*lengthPhase1 + lengthPhase3 +# cat("Iteration numbers adapted:\n") +# cat("nwarm = ", nwarm, "; nmain = ", nmain) +# if (frequentist) +# { +# cat(", lengthPhase1 = ", lengthPhase1, +# "; lengthPhase3 = ", lengthPhase3, ".\n") +# } +# else +# { +# cat(".\n") +# } +# } z$nwarm <- nwarm z$nprewarm <- nprewarm z$nmain <- nmain Modified: pkg/RSienaTest/man/RSiena-package.Rd =================================================================== --- pkg/RSienaTest/man/RSiena-package.Rd 2021-04-14 15:46:25 UTC (rev 353) +++ pkg/RSienaTest/man/RSiena-package.Rd 2021-07-13 14:53:29 UTC (rev 354) @@ -14,10 +14,11 @@ and multivariate networks are allowed. The models are stochastic actor-oriented models. -Package \code{"RSienaTest"} is the development version, and -is distributed through R-Forge, see +Package \code{"RSienaTest"} has the extra functionality of function +\code{\link{sienaBayes}}, and is distributed through R-Forge, see \url{http://r-forge.r-project.org/R/?group_id=461}. Package \code{"RSiena"} is the official release. +The } \details{ The main flow of operations of this package is as follows. @@ -49,8 +50,8 @@ \tabular{ll}{ Package: \tab RSienaTest\cr Type: \tab Package\cr - Version: \tab 1.2-29\cr - Date: \tab 2021-04-14\cr + Version: \tab 1.2-30\cr + Date: \tab 2021-07-13\cr Depends: \tab R (>= 2.15.0)\cr Imports: \tab Matrix, lattice, parallel, MASS, methods\cr Suggests: \tab xtable, network, tools, codetools, utils, tcltk\cr Modified: pkg/RSienaTest/man/extract.sienaBayes.Rd =================================================================== --- pkg/RSienaTest/man/extract.sienaBayes.Rd 2021-04-14 15:46:25 UTC (rev 353) +++ pkg/RSienaTest/man/extract.sienaBayes.Rd 2021-07-13 14:53:29 UTC (rev 354) @@ -44,7 +44,7 @@ \item{excludeRates}{Logical: whether to exclude the rate parameters.} \item{verbose}{Logical: gives some console output to show ongoing activity (may be reassuring for large number of groups).} -} +} \details{ \code{extract.sienaBayes} produces a 3-dimensional array, iterations by chains by parameters, suitable for use, e.g., in function \code{monitor()} @@ -55,7 +55,7 @@ \code{nSampRate}.\cr The number of iterations should be the same for all chains.\cr It is not checked that the specifications of the chains are identical. - For the parameter names, the names in the first chain are used. + For the parameter names, the shortNames in the first chain are used. \code{extract.posteriorMeans} produces the posterior means of the groupwise varying parameters. The resulting matrix has the groups @@ -68,7 +68,10 @@ For \code{extract.posteriorMeans} a matrix with the groups in the rows and all effects in the columns, with for each effect two columns: first the posterior mean (effect name preceded by "p.m.") and then the - posterior standard deviation (effect name preceded by "psd."). + posterior standard deviation (effect name preceded by "psd.").\cr + If some names are duplicated (e.g., because of the presence of + evaluation and creation effects), these can be changed by the user + after creation of the array. } \references{See the manual and \url{http://www.stats.ox.ac.uk/~snijders/siena/} }