normality
Get normality statistics for a data series.
Runs the kurtosis, skewness, Jarque-Bera, Shapiro-Wilk, and Kolmogorov-Smirnov tests, each assessing whether the sample is drawn from a normal distribution. Returns the test statistic and p-value for every test.
Examples
from openbb import obb
obb.quantitative.normality(target='close', data=[{'date': '2023-01-02', 'open': 110.0, 'high': 120.0, 'low': 100.0, 'close': 115.0, 'volume': 10000.0}, {'date': '2023-01-03', 'open': 165.0, 'high': 180.0, 'low': 150.0, 'close': 172.5, 'volume': 15000.0}, {'date': '2023-01-04', 'open': 146.67, 'high': 160.0, 'low': 133.33, 'close': 153.33, 'volume': 13333.33}, {'date': '2023-01-05', 'open': 137.5, 'high': 150.0, 'low': 125.0, 'close': 143.75, 'volume': 12500.0}, {'date': '2023-01-06', 'open': 132.0, 'high': 144.0, 'low': 120.0, 'close': 138.0, 'volume': 12000.0}])
Parameters
- standard
data: Data | DataFrame | Series | dict | list | list[DataFrame] | list[Data] | list[Series] | ndarray
Input dataset.
target: str
Name of the column to analyze.
Returns
results: NormalityData
Serializable results.
provider: str
Provider name.
warnings: Optional[list[Warning_]]
List of warnings.
chart: Optional[Chart]
Chart object.
extra: dict[str, Any]
Extra info.
Data
- standard
kurtosis_statistic: float
Kurtosis test statistic.
kurtosis_p_value: float
p-value of the kurtosis test.
skewness_statistic: float
Skewness test statistic.
skewness_p_value: float
p-value of the skewness test.
jarque_bera_statistic: float
Jarque-Bera test statistic.
jarque_bera_p_value: float
p-value of the Jarque-Bera test.
shapiro_wilk_statistic: float
Shapiro-Wilk test statistic.
shapiro_wilk_p_value: float
p-value of the Shapiro-Wilk test.
kolmogorov_smirnov_statistic: float
Kolmogorov-Smirnov test statistic against a normal distribution with the sample mean and variance (Lilliefors test).
kolmogorov_smirnov_p_value: float
p-value of the Lilliefors-corrected Kolmogorov-Smirnov test, bounded to the range 0.001 to 0.99.