Skip to content

Added optimal conditional error function design support#93

Open
morten-dreher wants to merge 27 commits intorpact-com:dev/optimalfrom
morten-dreher:dev
Open

Added optimal conditional error function design support#93
morten-dreher wants to merge 27 commits intorpact-com:dev/optimalfrom
morten-dreher:dev

Conversation

@morten-dreher
Copy link
Copy Markdown

No description provided.

Provides print(), plot() and summary() functions for objects of class TrialDesignOptimalConditionalError
Parameters that are unique to the optimal conditional error design function suite have the "OCEF" suffix in their names. Some trailing spaces removed by styling
This is an interim solution as the original power results class will not be implemented
The conditional power effect can still be specified on the non-centrality parameter scale as before, but this is now a hidden feature and package documentation no longer describes this behaviour
Formerly incorrect @template tags now replaced with @inheritParams
Formerly incorrect @template now replaced by @inheritParams
…elated decision logic

Designs with constraints now always use basic integration. Added an option to enforce basic integration.
@fpahlke fpahlke requested a review from Copilot August 8, 2025 06:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive support for optimal conditional error function designs to a statistical package. The optimal conditional error function approach allows for adaptive sample size re-estimation in clinical trials while maintaining strict type I error control.

Key changes include:

  • Implementation of a complete design framework for optimal conditional error functions with various likelihood ratio distributions
  • Addition of utility functions for calculating conditional errors, second-stage information, and overall power
  • Comprehensive test suite covering different scenarios and edge cases

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/testthat/test-*.R Six new test files providing comprehensive coverage of the optimal conditional error functionality
tests/testthat/.gitignore Removes exclusion of R test files to include the new tests
R/parameter_descriptions.R Adds extensive parameter documentation for the optimal conditional error design functions
R/f_design_optimal_utilities.R Implements print, plot, and summary methods for the optimal conditional error design class
R/f_design_optimal_user.R Provides main user-facing functions for creating designs and calculating key metrics
R/f_design_optimal_background.R Contains internal helper functions for calculations and mathematical operations
R/class_design_optimal.R Defines the R6 class structure for optimal conditional error trial designs
Comments suppressed due to low confidence (1)

R/f_design_optimal_background.R:353

  • In the mathematical formula comment above, there's an inconsistency. The formula shows \kappa but the variable name is \eta. The code uses 'nonCentralityParameter' which corresponds to \eta, so the formula comment should use \eta consistently.
#'          \deqn{l(p_1) = \eta \cdot \sqrt{2\pi} \cdot e^{(\Phi^{-1}(1-p_1)-\eta)^2/2} \cdot \Phi(\Phi^{-1}(1-p_1)-\eta)}

Comment thread R/parameter_descriptions.R Outdated
#' @keywords internal
NULL

#' Parameter Description: Monotonisation argument (optimal conditional error design))
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra closing parenthesis at the end of the comment line.

Suggested change
#' Parameter Description: Monotonisation argument (optimal conditional error design))
#' Parameter Description: Monotonisation argument (optimal conditional error design)

Copilot uses AI. Check for mistakes.
@fpahlke fpahlke self-assigned this Aug 8, 2025
@fpahlke fpahlke added the enhancement New feature or request label Aug 8, 2025
@morten-dreher
Copy link
Copy Markdown
Author

@fpahlke Finished integration of Copilot comments, code ready for review

Fixed two bugs that resulted in the value of the interim estimate being calculated incorrectly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants