[r-cran-mnp] 34/51: Import Upstream version 2.5-3
Andreas Tille
tille at debian.org
Fri Sep 8 14:14:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-mnp.
commit 23159b47de198f3e9ac80fffd04145df87578e4f
Author: Andreas Tille <tille at debian.org>
Date: Fri Sep 8 15:54:56 2017 +0200
Import Upstream version 2.5-3
---
DESCRIPTION | 6 +++---
R/predict.mnp.R | 6 +++---
src/MNP.c | 20 ++++++++++++++------
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 80897b6..ba3004d 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: MNP
-Version: 2.5-1
-Date: 2006-11-21
+Version: 2.5-3
+Date: 2006-12-04
Title: R Package for Fitting the Multinomial Probit Model
Author: Kosuke Imai <kimai at princeton.edu>,
David A. van Dyk <dvd at uci.edu>.
@@ -24,4 +24,4 @@ LazyLoad: yes
LazyData: yes
License: GPL (version 2 or later)
URL: http://imai.princeton.edu/research/MNP.html
-Packaged: Tue Nov 21 11:06:30 2006; kimai
+Packaged: Tue Dec 5 15:50:14 2006; kimai
diff --git a/R/predict.mnp.R b/R/predict.mnp.R
index a57fddb..636acee 100644
--- a/R/predict.mnp.R
+++ b/R/predict.mnp.R
@@ -63,14 +63,14 @@ predict.mnp <- function(object, newdata = NULL, newdraw = NULL, n.draws = 1,
ans$y <- NULL
if ("order" %in% type)
ans$o <- aperm(array(res$order, dim=c(p, n.mcmc, n.obs),
- dimnames = c(alt, 1:n.mcmc,
- rownames(x))), c(3,1,2))
+ dimnames = list(alt, 1:n.mcmc,
+ rownames(x))), c(3,1,2))
else
ans$o <- NULL
if ("prob" %in% type)
if (n.draws > 1)
ans$p <- aperm(array(res$prob, dim = c(p, n.mcmc, n.obs),
- dimnames = c(alt, 1:nrow(coef),
+ dimnames = list(alt, 1:n.mcmc,
rownames(x))), c(3,1,2))
else
ans$p <- matrix(res$prob, nrow = n.obs, ncol = p, byrow = TRUE,
diff --git a/src/MNP.c b/src/MNP.c
index b8dddea..9280caf 100644
--- a/src/MNP.c
+++ b/src/MNP.c
@@ -473,8 +473,10 @@ void predict(double *dX, /* X matrix */
double **X = doubleMatrix(n_samp*n_dim, n_cov);
double *Xbeta = doubleArray(n_cov);
+ double *vtemp = doubleArray(n_dim);
double **W = doubleMatrix(n_extra, n_dim+1);
double **beta = doubleMatrix(n_draw, n_cov);
+ double **mtemp = doubleMatrix(n_dim, n_dim);
double ***Sigma = doubleMatrix3D(n_draw, n_dim, n_dim);
int i, j, k, main_loop, itemp, itempP, itempO, itempC;
@@ -532,13 +534,17 @@ void predict(double *dX, /* X matrix */
for (k = 0; k < n_cov; k++)
Xbeta[j] += X[i*n_dim+j][k] * beta[main_loop][k];
}
+ /* PdoubleArray(Xbeta, n_dim); */
/* sample W */
for (j = 0; j < n_extra; j++) {
- rMVN(W[j], Xbeta, Sigma[main_loop], n_dim);
- W[j][n_dim] = 0;
+ dinv(Sigma[main_loop], n_dim, mtemp);
+ rMVN(vtemp, Xbeta, mtemp, n_dim);
+ for (k = 0; k < n_dim; k++)
+ W[j][k+1] = vtemp[k];
+ W[j][0] = 0;
}
- /* which dimension is max for each of n_extra W draws? */
- /* PdoubleMatrix(W, n_extra, n_dim+1); */
+ /* which dimension is max for each of n_extra W draws?
+ PdoubleMatrix(W, n_extra, n_dim+1); */
R_max_col2(W, n_extra, n_dim+1, maxdim, 1);
/* PintArray(maxdim, n_extra); */
/* order */
@@ -546,10 +552,10 @@ void predict(double *dX, /* X matrix */
for (k = 0; k <= n_dim; k++) {
ind[k] = k; sumorder[k] = 0;
}
- rsort_with_index(W[j], ind, n_dim+1);
+ revsort(W[j], ind, n_dim+1);
/* PintArray(ind, n_dim+1); */
for (k = 0; k <= n_dim; k++)
- sumorder[ind[k]] += (n_dim-k);
+ sumorder[ind[k]] += (k+1);
if(*verbose) {
if(count == itempQ) {
Rprintf("%3d percent done.\n", progress*10);
@@ -590,9 +596,11 @@ void predict(double *dX, /* X matrix */
/* freeing memory */
FreeMatrix(X, n_samp*n_dim);
+ free(vtemp);
free(Xbeta);
FreeMatrix(W, n_extra);
FreeMatrix(beta, n_draw);
+ FreeMatrix(mtemp, n_dim);
Free3DMatrix(Sigma, n_draw, n_dim);
free(maxdim);
free(ind);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-mnp.git
More information about the debian-science-commits
mailing list