<jupyter_start><jupyter_text>How to use pyHomogeneity package functions : a brief example The **Daily Female Births Dataset**  is used here for demonstrating the use of this package. This dataset describes the number of daily female births in California in 1959. This dataset is available in [here](https://raw.githubusercontent.com/jbrownlee/Datasets/master/daily-total-female-births.csv).<jupyter_code>import numpy as np
import pandas as pd
import pyhomogeneity as hg
import matplotlib.pyplot as plt
import statsmodels.api as sm
%matplotlib inline

# read all datasets
Birth_data = pd.read_csv("daily-total-female-births.csv")
Birth_data.index = pd.to_datetime(Birth_data.Date,format='%d/%m/%Y')
Birth_data.drop('Date', axis=1,inplace=True)
Birth_data.head()
Birth_data.plot(figsize=(16,6));
pettitt_res = hg.pettitt_test(Birth_data, alpha=0.05)
pettitt_res
snht_res = hg.snht_test(Birth_data, sim=10000)
snht_res
buishand_res = hg.buishand_u_test(Birth_data)
buishand_res<jupyter_output><empty_output><jupyter_text>All homogeneity test shows that there is a significant change-point in this dataset. Because the **p-value** is smaller than **alpha=0.05** and **h=True**. The change-point is located at **1959-06-29**. The mean value of before and after change-point is  **39.638888888888886** and **44.25945945945946**.<jupyter_code>result = pettitt_res

mn = Birth_data.index[0]
mx = Birth_data.index[-1]

loc = pd.to_datetime(result.cp)
mu1 = result.avg.mu1
mu2 = result.avg.mu2

plt.figure(figsize=(16,6))
plt.plot(Birth_data, label="Observation")
plt.hlines(mu1, xmin=mn, xmax=loc, linestyles='--', colors='orange',lw=1.5, label='mu1 : ' + str(round(mu1,2)))
plt.hlines(mu2, xmin=loc, xmax=mx, linestyles='--', colors='g', lw=1.5, label='mu2 : ' + str(round(mu2,2)))
plt.axvline(x=loc, linestyle='-.' , color='red', lw=1.5, label='Change point : '+ loc.strftime('%Y-%m-%d') + '\n p-value : ' + str(result.p))

plt.title('Daily Female Births')
plt.xlabel('Date')
plt.ylabel('Births')
plt.legend(loc='upper right')

# plt.savefig("F:/aaaaaa.jpg", dpi=600)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15311004784688995, 'fraction_numerical': 0.04114832535885168, 'mean_word_length': 6.185567010309279, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '503429', 'license': 'MIT', 'n_tokens_mistral': 852, 'n_tokens_neox': 783, 'n_words': 173, 'path': 'Examples/Example_pyHomogeneity.ipynb', 'repo_name': 'mmhs013/pyHomogeneity', 'size': '2090'}