Skip to content

ENH: Implement Bootstrapping for Confidence Interval Estimation #891

Description

@Gui-FernandesBR

Is your feature request related to a problem? Please describe.
Currently, the MonteCarlo class calculates basic statistics (mean and standard deviation) for simulation results. However, users lack a metric to evaluate the reliability of these statistics.

Without confidence intervals, it is difficult to determine if the sample size (number of simulations) is sufficient. Users need a way to quantify the uncertainty of their results (e.g., "We are 95% confident the true mean apogee is between X and Y").

Describe the solution you'd like
Implement a method within the MonteCarlo class that uses Bootstrapping (resampling with replacement) to estimate confidence intervals for simulation outputs.

Implementation Details

  • Target File: rocketpy/simulation/monte_carlo.py
  • Recommended Approach: Use scipy.stats.bootstrap (preferred for robustness) or numpy random choice to resample the data stored in self.results.
  • New Method: Create a method likely named calculate_confidence_interval or estimate_ci.

Proposed Usage

# After running simulations
analysis = MonteCarlo(...)
analysis.simulate(number_of_simulations=500)

# Calculate 95% CI for Apogee
ci_result = analysis.calculate_confidence_interval(
    variable="apogee", 
    confidence_level=0.95, 
    method="BCa" # or 'percentile'
)

print(f"95% CI for Apogee: {ci_result.low} to {ci_result.high}")

Acceptance Criteria

  • Implement a method to calculate Confidence Intervals (CI) for any scalar output variable (e.g., apogee, impact_velocity).
  • Allow the user to specify the confidence level (default to 0.95).
  • Add unit tests to verify the statistical bounds are reasonable.
  • Update documentation with a brief explanation of how to interpret the CI.

Additional Context

Activity

  1. added
    Enhancement
    Good first issue
    Monte Carlo
    on Nov 29, 2025
  2. linked a pull request that will close this issueEnh/bootstrapping for ci estimation #897on Dec 2, 2025
  3. moved this from Backlog to Closed in LibDev Roadmapon Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementGood first issueMonte Carlo

    Projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions