Skip to main content

qq_plot_normal

Function qq_plot_normal 

Source
pub fn qq_plot_normal(data: &[f64]) -> Option<(Vec<f64>, Vec<f64>)>
Expand description

Generates QQ-plot data (theoretical quantiles vs sample quantiles).

Uses the standard normal distribution as the theoretical distribution. Sample quantiles are the sorted data. Theoretical quantiles are computed using the plotting position (i - 0.5) / n.

§Returns

Tuple of (theoretical_quantiles, sample_quantiles). Returns None if fewer than 3 data points.

§Examples

use u_analytics::distribution::qq_plot_normal;

let data = [-1.5, -0.5, 0.0, 0.5, 1.5];
let (theoretical, sample) = qq_plot_normal(&data).unwrap();
assert_eq!(theoretical.len(), 5);
assert_eq!(sample.len(), 5);
// Sample and theoretical should be roughly aligned for normal data