Skip to content

Commit

Permalink
Prepare new CRAN release
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-imbi committed Jul 9, 2024
1 parent c2addc7 commit 5ff20d4
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
^.lintr$
^vignettes/presentation_onearm$
^README\.Rmd$
^doc$
^Meta$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ docs
.lintr
paper
paper_testing_vs_estimation
/doc/
/Meta/
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: adestr
Type: Package
Title: Estimation in Optimal Adaptive Two-Stage Designs
Version: 0.5.1
Version: 0.5.2
Authors@R:c(person("Jan", "Meis", role = c("aut", "cre"), email = "meis@imbi.uni-heidelberg.de", comment = c(ORCID = "0000-0001-5407-7220")),
person("Martin", "Maechler", role = c("cph"), email = "maechler@stat.math.ethz.ch", comment = c(ORCID = "0000-0002-8685-9910", "Original author of monoSpl.c (from the 'stats' package).")))
Description:
Expand Down
2 changes: 2 additions & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nocov start
#' Plot performance scores for point and interval estimators
#'
#' This function extract the values of mu and the score values and a facet plot with
Expand Down Expand Up @@ -457,3 +458,4 @@ plot_design <- function(design, data_distribution = Normal(two_armed = FALSE)){
labs(color = "Type of design")
ggarrange(pltn, pltc2, pltcp, ncol=3, common.legend = TRUE)
}
#nocov end
2 changes: 2 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ knitr::opts_chunk$set(
# adestr <a href='https://github.com/jan-imbi/adestr'><img src='man/figures/sticker.png' align="right" height="80" /></a>

<!-- badges: start -->
[![doi](https://img.shields.io/badge/doi-10.1002%2Fsim.10020-blue?link=https%3A%2F%2Fdoi.org%2F10.1002%2Fsim.10020)](https://doi.org/10.1002/sim.10020
)
[![R-CMD-check](https://github.com/jan-imbi/adestr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jan-imbi/adestr/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/jan-imbi/adestr/branch/master/graph/badge.svg?token=ORYWTYOZPT)](https://app.codecov.io/gh/jan-imbi/adestr?branch=master)
[![License](https://img.shields.io/badge/License-GPL_v2-blue.svg)](https://github.com/jan-imbi/adestr/blob/master/LICENSE.md)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<!-- badges: start -->

[![doi](https://img.shields.io/badge/doi-10.1002%2Fsim.10020-blue?link=https%3A%2F%2Fdoi.org%2F10.1002%2Fsim.10020)](https://doi.org/10.1002/sim.10020)
[![R-CMD-check](https://github.com/jan-imbi/adestr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jan-imbi/adestr/actions/workflows/R-CMD-check.yaml)
[![Codecov test
coverage](https://codecov.io/gh/jan-imbi/adestr/branch/master/graph/badge.svg?token=ORYWTYOZPT)](https://app.codecov.io/gh/jan-imbi/adestr?branch=master)
Expand Down
17 changes: 17 additions & 0 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
citHeader("To cite OptimalGoldstandardDesigns in publications use:")

bibentry(
bibtype = "Article",
author = as.person("Jan Meis, Maximilian Pilz, Carolin Herrmann, Björn Bokelmann, Geraldine Rauch, Meinhard Kieser"),
title = "Point estimation, confidence intervals, and P-values for optimal adaptive two-stage designs with normal endpoints",
journal = "Statistics in Medicine",
volume = "43",
number = "8",
pages = "1577-1603",
keywords = "bias, confidence intervals, optimal adaptive designs, P-values, point estimation",
doi = "10.1002/sim.10020",
year = {2024},
textVersion = paste(
"Meis, J, Pilz, M, Herrmann, C, Bokelmann, B, Rauch, G, Kieser, M. Point estimation, confidence intervals, and P-values for optimal adaptive two-stage designs with normal endpoints. Statistics in Medicine. 2024; 43(8): 1577–1603. doi:10.1002/sim.10020"
)
)
42 changes: 21 additions & 21 deletions tests/testthat/test_LR_boundaries.R
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# test_that("implicit rejection boundary from Neyman-Pearson test matches c2",
# {
# p2 <- get_stagewise_estimators(NeymanPearsonOrderingPValue(0, 0.4),
# Normal(FALSE),
# FALSE,
# designad,
# 1,
# FALSE)[[2]]
# expect_equal(
# implied_c2(
# designad,
# adoptr:::scaled_integration_pivots(designad),
# p2,
# 1,
# FALSE,
# 0.025
# ),
# designad@c2_pivots,
# tolerance = 1e-3
# )
# })
test_that("implicit rejection boundary from Neyman-Pearson test matches c2",
{
p2 <- get_stagewise_estimators(NeymanPearsonOrderingPValue(0, 0.4),
Normal(FALSE),
FALSE,
designad,
1,
FALSE)[[2]]
expect_equal(
implied_c2(
designad,
adoptr:::scaled_integration_pivots(designad),
p2,
1,
FALSE,
0.025
),
designad@c2_pivots,
tolerance = 1e-3
)
})
86 changes: 43 additions & 43 deletions tests/testthat/test_against_reference.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,49 +55,49 @@ test_that("bias reduced estimator agrees with reference implementation.",
sw$g2(designad, .3, .3, designad@n1, n2_extrapol(designad, smean_to_z(.3, designad@n1, 1, FALSE)), 1, FALSE),
tolerance = 1e-3)
})
# test_that("median unbiased (MLE ordering) estimator agrees with reference implementation.",
# {
# med <- get_stagewise_estimators(MedianUnbiasedMLEOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
# expect_equal(.median_unbiased_ml(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
# med$g2(designad, .2, .2, designad@n1, n2(designad, smean_to_z(.2, designad@n1, 1, FALSE), round = FALSE), 1, FALSE),
# tolerance = 1e-3)
# })
# test_that("median unbiased (LR ordering) estimator agrees with reference implementation.",
# {
# med <- get_stagewise_estimators(MedianUnbiasedLikelihoodRatioOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
# expect_equal(.median_unbiased_lr(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
# med$g2(designad, .2, .2, designad@n1, n2(designad, smean_to_z(.2, designad@n1, 1, FALSE), round = FALSE), 1, FALSE),
# tolerance = 1e-3)
# })
# test_that("median unbiased (ST ordering) estimator agrees with reference implementation.",
# {
# med <- get_stagewise_estimators(MedianUnbiasedScoreTestOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
# expect_equal(.median_unbiased_st(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
# med$g2(designad, .2, .2, designad@n1, n2(designad, smean_to_z(.2, designad@n1, 1, FALSE), round = FALSE), 1, FALSE),
# tolerance = 1e-3)
# })
# test_that("median unbiased (SWCF ordering) estimator agrees with reference implementation.",
# {
# med <- get_stagewise_estimators(MedianUnbiasedStagewiseCombinationFunctionOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
# expect_equal(.median_unbiased_swcf(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
# med$g2(designad, .2, .2, designad@n1, n2(designad, smean_to_z(.2, designad@n1, 1, FALSE), round = FALSE), 1, FALSE),
# tolerance = 1e-3)
# })
# test_that("median unbiased (SWCF ordering) estimator agrees with reference implementation.",
# {
# p <- get_stagewise_estimators(NeymanPearsonOrderingPValue(0, 0.4), Normal(FALSE), FALSE, designad, 1, FALSE)
# expect_equal(.p_np(x1 = .2, x2 = .2, mu = 0, mu0 = 0, mu1 = .4, sigma = 1, design = designad),
# p$g2(designad, .2, .2, designad@n1, n2(designad, smean_to_z(.2, designad@n1, 1, FALSE), round = FALSE), 1, FALSE),
# tolerance = 1e-3)
# })
# test_that("P-value (Neyman-Pearson ordering) agrees with reference implementation.",
# {
# p <- get_stagewise_estimators(NeymanPearsonOrderingPValue(0, 0.4), Normal(FALSE), FALSE, designad, 1, FALSE)
# expect_equal(.p_np(x1 = .2, x2 = .2, mu = 0, mu0 = 0, mu1 = .4, sigma = 1, design = designad),
# p$g2(designad, .2, .2, designad@n1, n2(designad, smean_to_z(.2, designad@n1, 1, FALSE), round = FALSE), 1, FALSE),
# tolerance = 1e-3)
# })
#
test_that("median unbiased (MLE ordering) estimator agrees with reference implementation.",
{
med <- get_stagewise_estimators(MedianUnbiasedMLEOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
expect_equal(.median_unbiased_ml(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
med$g2(designad, .2, .2, designad@n1, n2_extrapol(designad, smean_to_z(.2, designad@n1, 1, FALSE)), 1, FALSE),
tolerance = 1e-3)
})
test_that("median unbiased (LR ordering) estimator agrees with reference implementation.",
{
med <- get_stagewise_estimators(MedianUnbiasedLikelihoodRatioOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
expect_equal(.median_unbiased_lr(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
med$g2(designad, .2, .2, designad@n1, n2_extrapol(designad, smean_to_z(.2, designad@n1, 1, FALSE)), 1, FALSE),
tolerance = 1e-3)
})
test_that("median unbiased (ST ordering) estimator agrees with reference implementation.",
{
med <- get_stagewise_estimators(MedianUnbiasedScoreTestOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
expect_equal(.median_unbiased_st(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
med$g2(designad, .2, .2, designad@n1, n2_extrapol(designad, smean_to_z(.2, designad@n1, 1, FALSE)), 1, FALSE),
tolerance = 1e-3)
})
test_that("median unbiased (SWCF ordering) estimator agrees with reference implementation.",
{
med <- get_stagewise_estimators(MedianUnbiasedStagewiseCombinationFunctionOrdering(), Normal(FALSE), FALSE, designad, 1, FALSE)
expect_equal(.median_unbiased_swcf(x1 = .2, x2 = .2, mu0 = 0, sigma = 1, designad),
med$g2(designad, .2, .2, designad@n1, n2_extrapol(designad, smean_to_z(.2, designad@n1, 1, FALSE)), 1, FALSE),
tolerance = 1e-3)
})
test_that("median unbiased (SWCF ordering) estimator agrees with reference implementation.",
{
p <- get_stagewise_estimators(NeymanPearsonOrderingPValue(0, 0.4), Normal(FALSE), FALSE, designad, 1, FALSE)
expect_equal(.p_np(x1 = .2, x2 = .2, mu = 0, mu0 = 0, mu1 = .4, sigma = 1, design = designad),
p$g2(designad, .2, .2, designad@n1, n2_extrapol(designad, smean_to_z(.2, designad@n1, 1, FALSE)),0, 1, FALSE),
tolerance = 1e-3)
})
test_that("P-value (Neyman-Pearson ordering) agrees with reference implementation.",
{
p <- get_stagewise_estimators(NeymanPearsonOrderingPValue(0, 0.4), Normal(FALSE), FALSE, designad, 1, FALSE)
expect_equal(.p_np(x1 = .2, x2 = .2, mu = 0, mu0 = 0, mu1 = .4, sigma = 1, design = designad),
p$g2(designad, .2, .2, designad@n1, n2_extrapol(designad, smean_to_z(.2, designad@n1, 1, FALSE)),0, 1, FALSE),
tolerance = 1e-3)
})




0 comments on commit 5ff20d4

Please sign in to comment.