diff --git a/.Rbuildignore b/.Rbuildignore index e3bc7e0..c8be1c2 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -30,4 +30,4 @@ src/stan_files/.*\.hpp$ ^man/package-doc$ ^src/package-binary$ ^Makefile$ -^\.github$ +^LICENSE$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 087f0b0..a4d4ca6 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -13,6 +13,7 @@ name: pkgdown jobs: pkgdown: + if: github.repository_owner == 'Novartis' runs-on: ubuntu-latest # Only restrict concurrency for non-PR jobs concurrency: diff --git a/DESCRIPTION b/DESCRIPTION index 0b725b8..08efc29 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,8 +8,8 @@ Description: Tool-set to support Bayesian evidence synthesis. This for details on applying this package while Neuenschwander et al. (2010) and Schmidli et al. (2014) explain details on the methodology. -Version: 1.6-5 -Date: 2023-01-23 +Version: 1.6-6 +Date: 2023-03-03 Authors@R: c(person("Novartis", "Pharma AG", role = "cph") ,person("Sebastian", "Weber", email="sebastian.weber@novartis.com", role=c("aut", "cre")) ,person("Beat", "Neuenschwander", email="beat.neuenschwander@novartis.com", role="ctb") @@ -49,6 +49,7 @@ LazyData: true Biarch: true NeedsCompilation: yes UseLTO: true +URL: https://opensource.nibr.com/RBesT/ BugReports: https://github.com/Novartis/RBesT/issues Suggests: rmarkdown, @@ -63,8 +64,6 @@ Suggests: tidyr, parallel VignetteBuilder: knitr -SystemRequirements: GNU make, pandoc (>= 1.12.3), pandoc-citeproc +SystemRequirements: GNU make, pandoc (>= 1.12.3), pandoc-citeproc, C++17 Encoding: UTF-8 -RoxygenNote: 7.1.1 -ReleaseSHA1: 23ae246 -URL: http://opensource.nibr.com/RBesT/ +RoxygenNote: 7.2.3 diff --git a/Makefile b/Makefile index 7b49e7a..5b1004b 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ SRCDIR = ./demo ./inst/stan ./inst/stan/include ./man-roxygen OUTDIR_ABS=$(abspath $(OUTDIR)) PROJROOT_ABS=$(abspath .) +RPKG=$(patsubst ‘%’, %, $(word 2, $(shell grep ^Package: DESCRIPTION))) INCS = R_PKG_SRCS = $(wildcard R/*.R) R_SRCS = $(wildcard *.R $(foreach fd, $(SRCDIR), $(fd)/*.R)) @@ -19,7 +20,7 @@ STAN_SRCS = $(wildcard *.stan $(foreach fd, $(SRCDIR), $(fd)/*.stan)) SRCS = $(R_PKG_SRCS) $(R_SRCS) $(RMD_SRCS) $(STAN_SRCS) NODIR_SRC = $(notdir $(SRCS)) BIN_OBJS = src/package-binary R/sysdata.rda -DOC_OBJS = man/package-doc inst/doc/RBesT.pdf +DOC_OBJS = man/package-doc inst/doc/$(RPKG).pdf R_HOME ?= $(shell R RHOME) PKG_VERSION ?= $(patsubst ‘%’, %, $(word 2, $(shell grep ^Version DESCRIPTION))) @@ -43,13 +44,22 @@ all : $(TARGET) cd $(@D); echo running R -q -e "rmarkdown::render('$( NAMESPACE echo "import(Rcpp)" >> NAMESPACE echo "import(methods)" >> NAMESPACE echo "importFrom(rstan, sampling)" >> NAMESPACE - echo "useDynLib(RBesT, .registration = TRUE)" >> NAMESPACE + echo "useDynLib($(RPKG), .registration = TRUE)" >> NAMESPACE + "${R_HOME}/bin/Rscript" -e "rstantools::rstan_config()" + +src/package-binary: $(STAN_SRCS) R/stanmodels.R + ## ensure that NAMESPACE contains load directive + echo "# Generated by roxygen2: do not edit by hand" > NAMESPACE + echo "import(Rcpp)" >> NAMESPACE + echo "import(methods)" >> NAMESPACE + echo "importFrom(rstan, sampling)" >> NAMESPACE + echo "useDynLib($(RPKG), .registration = TRUE)" >> NAMESPACE "${R_HOME}/bin/R" --slave -e 'library(pkgbuild); pkgbuild::compile_dll()' touch src/package-binary @@ -64,10 +74,10 @@ inst/sbc/calibration.rds : R/sysdata.rda: inst/sbc/calibration.rds "${R_HOME}/bin/R" --slave --file=tools/make-ds.R -inst/doc/RBesT.pdf : man/package-doc +inst/doc/$(RPKG).pdf : man/package-doc install -d inst/doc - "${R_HOME}/bin/R" CMD Rd2pdf --batch --no-preview --force --output=inst/doc/RBesT.pdf . - "${R_HOME}/bin/R" --vanilla --slave -e 'library(tools); tools::compactPDF("inst/doc/RBesT.pdf")' + "${R_HOME}/bin/R" CMD Rd2pdf --batch --no-preview --force --output=inst/doc/$(RPKG).pdf . + "${R_HOME}/bin/R" --vanilla --slave -e 'library(tools); tools::compactPDF("inst/doc/$(RPKG).pdf")' NAMESPACE: man/package-doc @@ -79,27 +89,27 @@ $(TARGET): build/r-source build/r-source : $(BIN_OBJS) $(DOC_OBJS) $(SRCS) install -d build cd build; "${R_HOME}/bin/R" CMD build .. --no-build-vignettes --no-manual - cd build; mv RBesT_$(PKG_VERSION).tar.gz RBesT-source.tar.gz + cd build; mv $(RPKG)_$(PKG_VERSION).tar.gz $(RPKG)-source.tar.gz touch build/r-source-fast build/r-source-release : $(BIN_OBJS) $(DOC_OBJS) $(SRCS) inst/sbc/sbc_report.html install -d build - git archive --format=tar.gz --prefix RBesT-$(GIT_TAG)/ HEAD > build/RBesT-$(GIT_TAG).tar.gz - rm -rf build/RBesT-$(GIT_TAG) - cd build; tar xf RBesT-$(GIT_TAG).tar.gz - cp -v NAMESPACE build/RBesT-$(GIT_TAG) - install -d build/RBesT-$(GIT_TAG)/inst/doc - cp -v inst/doc/RBesT.pdf build/RBesT-$(GIT_TAG)/inst/doc - cp -v inst/sbc/sbc_report.html build/RBesT-$(GIT_TAG)/inst/sbc/sbc_report.html - cd build/RBesT-$(GIT_TAG); "${R_HOME}/bin/R" --slave --file=tools/make-ds.R - install -d build/RBesT-$(GIT_TAG)/man - cp -v man/*.Rd build/RBesT-$(GIT_TAG)/man + git archive --format=tar.gz --prefix $(RPKG)-$(GIT_TAG)/ HEAD > build/$(RPKG)-$(GIT_TAG).tar.gz + rm -rf build/$(RPKG)-$(GIT_TAG) + cd build; tar xf $(RPKG)-$(GIT_TAG).tar.gz + cp -v NAMESPACE build/$(RPKG)-$(GIT_TAG) + install -d build/$(RPKG)-$(GIT_TAG)/inst/doc + cp -v inst/doc/$(RPKG).pdf build/$(RPKG)-$(GIT_TAG)/inst/doc + cp -v inst/sbc/sbc_report.html build/$(RPKG)-$(GIT_TAG)/inst/sbc/sbc_report.html + cd build/$(RPKG)-$(GIT_TAG); "${R_HOME}/bin/R" --slave --file=tools/make-ds.R + install -d build/$(RPKG)-$(GIT_TAG)/man + cp -v man/*.Rd build/$(RPKG)-$(GIT_TAG)/man # set NOT_CRAN=true to get vignettes render with full sampling - cd build; NOT_CRAN=true "${R_HOME}/bin/R" CMD build RBesT-$(GIT_TAG) - #cd build; NOT_CRAN=false "${R_HOME}/bin/R" CMD build RBesT-$(GIT_TAG) --no-build-vignettes --no-manual - rm -rf build/RBesT-$(GIT_TAG) - cd build; $(MD5) RBesT-$(GIT_TAG).tar.gz > RBesT-$(GIT_TAG).md5 - cd build; $(MD5) RBesT_$(PKG_VERSION).tar.gz > RBesT_$(PKG_VERSION).md5 + cd build; NOT_CRAN=true "${R_HOME}/bin/R" CMD build $(RPKG)-$(GIT_TAG) + #cd build; NOT_CRAN=false "${R_HOME}/bin/R" CMD build $(RPKG)-$(GIT_TAG) --no-build-vignettes --no-manual + rm -rf build/$(RPKG)-$(GIT_TAG) + cd build; $(MD5) $(RPKG)-$(GIT_TAG).tar.gz > $(RPKG)-$(GIT_TAG).md5 + cd build; $(MD5) $(RPKG)_$(PKG_VERSION).tar.gz > $(RPKG)_$(PKG_VERSION).md5 touch build/r-source-release PHONY += r-source-release @@ -108,6 +118,9 @@ r-source-release : build/r-source-release PHONY += binary binary : NAMESPACE src/package-binary +PHONY += derived +derived : NAMESPACE $(BIN_OBJS) $(DOC_OBJS) + #$(DIR_OBJ)/%.o: %.c $(INCS) # mkdir -p $(@D) # $(CC) -o $@ $(CFLAGS) -c $< $(INC_DIRS) @@ -117,12 +130,15 @@ clean: rm -rf build/* rm -f man/*.Rd rm -f NAMESPACE - rm -f inst/doc/RBesT.pdf - rm -f src/RBesT.so + rm -f inst/doc/$(RPKG).pdf + rm -f src/$(RPKG).so rm -f src/*.o rm -f man/package-doc rm -f src/package-binary rm -f R/sysdata.rda + rm -f demo/*.html + rm -f vignettes/*.html + rm -f vignettes/*.docx rm -rf .Rd2pdf* PHONY += doc diff --git a/NEWS.md b/NEWS.md index 4023ade..122273c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,18 @@ -# RBesT 1.6-5 - January 23rd, 2023 +# RBesT 1.6-6 - March 3rd, 2023 + +## Bug fixes + +* ensure C++17 compatiblity per CRAN (triggers an issue with + clang 16) +* fix links in README.md to now link to new public pkgdown web-site + +# RBesT 1.6-5 - February 8th, 2023 + +## Enhancements + +* upon package load `RBesT` will now report the date of the release + and the respective git commit hash used to create the sources of the + package. ## Bug fixes diff --git a/R/predict_gMAP.R b/R/predict_gMAP.R index 1f84685..c7cd732 100644 --- a/R/predict_gMAP.R +++ b/R/predict_gMAP.R @@ -22,6 +22,7 @@ #' #' @seealso \code{\link{gMAP}}, \code{\link{predict.glm}} #' +#' @template example-start #' @examples #' # create a fake data set with a covariate #' trans_cov <- transform(transplant, country=cut(1:11, c(0,5,8,Inf), c("CH", "US", "DE"))) @@ -57,6 +58,7 @@ #' pred_new <- predict(map, data.frame(country="CH", study=12)) #' pred_new #' +#' @template example-stop #' @rdname predict.gMAP #' @method predict gMAP #' @export diff --git a/R/sysdata.rda b/R/sysdata.rda index 24bc64b..bf74a39 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/R/zzz.R b/R/zzz.R index 694acb7..1a480f6 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -6,5 +6,5 @@ .onAttach <- function(...) { ver <- utils::packageVersion("RBesT") - packageStartupMessage("This is RBesT version ", ver) + packageStartupMessage("This is RBesT version ", ver, " (released ", format(pkg_create_date, "%F"), ", git-sha ", pkg_sha, ")") } diff --git a/README.md b/README.md index dedfb6f..719f132 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ methodology. ## Getting Started To get a quick overview over the package functionality, please refer -to the introductory [vignettes](articles/index.html). We recommend +to the introductory [vignettes](https://opensource.nibr.com/RBesT/articles/index.html). We recommend starting with the [Getting started with `RBesT` -(binary)](articles/introduction.html) vignette as a first read. +(binary)](https://opensource.nibr.com/RBesT/articles/introduction.html) vignette as a first read. diff --git a/_pkgdown.yml b/_pkgdown.yml index d97540a..f3ad3cf 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: http://opensource.nibr.com/RBesT/ +url: https://opensource.nibr.com/RBesT/ template: bootstrap: 5 diff --git a/configure b/configure index dcaa50f..626b6e8 100755 --- a/configure +++ b/configure @@ -1,5 +1,16 @@ # Generated by rstantools. Do not edit by hand. #! /bin/sh -"${R_HOME}/bin/Rscript" -e "rstantools::rstan_config()" -e 'writeLines(sub("CXX14$", "CXX17", readLines("src/Makevars")), "src/Makevars")' -e 'writeLines(sub("CXX14$", "CXX17", readLines("src/Makevars.win")), "src/Makevars.win")' +#"${R_HOME}/bin/Rscript" -e "rstantools::rstan_config()" + +"${R_HOME}/bin/Rscript" -e "rstantools::rstan_config()" \ + -e 'mv <- readLines("src/Makevars")' \ + -e 'con <- file("src/Makevars", "wb")' \ + -e 'writeLines(c(sub("^CXX_STD = CXX14$", "CXX_STD = CXX17", mv), "PKG_CPPFLAGS += -D_HAS_AUTO_PTR_ETC=0"), con=con, useBytes=TRUE)' \ + -e 'close(con)' \ + -e 'mv_win <- readLines("src/Makevars.win")' \ + -e 'con_win <- file("src/Makevars.win", "wb")' \ + -e 'writeLines(c(sub("^CXX_STD = CXX14$", "CXX_STD17 = CXX17", mv_win), "PKG_CPPFLAGS += -D_HAS_AUTO_PTR_ETC=0"), con=con_win, useBytes=TRUE)' \ + -e 'close(con_win)' + diff --git a/configure.win b/configure.win index 6c63f63..3be5a7b 100755 --- a/configure.win +++ b/configure.win @@ -1,4 +1,14 @@ # Generated by rstantools. Do not edit by hand. #! /bin/sh -"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rstantools::rstan_config()" -e 'writeLines(sub("CXX14$", "CXX17", readLines("src/Makevars")), "src/Makevars")' -e 'writeLines(sub("CXX14$", "CXX17", readLines("src/Makevars.win")), "src/Makevars.win")' +#"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rstantools::rstan_config()" + +"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rstantools::rstan_config()" \ + -e 'mv <- readLines("src/Makevars")' \ + -e 'con <- file("src/Makevars", "wb")' \ + -e 'writeLines(c(sub("^CXX_STD = CXX14$", "CXX_STD = CXX17", mv), "PKG_CPPFLAGS += -D_HAS_AUTO_PTR_ETC=0"), con=con, useBytes=TRUE)' \ + -e 'close(con)' \ + -e 'mv_win <- readLines("src/Makevars.win")' \ + -e 'con_win <- file("src/Makevars.win", "wb")' \ + -e 'writeLines(c(sub("^CXX_STD = CXX14$", "CXX_STD = CXX17", mv_win), "PKG_CPPFLAGS += -D_HAS_AUTO_PTR_ETC=0"), con=con, useBytes=TRUE)' \ + -e 'close(con_win)' diff --git a/man/decision1S.Rd b/man/decision1S.Rd index ddfc6b4..dbdc976 100644 --- a/man/decision1S.Rd +++ b/man/decision1S.Rd @@ -60,10 +60,10 @@ boundary, OC or PoS calculations using \code{\link{oc1S}} or } \section{Functions}{ \itemize{ -\item \code{oc1Sdecision}: Deprecated old function name. Please use +\item \code{oc1Sdecision()}: Deprecated old function name. Please use \code{decision1S} instead. -}} +}} \examples{ # see Neuenschwander et al., 2011 diff --git a/man/decision1S_boundary.Rd b/man/decision1S_boundary.Rd index a231d81..7cc2e93 100644 --- a/man/decision1S_boundary.Rd +++ b/man/decision1S_boundary.Rd @@ -67,10 +67,10 @@ aligned with the cumulative density function definition within R } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Applies for binomial model with a mixture +\item \code{decision1S_boundary(betaMix)}: Applies for binomial model with a mixture beta prior. The calculations use exact expressions. -\item \code{normMix}: Applies for the normal model with known +\item \code{decision1S_boundary(normMix)}: Applies for the normal model with known standard deviation \eqn{\sigma} and a normal mixture prior for the mean. As a consequence from the assumption of a known standard deviation, the calculation discards sampling uncertainty of the @@ -79,13 +79,13 @@ argument \code{eps} (defaults to \eqn{10^{-6}}). The critical value \eqn{y_c} is searched in the region of probability mass \code{1-eps} for \eqn{y}. -\item \code{gammaMix}: Applies for the Poisson model with a gamma +\item \code{decision1S_boundary(gammaMix)}: Applies for the Poisson model with a gamma mixture prior for the rate parameter. The function \code{decision1S_boundary} takes an extra argument \code{eps} (defaults to \eqn{10^{-6}}) which determines the region of probability mass \code{1-eps} where the boundary is searched for \eqn{y}. -}} +}} \examples{ # non-inferiority example using normal approximation of log-hazard diff --git a/man/decision2S.Rd b/man/decision2S.Rd index 5fa5171..11d4cd9 100644 --- a/man/decision2S.Rd +++ b/man/decision2S.Rd @@ -84,10 +84,10 @@ quantiles \code{qc} must be given on the transformed scale. } \section{Functions}{ \itemize{ -\item \code{oc2Sdecision}: Deprecated old function name. Please use +\item \code{oc2Sdecision()}: Deprecated old function name. Please use \code{decision2S} instead. -}} +}} \examples{ # see Gsponer et al., 2010 diff --git a/man/decision2S_boundary.Rd b/man/decision2S_boundary.Rd index fdc0b50..68b6054 100644 --- a/man/decision2S_boundary.Rd +++ b/man/decision2S_boundary.Rd @@ -87,7 +87,7 @@ y_{2,i}} and for the normal case as the mean \eqn{\bar{y}_2 = 1/n_2 } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Applies for binomial model with a mixture +\item \code{decision2S_boundary(betaMix)}: Applies for binomial model with a mixture beta prior. The calculations use exact expressions. If the optional argument \code{eps} is defined, then an approximate method is used which limits the search for the decision boundary to the @@ -95,7 +95,7 @@ region of \code{1-eps} probability mass. This is useful for designs with large sample sizes where an exact approach is very costly to calculate. -\item \code{normMix}: Applies for the normal model with known +\item \code{decision2S_boundary(normMix)}: Applies for the normal model with known standard deviation \eqn{\sigma} and normal mixture priors for the means. As a consequence from the assumption of a known standard deviation, the calculation discards sampling uncertainty of the @@ -109,13 +109,13 @@ is determined by a spacing with \eqn{\delta_2 = at the discrete steps, a spline is used to inter-polate the decision boundary at intermediate points. -\item \code{gammaMix}: Applies for the Poisson model with a gamma +\item \code{decision2S_boundary(gammaMix)}: Applies for the Poisson model with a gamma mixture prior for the rate parameter. The function \code{decision2S_boundary} takes an extra argument \code{eps} (defaults to \eqn{10^{-6}}) which determines the region of probability mass \code{1-eps} where the boundary is searched for \eqn{y_1} and \eqn{y_2}, respectively. -}} +}} \examples{ # see ?decision2S for details of example diff --git a/man/ess.Rd b/man/ess.Rd index 056bd00..e277ae9 100644 --- a/man/ess.Rd +++ b/man/ess.Rd @@ -73,13 +73,13 @@ restrict the ESS to be an integer. } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: ESS for beta mixtures. +\item \code{ess(betaMix)}: ESS for beta mixtures. -\item \code{gammaMix}: ESS for gamma mixtures. +\item \code{ess(gammaMix)}: ESS for gamma mixtures. -\item \code{normMix}: ESS for normal mixtures. -}} +\item \code{ess(normMix)}: ESS for normal mixtures. +}} \section{Supported Conjugate Prior-Likelihood Pairs}{ diff --git a/man/gMAP.Rd b/man/gMAP.Rd index 9a2c5e5..ee9055d 100644 --- a/man/gMAP.Rd +++ b/man/gMAP.Rd @@ -16,8 +16,8 @@ gMAP( weights, offset, tau.strata, - tau.dist = c("HalfNormal", "TruncNormal", "Uniform", "Gamma", "InvGamma", - "LogNormal", "TruncCauchy", "Exp", "Fixed"), + tau.dist = c("HalfNormal", "TruncNormal", "Uniform", "Gamma", "InvGamma", "LogNormal", + "TruncCauchy", "Exp", "Fixed"), tau.prior, tau.strata.pred = 1, beta.prior, @@ -252,19 +252,19 @@ exposure unit must be given as log-offset.} } \section{Methods (by generic)}{ \itemize{ -\item \code{print}: displays a summary of the gMAP analysis. +\item \code{print(gMAP)}: displays a summary of the gMAP analysis. -\item \code{fitted}: returns the quantiles of the posterior shrinkage +\item \code{fitted(gMAP)}: returns the quantiles of the posterior shrinkage estimates for each data item used during the analysis of the given \code{gMAP} object. -\item \code{coef}: returns the quantiles of the predictive +\item \code{coef(gMAP)}: returns the quantiles of the predictive distribution. User can choose with \code{type} if the result is on the response or the link scale. -\item \code{as.matrix}: extracts the posterior sample of the model. +\item \code{as.matrix(gMAP)}: extracts the posterior sample of the model. -\item \code{summary}: returns the summaries of a gMAP. +\item \code{summary(gMAP)}: returns the summaries of a gMAP. analysis. Output is a \code{gMAPsummary} object, which is a list containing \describe{ \item{\code{tau}}{posterior summary of the heterogeneity standard deviation} @@ -272,8 +272,8 @@ analysis. Output is a \code{gMAPsummary} object, which is a list containing \item{\code{theta.pred}}{summary of the predictive distribution (given in dependence on the \code{type} argument either on \code{response} or \code{link} scale)} \item{\code{theta}}{posterior summary of the mean estimate (also depends on the \code{type} argument)} } -}} +}} \section{Differential Discounting}{ diff --git a/man/mixfit.Rd b/man/mixfit.Rd index 60fd3ba..0a418e5 100644 --- a/man/mixfit.Rd +++ b/man/mixfit.Rd @@ -74,10 +74,10 @@ alleviate the issue. } \section{Methods (by class)}{ \itemize{ -\item \code{default}: Performs an EM fit for the given +\item \code{mixfit(default)}: Performs an EM fit for the given sample. Thinning is applied only if thin is specified. -\item \code{gMAP}: Fits the default predictive distribution from a +\item \code{mixfit(gMAP)}: Fits the default predictive distribution from a gMAP analysis. Automatically obtains the predictive distribution of the intercept only case on the response scale mixture from the \code{\link{gMAP}} object. For the binomial case a beta mixture, @@ -86,17 +86,17 @@ gamma mixture will be used. In the gaussian case, the resulting normal mixture will set the reference scale to the estimated sigma in \code{\link{gMAP}} call. -\item \code{gMAPpred}: Fits a mixture density for each prediction from +\item \code{mixfit(gMAPpred)}: Fits a mixture density for each prediction from the \code{\link{gMAP}} prediction. -\item \code{array}: Fits a mixture density for an MCMC sample. It is +\item \code{mixfit(array)}: Fits a mixture density for an MCMC sample. It is recommended to provide a thinning argument which roughly yields independent draws (i.e. use \code{\link{acf}} to identify a thinning lag with small auto-correlation). The input array is expected to have 3 dimensions which are nested as iterations, chains, and draws. -}} +}} \examples{ bmix <- mixbeta(rob=c(0.2, 1, 1), inf=c(0.8, 10, 2)) diff --git a/man/mixnorm.Rd b/man/mixnorm.Rd index 169ab44..596aa7f 100644 --- a/man/mixnorm.Rd +++ b/man/mixnorm.Rd @@ -75,9 +75,9 @@ functions which require a reference scale. } \section{Functions}{ \itemize{ -\item \code{sigma<-}: Allows to assign a new reference scale \code{sigma}. -}} +\item \code{sigma(object) <- value}: Allows to assign a new reference scale \code{sigma}. +}} \examples{ nm <- mixnorm(rob=c(0.2, 0, 2), inf=c(0.8, 2, 2), sigma=5) diff --git a/man/oc1S.Rd b/man/oc1S.Rd index 2446c36..c1797da 100644 --- a/man/oc1S.Rd +++ b/man/oc1S.Rd @@ -64,10 +64,10 @@ calculated the desired frequency which is evaluated as } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Applies for binomial model with a mixture +\item \code{oc1S(betaMix)}: Applies for binomial model with a mixture beta prior. The calculations use exact expressions. -\item \code{normMix}: Applies for the normal model with known +\item \code{oc1S(normMix)}: Applies for the normal model with known standard deviation \eqn{\sigma} and a normal mixture prior for the mean. As a consequence from the assumption of a known standard deviation, the calculation discards sampling uncertainty of the @@ -76,13 +76,13 @@ argument \code{eps} (defaults to \eqn{10^{-6}}). The critical value \eqn{y_c} is searched in the region of probability mass \code{1-eps} for \eqn{y}. -\item \code{gammaMix}: Applies for the Poisson model with a gamma +\item \code{oc1S(gammaMix)}: Applies for the Poisson model with a gamma mixture prior for the rate parameter. The function \code{oc1S} takes an extra argument \code{eps} (defaults to \eqn{10^{-6}}) which determines the region of probability mass \code{1-eps} where the boundary is searched for \eqn{y}. -}} +}} \examples{ # non-inferiority example using normal approximation of log-hazard diff --git a/man/oc2S.Rd b/man/oc2S.Rd index 7e7a293..a817d1f 100644 --- a/man/oc2S.Rd +++ b/man/oc2S.Rd @@ -87,7 +87,7 @@ priors. } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Applies for binomial model with a mixture +\item \code{oc2S(betaMix)}: Applies for binomial model with a mixture beta prior. The calculations use exact expressions. If the optional argument \code{eps} is defined, then an approximate method is used which limits the search for the decision boundary to the @@ -95,7 +95,7 @@ region of \code{1-eps} probability mass. This is useful for designs with large sample sizes where an exact approach is very costly to calculate. -\item \code{normMix}: Applies for the normal model with known +\item \code{oc2S(normMix)}: Applies for the normal model with known standard deviation \eqn{\sigma} and normal mixture priors for the means. As a consequence from the assumption of a known standard deviation, the calculation discards sampling uncertainty of the @@ -109,13 +109,13 @@ is determined by a spacing with \eqn{\delta_2 = at the discrete steps, a spline is used to inter-polate the decision boundary at intermediate points. -\item \code{gammaMix}: Applies for the Poisson model with a gamma +\item \code{oc2S(gammaMix)}: Applies for the Poisson model with a gamma mixture prior for the rate parameter. The function \code{oc2S} takes an extra argument \code{eps} (defaults to \eqn{10^{-6}}) which determines the region of probability mass \code{1-eps} where the boundary is searched for \eqn{y_1} and \eqn{y_2}, respectively. -}} +}} \examples{ # example from Schmidli et al., 2014 diff --git a/man/pos1S.Rd b/man/pos1S.Rd index 156f592..fb18882 100644 --- a/man/pos1S.Rd +++ b/man/pos1S.Rd @@ -66,10 +66,10 @@ distribution of the parameter \eqn{\theta}. The distribution } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Applies for binomial model with a mixture +\item \code{pos1S(betaMix)}: Applies for binomial model with a mixture beta prior. The calculations use exact expressions. -\item \code{normMix}: Applies for the normal model with known +\item \code{pos1S(normMix)}: Applies for the normal model with known standard deviation \eqn{\sigma} and a normal mixture prior for the mean. As a consequence from the assumption of a known standard deviation, the calculation discards sampling uncertainty of the @@ -78,13 +78,13 @@ argument \code{eps} (defaults to \eqn{10^{-6}}). The critical value \eqn{y_c} is searched in the region of probability mass \code{1-eps} for \eqn{y}. -\item \code{gammaMix}: Applies for the Poisson model with a gamma +\item \code{pos1S(gammaMix)}: Applies for the Poisson model with a gamma mixture prior for the rate parameter. The function \code{pos1S} takes an extra argument \code{eps} (defaults to \eqn{10^{-6}}) which determines the region of probability mass \code{1-eps} where the boundary is searched for \eqn{y}. -}} +}} \examples{ # non-inferiority example using normal approximation of log-hazard diff --git a/man/pos2S.Rd b/man/pos2S.Rd index 1bbf2d9..4e3f026 100644 --- a/man/pos2S.Rd +++ b/man/pos2S.Rd @@ -99,7 +99,7 @@ calculation are as for the 2-sample operating characteristics, see } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Applies for binomial model with a mixture +\item \code{pos2S(betaMix)}: Applies for binomial model with a mixture beta prior. The calculations use exact expressions. If the optional argument \code{eps} is defined, then an approximate method is used which limits the search for the decision boundary to the @@ -107,7 +107,7 @@ region of \code{1-eps} probability mass. This is useful for designs with large sample sizes where an exact approach is very costly to calculate. -\item \code{normMix}: Applies for the normal model with known +\item \code{pos2S(normMix)}: Applies for the normal model with known standard deviation \eqn{\sigma} and normal mixture priors for the means. As a consequence from the assumption of a known standard deviation, the calculation discards sampling uncertainty of the @@ -121,13 +121,13 @@ is determined by a spacing with \eqn{\delta_2 = at the discrete steps, a spline is used to inter-polate the decision boundary at intermediate points. -\item \code{gammaMix}: Applies for the Poisson model with a gamma +\item \code{pos2S(gammaMix)}: Applies for the Poisson model with a gamma mixture prior for the rate parameter. The function \code{pos2S} takes an extra argument \code{eps} (defaults to \eqn{10^{-6}}) which determines the region of probability mass \code{1-eps} where the boundary is searched for \eqn{y_1} and \eqn{y_2}, respectively. -}} +}} \examples{ # see ?decision2S for details of example diff --git a/man/postmix.Rd b/man/postmix.Rd index b972ab7..0f3ae95 100644 --- a/man/postmix.Rd +++ b/man/postmix.Rd @@ -80,13 +80,13 @@ implemented conjugate mixture prior densities. } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Calculates the posterior beta mixture +\item \code{postmix(betaMix)}: Calculates the posterior beta mixture distribution. The individual data vector is expected to be a vector of 0 and 1, i.e. a series of Bernoulli experiments. Alternatively, the sufficient statistics \code{n} and \code{r} can be given, i.e. number of trials and successes, respectively. -\item \code{normMix}: Calculates the posterior normal mixture +\item \code{postmix(normMix)}: Calculates the posterior normal mixture distribution with the sampling likelihood being a normal with fixed standard deviation. Either an individual data vector \code{data} can be given or the sufficient statistics which are the standard @@ -98,11 +98,11 @@ given, then the reference scale of the prior is updated; however it is recommended to use the command \code{\link{sigma}} to set the reference standard deviation. -\item \code{gammaMix}: Calculates the posterior gamma mixture +\item \code{postmix(gammaMix)}: Calculates the posterior gamma mixture distribution for Poisson and exponential likelihoods. Only the Poisson case is supported in this version. -}} +}} \section{Supported Conjugate Prior-Likelihood Pairs}{ diff --git a/man/preddist.Rd b/man/preddist.Rd index 7ea8f14..d12d2ed 100644 --- a/man/preddist.Rd +++ b/man/preddist.Rd @@ -54,18 +54,18 @@ it is the mean\eqn{\bar{y}_n = 1/n \sum_{i=1}^n y_i}. } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: Obtain the matching predictive distribution +\item \code{preddist(betaMix)}: Obtain the matching predictive distribution for a beta distribution, the BetaBinomial. -\item \code{normMix}: Obtain the matching predictive distribution +\item \code{preddist(normMix)}: Obtain the matching predictive distribution for a Normal with constant standard deviation. Note that the reference scale of the returned Normal mixture is meaningless as the individual components are updated appropriatley. -\item \code{gammaMix}: Obtain the matching predictive distribution +\item \code{preddist(gammaMix)}: Obtain the matching predictive distribution for a Gamma. Only Poisson likelihoods are supported. -}} +}} \section{Supported Conjugate Prior-Likelihood Pairs}{ diff --git a/man/robustify.Rd b/man/robustify.Rd index bc19081..7932f06 100644 --- a/man/robustify.Rd +++ b/man/robustify.Rd @@ -56,7 +56,7 @@ given. } \section{Methods (by class)}{ \itemize{ -\item \code{betaMix}: The default \code{mean} is set to 1/2 which +\item \code{robustify(betaMix)}: The default \code{mean} is set to 1/2 which represents no difference between the occurrence rates for one of the two outcomes. As the uniform \code{Beta(1,1)} is more appropriate in practical applications, \code{RBesT} uses \code{n+1} as the sample @@ -64,17 +64,17 @@ size such that the default robust prior is the uniform instead of the \code{Beta(1/2,1/2)} which strictly defined would be the unit information prior in this case. -\item \code{gammaMix}: The default \code{mean} is set to the mean of the +\item \code{robustify(gammaMix)}: The default \code{mean} is set to the mean of the prior mixture. It is strongly recommended to explicitly set the mean to the location of the null hypothesis. -\item \code{normMix}: The default \code{mean} is set to the mean +\item \code{robustify(normMix)}: The default \code{mean} is set to the mean of the prior mixture. It is strongly recommended to explicitly set the mean to the location of the null hypothesis, which is very often equal to 0. It is also recommended to explicitly set the sampling standard deviation using the \code{sigma} argument. -}} +}} \examples{ bmix <- mixbeta(inf1=c(0.2, 8, 3), inf2=c(0.8, 10, 2)) plot(bmix) diff --git a/tools/make-ds.R b/tools/make-ds.R index 0d2d8a8..5466d82 100644 --- a/tools/make-ds.R +++ b/tools/make-ds.R @@ -43,11 +43,17 @@ make_internal_ds <- function() { calibration_meta["MD5"] <- vals["MD5"] pkg_create_date <- Sys.time() + pkg_sha <- "37f2dcd" + + if (gsub("\\$", "", pkg_sha) == "Format:%h") { + pkg_sha <- system("git rev-parse --short HEAD", intern=TRUE) + } use_data( calibration_data, calibration_meta, pkg_create_date, + pkg_sha, internal=TRUE, overwrite=TRUE) }