from scipy import stats
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
import numpy as np
import math

#HYPOTHESIS TESTING:
def HypothesisTesting(Ttest, Pvalue):
    Ttest, Pvalue = stats.ttest_ind(Ttest, Pvalue)
    print(f"SADUSTATISTICS' HYPOTHESIS TESTING RESULT: Ttest -> {Ttest}, and p-value -> {Pvalue}")


#LINEAR REQRESSION:
def LinearRegressionModel(ArrayA, ArrayB, DesiredValue):
    model = LinearRegression()
    model.fit(ArrayA, ArrayB)
    print(f"SADUSTATISTICS' LINEAR REGRESSION ANALYSIS RESULT: {model.predict([[DesiredValue]])}")



def ConfidenceInterval(mean, stdev, n, confidence_level= 1.82):
    conf = confidence_level * (stdev / (math.sqrt(n)))
    print(f"SADUSTATISTICS' CONFIDENCE INTERVAL RESULT: {mean - conf, mean + conf}")


def HistPlot(n, m, stdev):
    print(f"SADUSTATISTICS' HISTOGRAM PLOT RESULT: {np.random.normal(m, stdev, n)}")


def MatplotlibHistogram(n, mean, stdev):
    data = HISTPLOT(n, mean, stdev)
    plt.hist(data, color='red', label='histogramo')
    plt.title("HISTOGRAMPLOT")
    plt.xlabel("POINTS")
    plt.ylabel('VALUES')
    plt.grid(True)
    plt.legend()
    plt.show()



def DOT(a, b):
    print(f"SADUSTATISTICS' INNER(DOT) PRODUCT RESULT: {sum(x * y for x,y in zip(a, b))}")
