linreg_ally.plotting ==================== .. py:module:: linreg_ally.plotting Functions --------- .. autoapisummary:: linreg_ally.plotting.qq_and_residuals_plot Module Contents --------------- .. py:function:: qq_and_residuals_plot(y_actual, y_predicted, concatenate=True) Generate a Q-Q plot (standardized residuals vs theoretical quantiles) and a Residuals vs. Fitted Values plot using Altair for regression diagnostics. :param y_actual: Actual observed values from the dataset. Must be numeric and have the same length as `y_predicted`. :type y_actual: array-like :param y_predicted: Predicted (fitted) values from the regression model. Must be numeric and have the same length as `y_actual`. :type y_predicted: array-like :param concatenate: If True, concatenates the Q-Q plot and Residuals vs. Fitted Values plot side by side. If False, returns the plots separately as individual Altair charts. :type concatenate: bool, optional (default=True) :returns: - If `concatenate=True`, returns a concatenated Altair chart with both plots. - If `concatenate=False`, returns a tuple containing the Q-Q plot and Residuals vs. Fitted Values plot. :rtype: alt.Chart or tuple of alt.Chart :raises ValueError: If `y_actual` or `y_predicted` are empty, have mismatched lengths, or contain fewer than two data points. :raises TypeError: If `y_actual` or `y_predicted` are not numeric. .. rubric:: Examples >>> import numpy as np >>> np.random.seed(42) >>> y_actual = np.random.normal(10, 2, 100) >>> y_predicted = y_actual + np.random.normal(0, 1, 100) >>> chart = qq_and_residuals_plot(y_actual, y_predicted, concatenate=True) >>> chart.display()