## output_analysis.ReplicationTabulizer


Observer class for recording replication results from an


Usage

``` python
output_analysis.ReplicationTabulizer()
```


[OnlineStatistics](output_analysis.OnlineStatistics.md#sim_tools.output_analysis.OnlineStatistics) instance during simulation runs or repeated experiments.

Implements the observer pattern to collect statistics after each update from the observed object, enabling later tabulation and analysis. After data collection, results can be exported as a summary dataframe (equivalent Implement as the part of observer pattern. Provides a summary frame to the output of [confidence_interval_method](output_analysis.confidence_interval_method.md#sim_tools.output_analysis.confidence_interval_method)).


## Attributes


`stdev: list[float]`  
Sequence of recorded standard deviations.

`lower: list[float]`  
Sequence of recorded lower confidence interval bounds.

`upper: list[float]`  
Sequence of recorded upper confidence interval bounds.

`dev: list[float]`  
Sequence of recorded percentage deviations of CI half-width from the mean.

`cumulative_mean: list[float]`  
Sequence of running mean values.

`x_i: list[float]`  
Sequence of last observed raw data points.

`n: int`  
Total number of updates recorded.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialise an empty [ReplicationTabulizer](output_analysis.ReplicationTabulizer.md#sim_tools.output_analysis.ReplicationTabulizer). |
| [summary_table()](#summary_table) | Compile all recorded replications into a pandas DataFrame. |
| [update()](#update) | Record the latest statistics from an observed [OnlineStatistics](output_analysis.OnlineStatistics.md#sim_tools.output_analysis.OnlineStatistics) |

------------------------------------------------------------------------


#### \_\_init\_\_()


Initialise an empty [ReplicationTabulizer](output_analysis.ReplicationTabulizer.md#sim_tools.output_analysis.ReplicationTabulizer).


Usage

``` python
__init__()
```


All recorded metrics are stored in parallel lists, which grow as [update()](output_analysis.OnlineStatistics.md#sim_tools.output_analysis.OnlineStatistics.update) is called.


------------------------------------------------------------------------


#### summary_table()


Compile all recorded replications into a pandas DataFrame.


Usage

``` python
summary_table()
```


##### Returns


`pandas.DataFrame`  
A table with one row per replication (update), containing:

- `Mean` (latest observed value)
- `Cumulative Mean`
- `Standard Deviation`
- `Lower Interval`
- `Upper Interval`
- `% deviation` (CI half-width as a fraction of cumulative mean)


------------------------------------------------------------------------


#### update()


Record the latest statistics from an observed [OnlineStatistics](output_analysis.OnlineStatistics.md#sim_tools.output_analysis.OnlineStatistics)


Usage

``` python
update(results)
```


instance.

This method should be called by the observed object when its state changes (i.e., when a new data point has been processed).


##### Parameters


`results: OnlineStatistics`  
The current statistics object containing the latest values.
