Diff of /R/hsstan-package.R [000000] .. [ede2d4]

Switch to unified view

a b/R/hsstan-package.R
1
##=============================================================================
2
##
3
## Copyright (c) 2018-2019 Marco Colombo and Paul McKeigue
4
##
5
## This program is free software: you can redistribute it and/or modify
6
## it under the terms of the GNU General Public License as published by
7
## the Free Software Foundation, either version 3 of the License, or
8
## (at your option) any later version.
9
##
10
## This program is distributed in the hope that it will be useful,
11
## but WITHOUT ANY WARRANTY; without even the implied warranty of
12
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
## GNU General Public License for more details.
14
##
15
## You should have received a copy of the GNU General Public License
16
## along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
##
18
##=============================================================================
19
20
#' Hierarchical shrinkage Stan models for biomarker selection
21
#'
22
#' The **hsstan** package provides linear and logistic regression models
23
#' penalized with hierarchical shrinkage priors for selection of biomarkers.
24
#' Models are fitted with Stan (Carpenter et al. (2017)), which allows to
25
#' perform full Bayesian inference.
26
#'
27
#' The package implements the horseshoe and regularized horseshoe priors
28
#' (Piironen and Vehtari (2017)), and the projection predictive selection
29
#' approach to recover a sparse set of predictive biomarkers (Piironen,
30
#' Paasiniemi and Vehtari (2020)).
31
#'
32
#' The approach is particularly suited to selection from high-dimensional
33
#' panels of biomarkers, such as those that can be measured by MSMS or similar
34
#' technologies (Colombo, Valo, McGurnaghan et al. (2019), Colombo, McGurnaghan,
35
#' Blackbourn et al. (2020)).
36
#'
37
#' @docType package
38
#' @name hsstan-package
39
#' @import Rcpp
40
#' @import methods
41
#' @useDynLib hsstan, .registration = TRUE
42
#'
43
#' @references
44
#' B. Carpenter et al. (2017),
45
#' Stan: a probabilistic programming language,
46
#' _Journal of Statistical Software_, 76 (1).
47
#' \doi{10.18637/jss.v076.i01}
48
#'
49
#' J. Piironen and A. Vehtari (2017),
50
#' Sparsity information and regularization in the horseshoe and other shrinkage
51
#' priors, _Electronic Journal of Statistics_, 11 (2), 5018-5051.
52
#' \doi{10.1214/17-EJS1337SI}
53
#'
54
#' J. Piironen, M. Paasiniemi and A. Vehtari (2020),
55
#' Projective inference in high-dimensional problems: prediction and feature
56
#' selection, _Electronic Journal of Statistics_, 14 (1), 2155-2197.
57
#' \doi{10.1214/20-EJS1711}
58
#'
59
#' M. Colombo, E. Valo, S.J. McGurnaghan et al. (2019),
60
#' Biomarkers associated with progression of renal disease in type 1 diabetes,
61
#' _Diabetologia_, 62 (9), 1616-1627.
62
#' \doi{10.1007/s00125-019-4915-0}
63
#'
64
#' M. Colombo, S.J. McGurnaghan, L.A.K. Blackbourn et al. (2020),
65
#' Comparison of serum and urinary biomarker panels with albumin creatinin
66
#' ratio in the prediction of renal function decline in type 1 diabetes,
67
#' _Diabetologia_, 63 (4), 788-798.
68
#' \doi{10.1007/s00125-019-05081-8}
69
#'
70
#' M. Colombo, A. Asadi Shehni, I. Thoma et al. (2021),
71
#' Quantitative levels of serum N-glycans in type 1 diabetes and their
72
#' association with kidney disease,
73
#' _Glycobiology_, 31 (5), 613-623.
74
#' \doi{10.1093/glycob/cwaa106}
75
NULL
76
77
.onLoad <- function(libname, pkgname) { # nocov start
78
  modules <- paste0("stan_fit4", names(stanmodels), "_mod")
79
  for (m in modules) loadModule(m, what = TRUE)
80
} # nocov end
81
82
.onAttach <- function(libname, pkgname) {
83
84
    ## number of cores used by default for sampling from the chains
85
    if (is.null(options()$mc.cores))
86
        options(mc.cores=min(ceiling(parallel::detectCores() / 2), 4)) # nocov
87
88
    packageStartupMessage("hsstan ", utils::packageVersion("hsstan"),
89
                          ": using ", options("mc.cores"),
90
                          " cores, set 'options(mc.cores)' to change.")
91
}