Documentation
¶
Overview ¶
Package analysis provides statistical analysis functions for vulnerability data. It includes the Mann-Whitney U test for comparing EPSS score distributions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EffectSizeInterpretation ¶
EffectSizeInterpretation returns a string interpretation of the effect size. Based on Cohen's conventions: small (0.1), medium (0.3), large (0.5).
func SignificanceLevel ¶
SignificanceLevel returns a string representation of the p-value significance.
Types ¶
type CategoryComparison ¶
type CategoryComparison struct {
Category1 string
Category2 string
Stats1 DescriptiveStats
Stats2 DescriptiveStats
TestResult MannWhitneyResult
}
CategoryComparison holds the results of comparing two categories.
func CompareCategoryDistributions ¶
func CompareCategoryDistributions( category1 string, scores1 []float64, category2 string, scores2 []float64, ) (CategoryComparison, error)
CompareCategoryDistributions compares EPSS score distributions between two categories.
func (CategoryComparison) String ¶
func (c CategoryComparison) String() string
String returns a formatted string representation of the comparison.
type DescriptiveStats ¶
type DescriptiveStats struct {
N int // Sample size
Min float64 // Minimum value
Max float64 // Maximum value
Mean float64 // Arithmetic mean
Median float64 // Median (50th percentile)
StdDev float64 // Standard deviation (sample)
Q1 float64 // First quartile (25th percentile)
Q3 float64 // Third quartile (75th percentile)
IQR float64 // Interquartile range (Q3 - Q1)
Sum float64 // Sum of all values
}
DescriptiveStats holds descriptive statistics for a sample.
func Compute ¶
func Compute(data []float64) (DescriptiveStats, error)
Compute calculates descriptive statistics for a slice of float64 values. Returns an error if the input slice is empty.
type MannWhitneyResult ¶
type MannWhitneyResult struct {
U1 float64 // U statistic for sample 1
U2 float64 // U statistic for sample 2
U float64 // Smaller of U1 and U2
Z float64 // Z-score (standardized)
PValue float64 // Two-tailed p-value
N1 int // Size of sample 1
N2 int // Size of sample 2
EffectSize float64 // Effect size (r = Z / sqrt(N))
}
MannWhitneyResult holds the results of a Mann-Whitney U test.
func MannWhitneyU ¶
func MannWhitneyU(sample1, sample2 []float64) (MannWhitneyResult, error)
MannWhitneyU performs the Mann-Whitney U test (Wilcoxon rank-sum test). This is a non-parametric test to compare two independent samples. It tests whether the distributions of the two samples are equal. Returns an error if either sample is empty.
func (MannWhitneyResult) IsSignificant ¶
func (r MannWhitneyResult) IsSignificant(alpha float64) bool
IsSignificant returns true if the Mann-Whitney U test result is significant at the given alpha level.