[r-cran-mcmcpack] 40/90: Imported Upstream version 1.0-4

Andreas Tille tille at debian.org
Fri Dec 16 09:07:38 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 012836f78f227c1a4f35bab6d61f3cc0bf109912
Author: Andreas Tille <tille at debian.org>
Date:   Fri Dec 16 08:07:15 2016 +0100

    Imported Upstream version 1.0-4
---
 DESCRIPTION            |  8 ++++----
 HISTORY                |  5 ++++-
 R/MCMCbinaryChange.R   |  0
 R/MCMCquantreg.R       | 12 ++++++------
 man/MCMCfactanal.Rd    |  2 +-
 man/MCMClogit.Rd       |  3 +--
 man/MCMCmixfactanal.Rd |  2 +-
 man/MCMCordfactanal.Rd |  2 +-
 man/MCMCpoisson.Rd     |  2 +-
 man/MCMCprobit.Rd      |  2 +-
 man/MCMCquantreg.Rd    | 26 +++++++++++++-------------
 src/MCMCfcds.h         | 21 ++++++++-------------
 src/MCMCquantreg.cc    | 10 +++++-----
 13 files changed, 46 insertions(+), 49 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 88533af..63c905f 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: MCMCpack
-Version: 1.0-3
-Date: 2009-7-27
+Version: 1.0-4
+Date: 2009-09-07
 Title: Markov chain Monte Carlo (MCMC) Package
 Author: Andrew D. Martin <admartin at wustl.edu>, Kevin M. Quinn
         <kevin_quinn at harvard.edu>, Jong Hee Park <jhp at uchicago.edu>
@@ -19,6 +19,6 @@ Description: This package contains functions to perform Bayesian
 License: GPL-2
 SystemRequirements: gcc (>= 4.0)
 URL: http://mcmcpack.wustl.edu
-Packaged: 2009-07-28 17:41:00 UTC; adm
+Packaged: 2009-09-08 00:08:21 UTC; adm
 Repository: CRAN
-Date/Publication: 2009-07-30 12:51:08
+Date/Publication: 2009-09-08 05:04:49
diff --git a/HISTORY b/HISTORY
index 984aa75..ceedbee 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,8 +2,11 @@
 // Changes and Bug Fixes
 //
 
+1.0-3 to 1.0-4
+  * little change to parameterization of BQR [contributed by Craig Reed]
+
 1.0-2 to 1.0-3
-  * Mix fix to hierarchical IRT documentation [written by Mike Malecki]
+  * fix to hierarchical IRT documentation [written by Mike Malecki]
   * added Bayesian quantile regression [contributed by Craig Reed]
 
 1.0-1 to 1.0-2
diff --git a/R/MCMCbinaryChange.R b/R/MCMCbinaryChange.R
old mode 100644
new mode 100755
diff --git a/R/MCMCquantreg.R b/R/MCMCquantreg.R
index 865af80..c6f1d66 100644
--- a/R/MCMCquantreg.R
+++ b/R/MCMCquantreg.R
@@ -1,5 +1,5 @@
 "MCMCquantreg" <-
-  function(formula, p=0.5, data=NULL, burnin = 1000, mcmc = 10000,
+  function(formula, tau=0.5, data=NULL, burnin = 1000, mcmc = 10000,
            thin=1, verbose = 0, seed = NA, beta.start = NA,
            b0 = 0, B0 = 0, c0 = 0.001, d0 = 0.001,
            ...) {
@@ -9,8 +9,8 @@
     check.mcmc.parameters(burnin, mcmc, thin)
 
     cl <- match.call()
-    if (p<=0 || p>=1){
-	stop("p must be in (0,1).\n Please respecify and call again.\n")
+    if (tau<=0 || tau>=1){
+	stop("tau must be in (0,1).\n Please respecify and call again.\n")
 	}
     
     ## seeds
@@ -29,7 +29,7 @@
     ## starting values and priors
     ols.fit <- lm(formula)
     defaults <- matrix(coef(ols.fit),K,1)
-    defaults[1] <- defaults[1]+summary(ols.fit)$sigma*qnorm(p)
+    defaults[1] <- defaults[1]+summary(ols.fit)$sigma*qnorm(tau)
     beta.start <- coef.start(beta.start, K, formula, family=gaussian, data, defaults=defaults)
     mvn.prior <- form.mvn.prior(b0, B0, K)
     b0 <- mvn.prior[[1]]
@@ -48,7 +48,7 @@
     sample <- matrix(data=0, mcmc/thin, K+1)
     posterior <- NULL 
     
-    if (p==0.5) {
+    if (tau==0.5) {
      ## call C++/Scythe function "MCMCmedreg" to draw samples
     auto.Scythe.call(output.object="posterior", cc.fun.name="MCMCmedreg", 
                      sample.nonconst=sample, Y=Y, X=X,                      burnin=as.integer(burnin),
@@ -64,7 +64,7 @@
 
     ## call C++/Scythe function "MCMCquantreg" to draw samples
     auto.Scythe.call(output.object="posterior", cc.fun.name="MCMCquantreg", 
-                     sample.nonconst=sample, p=as.double(p), Y=Y, X=X, 
+                     sample.nonconst=sample, tau=as.double(tau), Y=Y, X=X, 
                      burnin=as.integer(burnin),
                      mcmc=as.integer(mcmc), thin=as.integer(thin),
                      lecuyer=as.integer(lecuyer), 
diff --git a/man/MCMCfactanal.Rd b/man/MCMCfactanal.Rd
index 6b41536..967ad91 100644
--- a/man/MCMCfactanal.Rd
+++ b/man/MCMCfactanal.Rd
@@ -197,5 +197,5 @@ MCMCfactanal(x, factors, lambda.constraints=list(),
 
 \keyword{models}
 
-\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}},\code{\link[mva]{factanal}}}
+\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}},\code{\link[stats]{factanal}}}
 
diff --git a/man/MCMClogit.Rd b/man/MCMClogit.Rd
index 64d9d36..c17b218 100644
--- a/man/MCMClogit.Rd
+++ b/man/MCMClogit.Rd
@@ -191,5 +191,4 @@ MCMClogit(formula, data=NULL, burnin = 1000, mcmc = 10000,
 
 \keyword{models}
 
-\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}}, \code{\link[base]{glm}}}
-
+\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}}, \code{\link[stats]{glm}}}
diff --git a/man/MCMCmixfactanal.Rd b/man/MCMCmixfactanal.Rd
index a800392..c674d4e 100644
--- a/man/MCMCmixfactanal.Rd
+++ b/man/MCMCmixfactanal.Rd
@@ -298,7 +298,7 @@ summary(post)
 \keyword{models}
 
 \seealso{\code{\link[coda]{plot.mcmc}}, \code{\link[coda]{summary.mcmc}},
-  \code{\link[mva]{factanal}}, \code{\link[MCMCpack]{MCMCfactanal}},
+  \code{\link[stats]{factanal}}, \code{\link[MCMCpack]{MCMCfactanal}},
   \code{\link[MCMCpack]{MCMCordfactanal}},
   \code{\link[MCMCpack]{MCMCirt1d}}, \code{\link[MCMCpack]{MCMCirtKd}}}
 
diff --git a/man/MCMCordfactanal.Rd b/man/MCMCordfactanal.Rd
index 3f8f931..3b934ac 100644
--- a/man/MCMCordfactanal.Rd
+++ b/man/MCMCordfactanal.Rd
@@ -227,6 +227,6 @@ MCMCordfactanal(x, factors, lambda.constraints=list(),
 \keyword{models}
 
 \seealso{\code{\link[coda]{plot.mcmc}}, \code{\link[coda]{summary.mcmc}},
-  \code{\link[mva]{factanal}}, \code{\link[MCMCpack]{MCMCfactanal}},
+  \code{\link[stats]{factanal}}, \code{\link[MCMCpack]{MCMCfactanal}},
   \code{\link[MCMCpack]{MCMCirt1d}}, \code{\link[MCMCpack]{MCMCirtKd}}}
 
diff --git a/man/MCMCpoisson.Rd b/man/MCMCpoisson.Rd
index d51ace3..78a3a59 100644
--- a/man/MCMCpoisson.Rd
+++ b/man/MCMCpoisson.Rd
@@ -132,5 +132,5 @@ MCMCpoisson(formula, data = NULL, burnin = 1000, mcmc = 10000,
 
 \keyword{models}
 
-\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}}, \code{\link[base]{glm}}}
+\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}}, \code{\link[stats]{glm}}}
 
diff --git a/man/MCMCprobit.Rd b/man/MCMCprobit.Rd
index 52287b5..fbdb03c 100644
--- a/man/MCMCprobit.Rd
+++ b/man/MCMCprobit.Rd
@@ -130,5 +130,5 @@ MCMCprobit(formula, data = NULL, burnin = 1000, mcmc = 10000,
 
 \keyword{models}
 
-\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}}, \code{\link[base]{glm}}}
+\seealso{\code{\link[coda]{plot.mcmc}},\code{\link[coda]{summary.mcmc}}, \code{\link[stats]{glm}}}
 
diff --git a/man/MCMCquantreg.Rd b/man/MCMCquantreg.Rd
index ca7a8cf..e9bdddb 100644
--- a/man/MCMCquantreg.Rd
+++ b/man/MCMCquantreg.Rd
@@ -2,7 +2,7 @@
 
 \alias{MCMCquantreg}
 
-\title{Bayesian quantile regression using Gibbs sampling}
+\title{ Bayesian quantile regression using Gibbs sampling }
 
 \description{
   This function fits quantile regression models under Bayesian inference.  
@@ -14,7 +14,7 @@
 }
 
 \usage{
-MCMCquantreg(formula, p=0.5, data = NULL, burnin = 1000,
+MCMCquantreg(formula, tau=0.5, data = NULL, burnin = 1000,
    mcmc = 10000, thin = 1, verbose = 0, seed = NA,
    beta.start = NA, b0 = 0, B0 = 0, c0 = 0.001, d0 = 0.001, ...)
 }
@@ -23,7 +23,7 @@ MCMCquantreg(formula, p=0.5, data = NULL, burnin = 1000,
 
   \item{formula}{ Model formula. }
 
-  \item{p}{The quantile of interest. Must be between 0 and 1. The default value of 0.5 corresponds to median regression.}
+  \item{tau}{The quantile of interest. Must be between 0 and 1. The default value of 0.5 corresponds to median regression.}
 
 
   \item{data}{ Data frame. }
@@ -56,10 +56,10 @@ MCMCquantreg(formula, p=0.5, data = NULL, burnin = 1000,
     column vector with dimension equal to the dimension of \eqn{\beta}{beta}.
     The default value of NA will use the OLS
     estimate \eqn{\hat{\beta}}{beta^hat} with 
-    \eqn{\hat{\sigma}\Phi^{-1}(p)}{sigma^hat*Phi^(-1)(p)} added on to the first element of \eqn{\hat{\beta}}{beta^hat} as the starting value. 
+    \eqn{\hat{\sigma}\Phi^{-1}(\tau)}{sigma^hat*Phi^(-1)(tau)} added on to the first element of \eqn{\hat{\beta}}{beta^hat} as the starting value. 
     (\eqn{\hat{\sigma}^2}{(sigma^hat)^2} denotes the usual unbiased estimator of
     \eqn{\sigma^2}{sigma^2} under ordinary mean regression and 
-    \eqn{\Phi^{-1}(p)}{Phi^(-1)(p)} denotes the inverse of the
+    \eqn{\Phi^{-1}(\tau)}{Phi^(-1)(tau)} denotes the inverse of the
     cumulative density function of the standard normal distribution.)  
      Note that the default value assume that an intercept is included in the model.
     If a scalar is given,  that value will serve as the starting value
@@ -99,11 +99,11 @@ MCMCquantreg(formula, p=0.5, data = NULL, burnin = 1000,
   
   The model takes the following form:
   \deqn{y_i = x_i ' \beta + \varepsilon_i}{y_i = x_i'beta + epsilon_i}
-  The errors are assumed to have an Asymmetric Laplace distribution with pth quantile equal to zero 
+  The errors are assumed to have an Asymmetric Laplace distribution with \eqn{\tau}{tau}th quantile equal to zero 
   and shape parameter equal to \eqn{\sigma}{sigma}:
-  \deqn{\varepsilon_i(p) \sim \mathcal{AL}(0, \sigma, p)}{epsilon_i(p) ~ AL(0,
-    sigma, p),}
-  where \eqn{\beta}{beta} and \eqn{\sigma}{sigma} depend on p. 
+  \deqn{\varepsilon_i(\tau) \sim \mathcal{AL}(0, \sigma, \tau)}{epsilon_i(tau) ~ AL(0,
+    sigma, tau),}
+  where \eqn{\beta}{beta} and \eqn{\sigma}{sigma} depend on \eqn{\tau}{tau}. 
   We assume standard, semi-conjugate priors:
   \deqn{\beta \sim \mathcal{N}(b_0,B_0^{-1})}{beta ~ N(b0,B0^(-1)),}
   and
@@ -122,16 +122,16 @@ MCMCquantreg(formula, p=0.5, data = NULL, burnin = 1000,
 \references{ Daniel Pemstein, Kevin M. Quinn, and Andrew D. Martin.  2007.  
    \emph{Scythe Statistical Library 1.2.} \url{http://scythe.wustl.edu}.
    
-   Craig Reed and Keming Yu. 2009. ``A Partially Collapsed Gibbs Sampler for Bayesian Quantile Regression." Technical Report.
+   Craig Reed and Keming Yu. 2009. "A Partially Collapsed Gibbs Sampler for Bayesian Quantile Regression." Technical Report.
    
-   Keming Yu and Jin Zhang. 2005. ``A Three Parameter Asymmetric Laplace Distribution and it's extensions."
+   Keming Yu and Jin Zhang. 2005. "A Three Parameter Asymmetric Laplace Distribution and it's extensions."
 \emph{Communications in Statistics - Theory and Methods}, 34, 1867-1879.
    
    Martyn Plummer, Nicky Best, Kate Cowles, and Karen Vines. 2002.
    \emph{Output Analysis and Diagnostics for MCMC (CODA)}.
    \url{http://www-fis.iarc.fr/coda/}.}
      
-\author{Craig Reed}
+\author{ Craig Reed}
 
 \seealso{ \code{\link[MCMCpack]{MCMCregress}}, \code{\link[coda]{plot.mcmc}},
   \code{\link[coda]{summary.mcmc}}, \code{\link[stats]{lm}}, \code{\link[quantreg]{rq}} }
@@ -142,7 +142,7 @@ MCMCquantreg(formula, p=0.5, data = NULL, burnin = 1000,
 x<-rep(1:10,5)
 y<-rnorm(50,mean=x)
 posterior_50 <- MCMCquantreg(y~x)
-posterior_95 <- MCMCquantreg(y~x, p=0.95, verbose=10000,
+posterior_95 <- MCMCquantreg(y~x, tau=0.95, verbose=10000,
     mcmc=50000, thin=10, seed=2)
 plot(posterior_50)
 plot(posterior_95)
diff --git a/src/MCMCfcds.h b/src/MCMCfcds.h
index b55ea66..bcfe162 100644
--- a/src/MCMCfcds.h
+++ b/src/MCMCfcds.h
@@ -19,14 +19,14 @@
 //
 // KQ 6/10/2004
 // DBP 7/01/2007 [ported to scythe 1.0.x (partial)]
-// ADM 7/28/2009 [added some functions from Craig Reed for quantile
-//                regression]
 //
 // Copyright (C) 2003-2007 Andrew D. Martin and Kevin M. Quinn
 // Copyright (C) 2007-present Andrew D. Martin, Kevin M. Quinn,
 //    and Jong Hee Park
 //////////////////////////////////////////////////////////////////////////
 
+
+
 #ifndef MCMCFCDS_H
 #define MCMCFCDS_H
 
@@ -87,8 +87,6 @@ NormIGregress_sigma2_draw (const Matrix <> &X, const Matrix <> &Y,
   return  stream.rigamma (c_post, d_post);   
 }
 
-////////////// New Additions ////////////////////////
-
 // linear regression with Laplace errors beta draw 
 // (multivariate Normal prior)
 // regression model is y = X * beta + epsilon,  epsilon ~ Laplace(0,sigma)
@@ -135,7 +133,6 @@ LaplaceNormregress_beta_draw (const Matrix<>& X, const Matrix<>& Y, const Matrix
 
 	return( gaxpy(C, stream.rnorm(k,1, 0, 1), betahat) );
 }
-  
 
 // linear regression with Laplace errors sigma draw 
 // (inverse-Gamma  prior)
@@ -157,12 +154,12 @@ LaplaceIGammaregress_sigma_draw (const Matrix <> &abse, double c0, double d0,
 
 // linear regression with Asymmetric Laplace errors beta draw 
 // (multivariate Normal prior)
-// regression model is y = X * beta + epsilon,  epsilon ~ ALaplace(0,sigma,p)
+// regression model is y = X * beta + epsilon,  epsilon ~ ALaplace(0,sigma,tau)
 // b0 is the prior mean of beta
 // B0 is the prior precision (the inverse variance) of beta
 template <typename RNGTYPE>
 Matrix<double> 
-ALaplaceNormregress_beta_draw (double p, const Matrix<>& X, const Matrix<>& Y, const Matrix<>& weights,
+ALaplaceNormregress_beta_draw (double tau, const Matrix<>& X, const Matrix<>& Y, const Matrix<>& weights,
          const Matrix<>& b0, const Matrix<>& B0, double sigma,
          rng<RNGTYPE>& stream)
 {
@@ -170,7 +167,7 @@ ALaplaceNormregress_beta_draw (double p, const Matrix<>& X, const Matrix<>& Y, c
 	const unsigned int k = X.cols();
 	const unsigned int n_obs = X.rows();
 	const double one_over_two_sigma = 1.0/(2.0*sigma);
-	const Matrix<> U = Y - (1.0-2.0*p)*pow(weights,-1.0); 
+	const Matrix<> U = Y - (1.0-2.0*tau)*pow(weights,-1.0); 
 	Matrix<> XtwX(k,k,false);
 	Matrix<> XtwU(k,1,false);
 	double temp_x = 0.0;
@@ -205,17 +202,17 @@ ALaplaceNormregress_beta_draw (double p, const Matrix<>& X, const Matrix<>& Y, c
 
 // linear regression with Asymmetric Laplace errors sigma draw 
 // (inverse-Gamma  prior)
-// regression model is y = X * beta + epsilon,  epsilon ~ ALaplace(0,sigma, p)
+// regression model is y = X * beta + epsilon,  epsilon ~ ALaplace(0,sigma,tau)
 // c0/2 is the prior shape parameter for sigma
 // d0/2 is the prior scale parameter for sigma 
 template <typename RNGTYPE>
 double
-ALaplaceIGammaregress_sigma_draw (double p, const Matrix<> &e, const Matrix <> &abse, double c0, double d0,
+ALaplaceIGammaregress_sigma_draw (double tau, const Matrix<> &e, const Matrix <> &abse, double c0, double d0,
          rng<RNGTYPE>& stream)
 
 {
 	const double c_post = 0.5*c0 + abse.rows();
-	const double d_post = 0.5*(d0 + sum(abse)+(2.0*p-1.0)*sum(e));
+	const double d_post = 0.5*(d0 + sum(abse)+(2.0*tau-1.0)*sum(e));
 
 	return  stream.rigamma (c_post, d_post); 
 
@@ -251,8 +248,6 @@ ALaplaceIGaussregress_weights_draw (const Matrix <> &abse, double sigma,
 	return w;
 }
 
-////////////////////////////////////////////////////
-
 // update latent data for standard item response models
 // only works for 1 dimensional case
 template <typename RNGTYPE>
diff --git a/src/MCMCquantreg.cc b/src/MCMCquantreg.cc
index 1b81884..35ecab3 100644
--- a/src/MCMCquantreg.cc
+++ b/src/MCMCquantreg.cc
@@ -56,7 +56,7 @@ using namespace scythe;
  * fills with the posterior.  
  */
 template <typename RNGTYPE>
-void MCMCquantreg_impl (rng<RNGTYPE>& stream, double p, const Matrix<>& Y,
+void MCMCquantreg_impl (rng<RNGTYPE>& stream, double tau, const Matrix<>& Y,
     const Matrix<>& X, Matrix<>& beta, const Matrix<>& b0,
     const Matrix<>& B0, double c0, double d0,
     unsigned int burnin, unsigned int mcmc, unsigned int thin, 
@@ -78,9 +78,9 @@ void MCMCquantreg_impl (rng<RNGTYPE>& stream, double p, const Matrix<>& Y,
    for (unsigned int iter = 0; iter < tot_iter; ++iter) {
      Matrix<> e = gaxpy(X, (-1*beta), Y);
      Matrix<> abse = fabs(e);
-     double sigma = ALaplaceIGammaregress_sigma_draw (p, e, abse, c0, d0, stream);
+     double sigma = ALaplaceIGammaregress_sigma_draw (tau, e, abse, c0, d0, stream);
      Matrix<> weights = ALaplaceIGaussregress_weights_draw (abse, sigma, stream);
-     beta = ALaplaceNormregress_beta_draw (p, X, Y, weights, b0, B0, sigma, stream);  
+     beta = ALaplaceNormregress_beta_draw (tau, X, Y, weights, b0, B0, sigma, stream);  
 
      // store draws in storage matrix (or matrices)
      if (iter >= burnin && (iter % thin == 0)) {
@@ -108,7 +108,7 @@ void MCMCquantreg_impl (rng<RNGTYPE>& stream, double p, const Matrix<>& Y,
 
 extern "C" {
    void MCMCquantreg(double *sampledata, const int *samplerow,
-		    const int *samplecol, const double *p, const double *Ydata, const int *Yrow,
+		    const int *samplecol, const double *tau, const double *Ydata, const int *Yrow,
 		    const int *Ycol, const double *Xdata, const int *Xrow,
 		    const int *Xcol, const int *burnin, const int *mcmc,
 		    const int *thin, const int *uselecuyer, const int *seedarray,
@@ -127,7 +127,7 @@ extern "C" {
      Matrix<> B0(*B0row, *B0col, B0data);
 
      Matrix<> storagematrix;
-     MCMCPACK_PASSRNG2MODEL(MCMCquantreg_impl, *p, Y, X, betastart, b0, B0, 
+     MCMCPACK_PASSRNG2MODEL(MCMCquantreg_impl, *tau, Y, X, betastart, b0, B0, 
                             *c0, *d0, *burnin, *mcmc, *thin, *verbose,
                             storagematrix);
      

-- 
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