## distributions.RawContinuousEmpirical


Continuous Empirical Distribution for Raw Data using Law and Kelton's


Usage

``` python
distributions.RawContinuousEmpirical(
    data,
    random_seed=None,
)
```


method.

A distribution that performs linear interpolation between data points according to the algorithm described in Law & Kelton's "Simulation Modeling and Analysis". The implementation follows a two-step approach:

1.  Generate U ~ Uniform(0, 1), calculate P = (n-1)U, and I = int(P) + 1
2.  Return X_I + (P-I)(X\_{I+1} - X_I)

This approach ensures proper weighting across intervals and is suitable for both Monte Carlo and discrete-event simulation applications.

Maximum and minimum values of the distribution are defined by the data.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize a continuous empirical distribution from raw data. |
| [plotly_ecdf_linear_interpolation()](#plotly_ecdf_linear_interpolation) | Plots the piecewise linear CDF implied by the Law & Kelton sampling |
| [plotly_ecdf_standard()](#plotly_ecdf_standard) | Plots the standard Empirical Cumulative Distribution Function (ECDF) |
| [sample()](#sample) | Sample from the Continuous Empirical Distribution. |

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


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


Initialize a continuous empirical distribution from raw data.


Usage

``` python
__init__(data, random_seed=None)
```


##### Parameters


`data: ArrayLike`  
Raw data points to create the empirical distribution from.

`random_seed: Optional[Union[int, SeedSequence]] = None`  
A random seed or SeedSequence to reproduce samples. If None, a unique sample sequence is generated.


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


#### plotly_ecdf_linear_interpolation()


Plots the piecewise linear CDF implied by the Law & Kelton sampling


Usage

``` python
plotly_ecdf_linear_interpolation(
    title="Piecewise Linear CDF used by Sampler",
    xaxis_title="Data Value",
    yaxis_title="Cumulative Probability (Sampler's CDF)",
    line_color=None,
    line_width=None,
    marker_symbol="circle",
    marker_size=6,
    marker_color=None,
    trace_name="Piecewise Linear CDF",
    showlegend=True,
    layout_options=None
)
```


method using Plotly, with customization options.


##### Parameters


`title: Optional[str] = ``"Piecewise Linear CDF used by Sampler"`  
The main title of the plot.

`xaxis_title: Optional[str] = ``"Data Value"`  
The title for the x-axis.

`yaxis_title: Optional[str] = ``"Cumulative Probability (Sampler's CDF)"`  
The title for the y-axis.

`line_color: Optional[str] = None`  
Color of the line segments (Plotly default if None). Examples: "green", "#2ca02c".

`line_width: Optional[float] = None`  
Width of the line segments (Plotly default if None). Example: 2.

`marker_symbol: Optional[str] = ``"circle"`  
Symbol for markers at data points (Plotly default if None). Use None to hide markers. Examples: "circle", "square", "x".

`marker_size: Optional[float] = ``6`  
Size of the markers (Plotly default if None).

`marker_color: Optional[str] = None`  
Color of the markers (inherits from line by default, or specify).

`trace_name: Optional[str] = ``"Piecewise Linear CDF"`  
Name to display in the legend for this trace.

`showlegend: bool = ``True`  
Whether to display the legend.

`layout_options: Optional[Dict] = None`  
A dictionary of additional options to pass to fig.update_layout().


##### Returns


`plotly.graph_objects.Figure`  
A Plotly figure object containing the plot.


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


#### plotly_ecdf_standard()


Plots the standard Empirical Cumulative Distribution Function (ECDF)


Usage

``` python
plotly_ecdf_standard(
    title="Standard Empirical CDF",
    xaxis_title="Data Value",
    yaxis_title="Cumulative Probability (P(X <= x))",
    line_color=None,
    line_width=None,
    trace_name="Standard ECDF",
    showlegend=True,
    layout_options=None
)
```


using Plotly, with customization options.


##### Parameters


`title: Optional[str] = ``"Standard Empirical CDF"`  
The main title of the plot.

`xaxis_title: Optional[str] = ``"Data Value"`  
The title for the x-axis.

`yaxis_title: Optional[str] = ``"Cumulative Probability (P(X <= x))"`  
The title for the y-axis.

`line_color: Optional[str] = None`  
Color of the ECDF line (Plotly default if None). Accepts CSS color names, hex codes, etc.

`line_width: Optional[float] = None`  
Width of the ECDF line (Plotly default if None).

`trace_name: Optional[str] = ``"Standard ECDF"`  
Name to display in the legend for this trace.

`showlegend: bool = ``True`  
Whether to display the legend.

`layout_options: Optional[Dict] = None`  
A dictionary of additional options to pass to fig.update_layout().


##### Returns


`plotly.graph_objects.Figure`  
A Plotly figure object containing the plot.


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


#### sample()


Sample from the Continuous Empirical Distribution.


Usage

``` python
sample(size=None)
```


##### Parameters


`size: Optional[Union[int, Tuple[int, …]]] = None`  
The number/shape of samples to generate:

- If None: returns a single sample as a float
- If int: returns a 1-D array with that many samples
- If tuple of ints: returns an array with that shape


##### Returns


`Union[float, NDArray[np.float64]]`  
Random samples from the continuous empirical distribution
