pub fn std_err<T>(data: &[T]) -> StatsResult<f64>where
T: ToPrimitive + Debug,Expand description
Calculate the standard error of a dataset
The standard error quantifies the uncertainty in the sample mean as an estimate of the population mean.
§Arguments
data- A slice of numeric values implementingToPrimitive
§Returns
StatsResult<f64>- The standard error, or an error if the input is invalid
§Errors
Returns StatsError::EmptyData if the input slice is empty.
Returns StatsError::ConversionError if any value cannot be converted to f64.
§Examples
use rs_stats::prob::std_err;
// Calculate standard error for a dataset
let data = [1.0, 2.0, 3.0, 4.0, 5.0];
let se = std_err(&data)?;
assert!((se - 0.632455532).abs() < 1e-9);
// Handle empty input
let empty_data: &[f64] = &[];
assert!(std_err(empty_data).is_err());