[r-cran-mcmcpack] 65/90: Imported Upstream version 1.2-3

Andreas Tille tille at debian.org
Fri Dec 16 09:07:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-mcmcpack.

commit bba73acb5b6ba488fe9bfbb69981347f84e2f215
Author: Andreas Tille <tille at debian.org>
Date:   Fri Dec 16 08:07:22 2016 +0100

    Imported Upstream version 1.2-3
---
 DESCRIPTION                  |   8 ++++----
 HISTORY                      |   7 +++++++
 MD5                          |  22 ++++++++++++----------
 R/MCMCbinaryChange.R         |   0
 R/btsutil.R                  |  26 --------------------------
 R/hidden.R                   |   4 ++--
 R/make.breaklist.R           |  26 ++++++++++++++++++++++++++
 R/testpanelSubjectBreak.R    |  11 +++--------
 confdefs.h                   |  16 ++++++++++++++++
 data/PErisk.rda              | Bin 1966 -> 1967 bytes
 data/SupremeCourt.rda        | Bin 470 -> 470 bytes
 man/HMMpanelFE.Rd            |   6 +++---
 man/testpanelSubjectBreak.Rd |  14 +++++---------
 src/MCMCpoissonChange.cc     |   8 +++++++-
 14 files changed, 85 insertions(+), 63 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 1dc4999..8daa241 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: MCMCpack
-Version: 1.2-2
-Date: 2012-3-2
+Version: 1.2-3
+Date: 2012-4-16
 Title: Markov chain Monte Carlo (MCMC) Package
 Author: Andrew D. Martin, Kevin M. Quinn, and Jong Hee Park
 Maintainer: Jong Hee Park <jhp at uchicago.edu>
@@ -18,6 +18,6 @@ Description: This package contains functions to perform Bayesian
 License: GPL-3
 SystemRequirements: gcc (>= 4.0)
 URL: http://mcmcpack.wustl.edu
-Packaged: 2012-03-02 21:27:17 UTC; adm
+Packaged: 2012-04-16 03:27:11 UTC; jongheepark
 Repository: CRAN
-Date/Publication: 2012-03-03 06:49:19
+Date/Publication: 2012-04-16 06:09:44
diff --git a/HISTORY b/HISTORY
index 795db05..95948b2 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,13 @@
 //
 // Changes and Bug Fixes
 //
+
+1.2-2 to 1.2-3
+  * fixed extraneous warnings in hidden.R (thanks to Jeffrey Arnold)
+  * added make.breaklist.R
+  * fixed example codes in HMMpanelFE.Rd and testpanelSubjectBreak.Rd
+  * fixed testpanelSubjectBreak() to handle missing values in subject.id
+
 1.2-1 to 1.2-2
   * fixed bug in dwish() (thanks to Taráz E. Buck)
   * fixed .onAttach() to no longer require packages and use packageStartupMessage()
diff --git a/MD5 b/MD5
index 130294a..e263329 100644
--- a/MD5
+++ b/MD5
@@ -1,5 +1,5 @@
-dd3a6642c422701839fb4c4b6fc003dc *DESCRIPTION
-ed15423ad364f55ae6092d7ab7db5683 *HISTORY
+a922886738229c9f9430e5da5a1d9273 *DESCRIPTION
+fae7df2629b8b9da9d1a7fb07deefa5a *HISTORY
 45b74f9b9cce80e9215266776a1be85c *LICENSE
 4851e0ecf23d44b58fcd53e597210689 *NAMESPACE
 1eaf24e8d468ac0b624a9aa90cded306 *R/BayesFactors.R
@@ -40,29 +40,31 @@ e27dcf535f23c25018bb778b61640f22 *R/MCMCquantreg.R
 3a98b4d919a265b46c29d14310bb90d4 *R/SSVSquantreg.R
 555c87acdcc2f8572b14151e29022e20 *R/SSVSquantregsummary.R
 fdfcfe9909cadaf15c47bbb604be2257 *R/automate.R
-9eb132545aaf170132109e198464b69d *R/btsutil.R
+ad65af39e4dc71e5a2facf7d5ad62317 *R/btsutil.R
 56829ce5340d26f9488b8b9894ff5cd0 *R/distn.R
 18daa9fee800c7d8d5827405738531e2 *R/hidden-hmodels.R
-0f904468b8ce8fc5c3869f87d11da905 *R/hidden.R
+4dc19c1cb7809d9be5e7353929358aa1 *R/hidden.R
+317675992da250e591e78cc96b10581b *R/make.breaklist.R
 f799711e5d3fb7140cbc0995360339b3 *R/procrust.R
 2e00b2b1593d22b5d1c579e92b294106 *R/scythe.R
 4de1106e38b8ca3b12396ec0d84bba4c *R/testpanelGroupBreak.R
-cb8aeff19ebf8c85748bad1a57484e7a *R/testpanelSubjectBreak.R
+0907ed9bbd42212d50c6208dce57d640 *R/testpanelSubjectBreak.R
 c67ac5238de55cdc8c49d017e0226ed9 *R/tomog.R
 6377da3453982f578df4a886f673122c *R/utility.R
 7e2021def8a88edb41fe78d0a0ae642c *R/zzz.R
 e42f762c27e26e0ace372c03c47ac4e5 *README
 46e955baeb55718a380a11fb34d2ea67 *cleanup
+a315f6c986020fa2b8a8190a77bd0015 *confdefs.h
 e09d1c5ac6250f832af90566a9e565fb *configure
 21e1a006fb388ed39daf16e6d2ec9549 *configure.ac
 e17202d22ce5ab5ab7b01e3b248a4008 *data/Nethvote.rda
-d03a27617f7933fbbb47732af740b129 *data/PErisk.rda
+9926c591df7085545233c2cf11b6b56f *data/PErisk.rda
 93e636ac58b966f9a74315f51be07d25 *data/Rehnquist.rda
 accb7b5b46207a02e49de2702a6faff4 *data/Senate.rda
-2b95cdf5122fe0f86191ba668da542dc *data/SupremeCourt.rda
+f740448e1b0cff40e7c05a354ea69e59 *data/SupremeCourt.rda
 a5cfcf73e21c03eeaf4f3baa5c492c14 *inst/CITATION
 2b42855343b5f0c51c7e9411aef57509 *man/BayesFactor.Rd
-872365fa451a1717a950a8102453eb8e *man/HMMpanelFE.Rd
+c3e38d2c8a1adee2ff096056416ca6ec *man/HMMpanelFE.Rd
 2e322e903df0d9c20513670710537995 *man/HMMpanelRE.Rd
 293ff17f852d0e60dd1aac1f419353d2 *man/MCMCSVDreg.Rd
 9af751257fcacc3a57543e4ae6a5e6cc *man/MCMCbinaryChange.Rd
@@ -119,7 +121,7 @@ c64abc923f2c6f56a167a815c881ffb1 *man/plotState.Rd
 6a88d877e88b5abfd7a66d659c9b4e6a *man/procrust.Rd
 41feb17dda3b00cffa2f6176ba584b74 *man/readscythe.Rd
 f151473ede68e2cff21c06afd3060373 *man/testpanelGroupBreak.Rd
-8a3c03825fcdcdf22359faa43b330574 *man/testpanelSubjectBreak.Rd
+24a4ef81a3573532c757c0c1dad393eb *man/testpanelSubjectBreak.Rd
 254168bb5258fd00a7b766fb7d3bbfd9 *man/tomog.Rd
 f5ba8eb700c67f188505a4585dd39f6b *man/topmodels.Rd
 a4c560360ba912bb342a429e434bcc96 *man/vech.Rd
@@ -156,7 +158,7 @@ a78375184abf7c97bf7fbf3f7614cad3 *src/MCMCoprobit.cc
 387f517e5df0bde2b483c8986ce10983 *src/MCMCoprobitChange.cc
 6addbe81efb51cb4b8401e9a6931f782 *src/MCMCordfactanal.cc
 6bfed80bb7c109537461e6381837b6c4 *src/MCMCpoisson.cc
-628013b775615c38951a2d931e1c1fe4 *src/MCMCpoissonChange.cc
+73fb68d449004927f02a4bbf764258f6 *src/MCMCpoissonChange.cc
 84b94f6e67b026a915a23fb85bdaf00b *src/MCMCprobit.cc
 8a2f4a79c6bc951310074f5757041424 *src/MCMCprobitChange.cc
 a6a01c3906a8b92b9f1a12cfa92a1a63 *src/MCMCprobitres.cc
diff --git a/R/MCMCbinaryChange.R b/R/MCMCbinaryChange.R
old mode 100644
new mode 100755
diff --git a/R/btsutil.R b/R/btsutil.R
index 872857a..03bd069 100644
--- a/R/btsutil.R
+++ b/R/btsutil.R
@@ -249,29 +249,3 @@
 
 
 
-## find the most reasonable model
-## by choosing a model with a larger break number
-## If the difference of natural log marginal likelihood is smaller than the threshold,
-## choose the model with a smaller break number
-## to avoid the over-identification problem
-"make.breaklist" <- function(BF, threshold=3){
-  eBF <- exp(BF)
-  N <- nrow(BF)
-  out <- rep(NA, N)
-  for (i in 1:N){
-    order.i <- order(eBF[i,], decreasing=TRUE)
-    if(eBF[i, order.i[1]] / eBF[i, order.i[2]] > threshold){
-      out[i] <- order.i[1]
-    }
-    else if (eBF[i, order.i[1]] / eBF[i, order.i[2]] < threshold & order.i[1]<=order.i[2]){
-      out[i] <- order.i[1]
-    }
-    else if (eBF[i, order.i[1]] / eBF[i, order.i[2]] < threshold & order.i[1]>order.i[2]){
-      out[i] <- order.i[2]
-    }
-    else{
-      cat("\n Error occurs at i = ", i)
-    }
-  }
-  return(out-1)
-}
diff --git a/R/hidden.R b/R/hidden.R
index 118d134..53d8efc 100644
--- a/R/hidden.R
+++ b/R/hidden.R
@@ -230,7 +230,7 @@
            Lambda.ineq.constraints){
 
     Lambda <- matrix(0, K, factors)
-    if (is.na(lambda.start)){# sets Lambda to equality constraints & 0s
+    if (any(is.na(lambda.start))){# sets Lambda to equality constraints & 0s
       for (i in 1:K){
         for (j in 1:factors){
           if (Lambda.eq.constraints[i,j]==-999){
@@ -413,7 +413,7 @@
   function(psi.start, X){
     
     K <- ncol(X)
-    if (is.na(psi.start)){
+    if (any(is.na(psi.start))){
       Psi <- 0.5 * diag(diag(var(X)))
     }
     else if (is.double(psi.start) &&
diff --git a/R/make.breaklist.R b/R/make.breaklist.R
new file mode 100644
index 0000000..6ccd62a
--- /dev/null
+++ b/R/make.breaklist.R
@@ -0,0 +1,26 @@
+"make.breaklist" <- function(BF, threshold=3){
+  eBF <- exp(BF)
+  N <- nrow(BF)
+  out <- rep(NA, N)
+  for (i in 1:N){
+    order.i <- order(eBF[i,], decreasing=TRUE)
+    if(sum(is.na(eBF[i,]))>0){
+      out[i] <- 1
+    }
+    else{
+      if(eBF[i, order.i[1]] / eBF[i, order.i[2]] > threshold){
+        out[i] <- order.i[1]
+      }
+      else if (eBF[i, order.i[1]] / eBF[i, order.i[2]] < threshold & order.i[1]<=order.i[2]){
+        out[i] <- order.i[1]
+      }
+      else if (eBF[i, order.i[1]] / eBF[i, order.i[2]] < threshold & order.i[1]>order.i[2]){
+        out[i] <- order.i[2]
+      }
+      else{
+        cat("\n Error occurs at i = ", i)
+      }
+    }
+  }
+  return(out-1)
+}
diff --git a/R/testpanelSubjectBreak.R b/R/testpanelSubjectBreak.R
index 7128cf4..7e4766c 100644
--- a/R/testpanelSubjectBreak.R
+++ b/R/testpanelSubjectBreak.R
@@ -3,13 +3,14 @@
 ## 
 ## written by Jong Hee Park 03/2009
 ## modified and integrated with other codes by JHP 07/2011
+## fixed a starting.id and ending.id
 ######################################################################
 
 "testpanelSubjectBreak" <-
   function(subject.id, time.id, resid, max.break=2, minimum = 10, 
            mcmc=1000, burnin=1000, thin=1, verbose=0, 
            b0, B0, c0, d0, a = NULL, b = NULL, seed = NA, 
-           Time = NULL, start.id = NULL, end.id = NULL, ps.out = FALSE){   
+           Time = NULL, ps.out = FALSE){   
     ## seeds
     seeds <- form.seeds(seed) 
     lecuyer <- seeds[[1]]
@@ -30,12 +31,6 @@
     if (is.null(Time)){
       Time <- rep(N, 1)
     }
-    if (is.null(start.id)){
-      start.id <- min(subject.id)
-    }
-    if (is.null(end.id)){
-      end.id <- max(subject.id)
-    }
     NC <- length(unique(subject.id))
     time.list <- as.numeric(table(subject.id))
     
@@ -55,7 +50,7 @@
     else {
       psout <- array(NA, c(max(time.list), sum(2:(max.break+1)), NC))
     }
-    for (i in start.id:end.id){     
+    for (i in 1:NC){     
       residual <- resid.list[[i]]
       nk <- length(residual)
       out <- as.list(rep(NA, max.break))
diff --git a/confdefs.h b/confdefs.h
new file mode 100644
index 0000000..9e17b72
--- /dev/null
+++ b/confdefs.h
@@ -0,0 +1,16 @@
+#define PACKAGE_NAME ""
+#define PACKAGE_TARNAME ""
+#define PACKAGE_VERSION ""
+#define PACKAGE_STRING ""
+#define PACKAGE_BUGREPORT ""
+#define STDC_HEADERS 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_TRUNC 1
diff --git a/data/PErisk.rda b/data/PErisk.rda
index aaf01b7..cb0f7de 100644
Binary files a/data/PErisk.rda and b/data/PErisk.rda differ
diff --git a/data/SupremeCourt.rda b/data/SupremeCourt.rda
index 9ffadab..31d84ca 100644
Binary files a/data/SupremeCourt.rda and b/data/SupremeCourt.rda differ
diff --git a/man/HMMpanelFE.Rd b/man/HMMpanelFE.Rd
index c7e4b3a..8c6913a 100644
--- a/man/HMMpanelFE.Rd
+++ b/man/HMMpanelFE.Rd
@@ -162,10 +162,10 @@
   ## draw time-varying individual effects and sample y
   j = 1
   true.sigma.alpha <- 30	   
-  true.alpha <- true.alpha1 <- true.alpha2 <- rep(NA, N) 
+  true.alpha1 <- true.alpha2 <- rep(NA, N) 
   for (i in 1:N){
     Xi <- X[j:(j+T-1), ]
-    true.mean <- Xi%*%true.beta
+    true.mean <- Xi  \%*\% true.beta
     weight <- Weight[j:(j+T-1)]
     true.alpha1[i] <- rnorm(1, 0, true.sigma.alpha)
     true.alpha2[i] <- -1*true.alpha1[i]
@@ -187,7 +187,7 @@
          b0=0, B0=1/100, c0=2, d0=2, Time = time.id)
 
   ## get the estimated break numbers
-  estimated.breaks <- make.breaklist(BF, thresh=3)
+  estimated.breaks <- make.breaklist(BF, threshold=3)
 
   ## model fitting 
   out <- HMMpanelFE(subject.id = id, y, X=X, m =  estimated.breaks,
diff --git a/man/testpanelSubjectBreak.Rd b/man/testpanelSubjectBreak.Rd
index 1365fd0..98cb96e 100644
--- a/man/testpanelSubjectBreak.Rd
+++ b/man/testpanelSubjectBreak.Rd
@@ -10,7 +10,7 @@
 \usage{testpanelSubjectBreak(subject.id, time.id, resid, max.break=2, 
            minimum = 10, mcmc=1000, burnin=1000, thin=1, verbose=0, 
            b0, B0, c0, d0, a = NULL, b = NULL, seed = NA, 
-           Time = NULL, start.id = NULL, end.id = NULL, ps.out = FALSE)}  
+           Time = NULL, ps.out = FALSE)}  
 
 \arguments{
   \item{subject.id}{A numeric vector indicating the group number. It should start from 1.}
@@ -57,11 +57,6 @@
 
     \item{Time}{Times of the observations. This will be used to find the time of the first observations in panel residuals. }
 
-    \item{start.id}{If users want to check the residual breaks within a subset of panel subjects, users can specify the starting subject id and 
-    the ending subject id.}
-
-    \item{end.id}{See start.id.}
-
     \item{ps.out}{If ps.out == TRUE, state probabilities are exported. If the number of panel subjects is huge, users can turn it off to save memory.}
 	
    \item{...}{further arguments to be passed}       
@@ -145,10 +140,10 @@
   ## draw time-varying individual effects and sample y
   j = 1
   true.sigma.alpha <- 30	   
-  true.alpha <- true.alpha1 <- true.alpha2 <- rep(NA, N) 
+  true.alpha1 <- true.alpha2 <- rep(NA, N) 
   for (i in 1:N){
     Xi <- X[j:(j+T-1), ]
-    true.mean <- Xi%*%true.beta
+    true.mean <- Xi  \%*\% true.beta
     weight <- Weight[j:(j+T-1)]
     true.alpha1[i] <- rnorm(1, 0, true.sigma.alpha)
     true.alpha2[i] <- -1*true.alpha1[i]
@@ -170,7 +165,8 @@
          b0=0, B0=1/100, c0=2, d0=2, Time = time.id)
 
   ## estimated break numbers
-  estimated.breaks <- make.breaklist(BF, thresh=3)
+  ## thresho 
+  estimated.breaks <- make.breaklist(BF, threshold=3)
   
   ## print all posterior model probabilities	 
   print(attr(BF, "model.prob")) 
diff --git a/src/MCMCpoissonChange.cc b/src/MCMCpoissonChange.cc
index 791d891..795bfd8 100644
--- a/src/MCMCpoissonChange.cc
+++ b/src/MCMCpoissonChange.cc
@@ -7,6 +7,7 @@
 //
 // 07/06/2007
 // 12/20/2007 included in MCMCpack
+// 03/09/2012 fixed a bug in a random uniform draw (thanks to Matt Blackwell)
 
 #ifndef MCMCPOISSONCHANGE_CC
 #define MCMCPOISSONCHANGE_CC
@@ -85,7 +86,12 @@ Matrix<> tau_comp_sampler(rng<RNGTYPE>& stream,
     }
     
     else {
-      Matrix<> ut = stream.runif(yt, 1);                       
+      Matrix<> ut = stream.runif(yt, 1);    
+      // redraw the uniform if there are any repeats
+      // thanks to Matt Blackwell 
+      while (::unique(ut).size() != ut.size()) {
+	ut = stream.runif(yt, 1);
+      }                   
       Matrix<> sort_ut = ::sort(ut);
       Matrix<> tau_tj(yt, 1);
       for(int i=1; i<yt; ++i){

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-mcmcpack.git



More information about the debian-science-commits mailing list