# -*- coding: utf-8 -*-
"""
Created on Sun Nov 14 12:07:14 2021

@author: Sim
"""
import numpy as np
import scipy.stats as st

xx = np.array([
 -1.94, -1.54, -1.26, -1.11, -0.99, -0.96, -0.90, -0.77, -0.72, -0.66,
 -0.62, -0.60, -0.57, -0.46, -0.42, -0.39, -0.29, -0.24, -0.18, -0.18,
 -0.12, -0.03,  0.03,  0.08,  0.14,  0.17,  0.19,  0.20,  0.36,  0.36,
  0.41,  0.50,  0.54,  0.61,  0.63,  0.65,  0.76,  0.79,  0.85,  0.88,
  0.98,  1.02,  1.11,  1.16,  1.42,  1.56,  1.78,  1.79,  1.80,  2.33])

qq = [0.2, 0.4, 0.6, 0.8]
cuts = np.r_[-np.inf, st.norm.ppf(qq), np.inf]

obsd, bins = np.histogram(xx, bins=cuts)
print(obsd, bins)

expd = len(xx) * 1/5 * np.ones(5)

chi0, pval = st.chisquare(obsd, expd)
print(chi0, pval)
