ahat.plot_linear_signal_model

plot_linear_signal_model(
    X,
    y,
    X_eval,
    model,
    threshold,
    tau,
    xlog=False,
    ylog=False,
    poi_name='Parameter of Interest',
    ax=None,
)

Diagnostic Plot: Visualizes the standard linear a-hat vs a model.

Plots the raw data, the linear expectation model, the constant 95% prediction interval (calculated using tau), and the target threshold. It automatically scales the plot axes based on the chosen log transformations.

Parameters

Name Type Description Default
X np.ndarray Original simulation inputs. required
y np.ndarray Original simulation outcomes. required
X_eval np.ndarray Grid used for curve evaluation. required
model LinearRegression The fitted linear expectation model. required
threshold float The detection threshold limit. required
tau float The constant standard deviation of the residuals. required
xlog bool Set to True if the model used log-transformed X. False
ylog bool Set to True if the model used log-transformed y. False
poi_name str Label for the x-axis. Defaults to “Parameter of Interest”. 'Parameter of Interest'
ax Optional[plt.Axes] Existing Matplotlib axes. Created if None. None

Returns

Name Type Description
plt.Axes plt.Axes: The configured Matplotlib axis containing the plot.

Examples

import matplotlib.pyplot as plt

ax = plot_linear_signal_model(
    X, y, X_eval, model, threshold=3.5, tau=tau,
    xlog=True, ylog=False, poi_name="Crack Length (mm)"
)
plt.show()