https://github.com/jan-imbi/adestr
Point estimates, confidence intervals and p-values for adaptive two-stage designs with planned adaptivity.
https://github.com/jan-imbi/adestr
adaptive adoptr confidence designs estimation intervals optimal parameter point two-stage
Last synced: about 2 months ago
JSON representation
Point estimates, confidence intervals and p-values for adaptive two-stage designs with planned adaptivity.
- Host: GitHub
- URL: https://github.com/jan-imbi/adestr
- Owner: jan-imbi
- License: gpl-2.0
- Created: 2023-04-04T08:31:27.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-12T13:15:14.000Z (over 1 year ago)
- Last Synced: 2025-12-09T10:58:56.362Z (4 months ago)
- Topics: adaptive, adoptr, confidence, designs, estimation, intervals, optimal, parameter, point, two-stage
- Language: R
- Homepage: https://jan-imbi.github.io/adestr/
- Size: 35.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
[](https://doi.org/10.1002/sim.10020
)
[](https://github.com/jan-imbi/adestr/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/jan-imbi/adestr?branch=master)
[](https://github.com/jan-imbi/adestr/blob/master/LICENSE.md)
This package implements methods to evaluate the performance characteristics
of various point and interval estimators for adaptive two-stage designs with
prespecified sample-size recalculation rules. Further, it allows for
evaluation of these estimators on real datasets, and it implements methods
to calculate p-values.
Currently, it works for designs objects which were produced by the
R-package [`adoptr`](https://github.com/optad/adoptr), which calculates optimal design parameters adaptive
two-stage designs.
An introductory vignette covering common usecases is given at [https://jan-imbi.github.io/adestr/articles/Introduction.html](https://jan-imbi.github.io/adestr/articles/Introduction.html).
This package comes suite of unit tests. The code of the test cases can be viewed here: [https://github.com/jan-imbi/adestr/tree/master/tests/testthat](https://github.com/jan-imbi/adestr/tree/master/tests/testthat). The authors assume no responsibility for the correctness of the
code or results produced by its usage. Use at your own risk.
You may also be interested in the reference implementation looking at the [https://github.com/jan-imbi/adestr/blob/master/R/reference_implementation.R](https://github.com/jan-imbi/adestr/blob/master/R/reference_implementation.R).
It uses the same notation as in our paper ([doi.org/10.1002/sim.10020](https://doi.org/10.1002/sim.10020)) and may therefore be
easier to understand at first.
## Installation
You can install the development version of adestr by typing
```{r, eval=FALSE}
remotes::install_github("https://github.com/jan-imbi/adestr")
```
into your R console.
## Small introductory example
Here is a quick example showing the capabilities of `adestr`.
First, load `adestr`:
```{r}
library(adestr)
```
Then, you can evaluate the performance of an estimator like this:
```{r, fig.width=7.2, fig.height=4, dev="svg"}
evaluate_estimator(
score = MSE(),
estimator = SampleMean(),
data_distribution = Normal(two_armed = TRUE),
design = get_example_design(),
mu = c(0, 0.3, 0.6),
sigma = 1
)
evaluate_estimator(
score = MSE(),
estimator = SampleMean(),
data_distribution = Normal(two_armed = TRUE),
design = get_example_design(),
mu = seq(-0.7, 1.5, .05),
sigma = 1
) |>
plot()
```
You can analyze a dataset like this:
```{r}
set.seed(321)
dat <- data.frame(
endpoint = c(rnorm(28, .2, 1), rnorm(28, 0, 1),
rnorm(23, .2, 1), rnorm(23, 0, 1)),
group = factor(rep(c("ctl", "trt", "ctl", "trt"),
c(28,28,23,23))),
stage = rep(c(1L, 2L), c(56, 46))
)
analyze(
data = dat,
statistics = get_example_statistics(),
data_distribution = Normal(two_armed = TRUE),
sigma = 1,
design = get_example_design()
)
```
Please refer to [https://jan-imbi.github.io/adestr/articles/Introduction.html](https://jan-imbi.github.io/adestr/articles/Introduction.html) for a more detailed introduction.
