diff --git a/DESCRIPTION b/DESCRIPTION index 85722c4..95c01aa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: mashr Type: Package Encoding: UTF-8 Title: Multivariate Adaptive Shrinkage -Version: 0.2-0 +Version: 0.2-1 Date: 2017-10-07 Author: Matthew Stephens, Sarah Urbut, Gao Wang, Peter Carbonetto Maintainer: Matthew Stephens @@ -11,6 +11,7 @@ URL: http://github.com/stephenslab/mashr BugReports: http://github.com/stephenslab/mashr/issues License: BSD_3_clause + file LICENSE LazyData: true +SystemRequirements: C++11 Depends: R (>= 3.3.0), ashr (>= 2.1-19) Imports: diff --git a/docs/intro_mash.html b/docs/intro_mash.html index e57137b..47bf169 100644 --- a/docs/intro_mash.html +++ b/docs/intro_mash.html @@ -168,9 +168,9 @@

Step 3: fit the model

#  - Computing 2000 x 151 likelihood matrix.
 #  - Likelihood calculations took 0.04 seconds.
 #  - Fitting model with 151 mixture components.
-#  - Model fitting took 0.34 seconds.
+#  - Model fitting took 0.33 seconds.
 #  - Computing posterior matrices.
-#  - Computation allocated took 0.01 seconds.
+# - Computation allocated took 0.02 seconds.

This can take a little time. What this does is to fit a mixture model to the data, estimating the mixture proportions. Specifically the model is that the true effects follow a mixture of multivariate normal distributions: \(B \sim \sum_k \sum_l \pi_{kl} N(0, \omega_l U_k)\) where the \(\omega_l\) are scaling factors set by the “grid” parameter in mash and the \(U_k\) are the covariance matrices (here specified by U.c).

Step 4: Extract Posterior Summaries

@@ -272,10 +272,10 @@

Session information.

# [1] stats graphics grDevices utils datasets methods base # # other attached packages: -# [1] mashr_0.1-24 ashr_2.1-26 rmarkdown_1.6 +# [1] mashr_0.2-0 ashr_2.1-26 rmarkdown_1.6 # # loaded via a namespace (and not attached): -# [1] Rcpp_0.12.12 knitr_1.16 magrittr_1.5 +# [1] Rcpp_0.12.12 knitr_1.17 magrittr_1.5 # [4] REBayes_0.85 MASS_7.3-47 doParallel_1.0.10 # [7] pscl_1.4.9 SQUAREM_2016.8-2 lattice_0.20-35 # [10] foreach_1.4.3 plyr_1.8.4 stringr_1.2.0 @@ -284,7 +284,7 @@

Session information.

# [19] assertthat_0.2.0 yaml_2.1.14 rprojroot_1.2 # [22] digest_0.6.12 Matrix_1.2-10 codetools_0.2-15 # [25] evaluate_0.10.1 stringi_1.1.5 compiler_3.4.1 -# [28] Rmosek_7.1.3 backports_1.1.0 mvtnorm_1.0-6 +# [28] Rmosek_8.0.69 backports_1.1.0 mvtnorm_1.0-6 # [31] truncnorm_1.0-7
diff --git a/docs/intro_mash_dd.html b/docs/intro_mash_dd.html index 6a7a146..bf14e10 100644 --- a/docs/intro_mash_dd.html +++ b/docs/intro_mash_dd.html @@ -187,9 +187,9 @@

Run mash

#  - Computing 2000 x 91 likelihood matrix.
 #  - Likelihood calculations took 0.03 seconds.
 #  - Fitting model with 91 mixture components.
-#  - Model fitting took 0.18 seconds.
+#  - Model fitting took 0.13 seconds.
 #  - Computing posterior matrices.
-#  - Computation allocated took 0.00 seconds.
+# - Computation allocated took 0.01 seconds.
print(get_loglik(m.ed),digits = 10)
# [1] -16155.73391

From the fit we see that the fit using the data-driven covariances is not as good as when we used the canonical covariances (which was -16120.32; from the introductory vignette). This is expected for this simulation because the simulation actually used the canonical covariances!

@@ -197,7 +197,7 @@

Run mash

U.c = cov_canonical(data)  
 m   = mash(data, c(U.c,U.ed))
#  - Computing 2000 x 241 likelihood matrix.
-#  - Likelihood calculations took 0.14 seconds.
+#  - Likelihood calculations took 0.11 seconds.
 #  - Fitting model with 241 mixture components.
# Warning in REBayes::KWDual(A, rep(1, k), normalize(w), control = control): estimated mixing distribution has some negative values:
 #              consider reducing rtol
@@ -205,9 +205,9 @@

Run mash

# 0.849522254927991, : Optimization step yields mixture weights that are # either too small, or negative; weights have been corrected and renormalized # after the optimization. -
#  - Model fitting took 0.68 seconds.
+
#  - Model fitting took 0.45 seconds.
 #  - Computing posterior matrices.
-#  - Computation allocated took 0.04 seconds.
+# - Computation allocated took 0.07 seconds.

For an example with simulations that do not follow the standard canonical matrices see here.

@@ -228,10 +228,10 @@

Session information.

# [1] stats graphics grDevices utils datasets methods base # # other attached packages: -# [1] mashr_0.1-24 ashr_2.1-26 rmarkdown_1.6 +# [1] mashr_0.2-0 ashr_2.1-26 rmarkdown_1.6 # # loaded via a namespace (and not attached): -# [1] Rcpp_0.12.12 knitr_1.16 +# [1] Rcpp_0.12.12 knitr_1.17 # [3] magrittr_1.5 REBayes_0.85 # [5] MASS_7.3-47 doParallel_1.0.10 # [7] pscl_1.4.9 SQUAREM_2016.8-2 @@ -245,7 +245,7 @@

Session information.

# [23] digest_0.6.12 Matrix_1.2-10 # [25] codetools_0.2-15 evaluate_0.10.1 # [27] stringi_1.1.5 compiler_3.4.1 -# [29] Rmosek_7.1.3 backports_1.1.0 +# [29] Rmosek_8.0.69 backports_1.1.0 # [31] mvtnorm_1.0-6 truncnorm_1.0-7
diff --git a/docs/simulate_noncanon.html b/docs/simulate_noncanon.html index bd86c18..f873c33 100644 --- a/docs/simulate_noncanon.html +++ b/docs/simulate_noncanon.html @@ -160,30 +160,30 @@

Simple simulation

# - Computing 2000 x 151 likelihood matrix. # - Likelihood calculations took 0.04 seconds. # - Fitting model with 151 mixture components. -# - Model fitting took 0.29 seconds. +# - Model fitting took 0.26 seconds. # - Computing posterior matrices. -# - Computation allocated took 0.00 seconds. +# - Computation allocated took 0.01 seconds. m.ed = mash(data, U.ed) # - Computing 2000 x 91 likelihood matrix. # - Likelihood calculations took 0.02 seconds. # - Fitting model with 91 mixture components. -# - Model fitting took 0.16 seconds. +# - Model fitting took 0.13 seconds. # - Computing posterior matrices. # - Computation allocated took 0.01 seconds. m.c.ed = mash(data, c(U.c,U.ed)) # - Computing 2000 x 241 likelihood matrix. # - Likelihood calculations took 0.06 seconds. # - Fitting model with 241 mixture components. -# - Model fitting took 0.58 seconds. +# - Model fitting took 0.48 seconds. # - Computing posterior matrices. -# - Computation allocated took 0.00 seconds. +# - Computation allocated took 0.01 seconds. m.true = mash(data, U.true) # - Computing 2000 x 31 likelihood matrix. # - Likelihood calculations took 0.01 seconds. # - Fitting model with 31 mixture components. -# - Model fitting took 0.06 seconds. +# - Model fitting took 0.05 seconds. # - Computing posterior matrices. -# - Computation allocated took 0.00 seconds. +# - Computation allocated took 0.01 seconds. print(get_loglik(m.c),digits = 10) # [1] -16169.17212 diff --git a/man/mash_compute_posterior_matrices.Rd b/man/mash_compute_posterior_matrices.Rd index ff33f60..647440c 100644 --- a/man/mash_compute_posterior_matrices.Rd +++ b/man/mash_compute_posterior_matrices.Rd @@ -7,7 +7,7 @@ mash_compute_posterior_matrices(g, data, pi_thresh = 1e-10) } \arguments{ -\item{g}{a mash object or the fitted_g from a mash object. When a mash object is given with `posterior_weights` attribute, the provided posterior weights will be used; otherwise it will be computed.} +\item{g}{a mash object or the fitted_g from a mash object.} \item{data}{a set of data on which to compute the posterior matrices} diff --git a/src/Makevars b/src/Makevars deleted file mode 100644 index c6364f8..0000000 --- a/src/Makevars +++ /dev/null @@ -1,3 +0,0 @@ -CXX_STD = CXX1X -PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/Makevars.win b/src/Makevars.win deleted file mode 100644 index 4152b3f..0000000 --- a/src/Makevars.win +++ /dev/null @@ -1,3 +0,0 @@ -CXX_STD = CXX11 -PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/mash.cpp b/src/mash.cpp index 0b5d661..0f2fb3f 100644 --- a/src/mash.cpp +++ b/src/mash.cpp @@ -4,6 +4,9 @@ #include "mash.h" // [[Rcpp::depends(RcppArmadillo)]] +// Enable C++11. +// [[Rcpp::plugins(cpp11)]] + // [[Rcpp::export]] Rcpp::List calc_lik_rcpp(Rcpp::NumericMatrix b_mat, Rcpp::NumericMatrix s_mat,