29 lines
874 B
Python
29 lines
874 B
Python
from scipy import stats
|
|
import numpy as np
|
|
import scipy.stats
|
|
import pandas as pd
|
|
import os
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
|
|
curdir = os.getcwd()
|
|
path_delim = '/'
|
|
df = pd.read_excel(curdir + path_delim + "data/tests_28_10_2023_19_16.xlsx", sheet_name="data")
|
|
|
|
# Generating a sample dataset
|
|
np.random.seed(0) # For reproducibility
|
|
sample_data = np.random.normal(loc=0, scale=1, size=100) # Generating 100 samples from a normal distribution
|
|
|
|
# Performing the Shapiro-Wilk test
|
|
statistic, p_value = stats.shapiro(df['calculatedRatio'])
|
|
|
|
# Printing the results
|
|
print(f"Shapiro-Wilk test statistic: {statistic}")
|
|
print(f"P-value: {p_value}")
|
|
|
|
alpha = 0.05 # Set the significance level
|
|
if p_value > alpha:
|
|
print("Sample looks Gaussian (fail to reject H0 - null hypothesis)")
|
|
else:
|
|
print("Sample does not look Gaussian (reject H0 - null hypothesis)")
|