Last active
June 13, 2022 04:05
-
-
Save taruma/e250ab2685ba5b4c8facbf498cfb5cd8 to your computer and use it in GitHub Desktop.
taruma_hk141_chi_square.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "taruma_hk141_chi_square.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"authorship_tag": "ABX9TyMeRJEe/wBy9SUFl+qHmTSZ", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/taruma/e250ab2685ba5b4c8facbf498cfb5cd8/taruma_hk141_chi_square.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"Berdasarkan isu [#141](https://github.com/hidrokit/hidrokit/issues/141): **Uji Chi-Square**\n", | |
"\n", | |
"Referensi Isu:\n", | |
"- Soetopo, W., Montarcih, L., Press, U. B., & Media, U. (2017). Rekayasa Statistika untuk Teknik Pengairan. Universitas Brawijaya Press. https://books.google.co.id/books?id=TzVTDwAAQBAJ\n", | |
"- Soewarno. (1995). hidrologi: Aplikasi Metode Statistik untuk Analisa Data. NOVA.\n", | |
"- Limantara, L. (2018). Rekayasa Hidrologi.\n", | |
"\n", | |
"Deskripsi Isu:\n", | |
"- Melakukan Uji Kecocokan Distribusi menggunakan Uji Chi-Square.\n", | |
"\n", | |
"Diskusi Isu:\n", | |
"- [#182](https://github.com/hidrokit/hidrokit/discussions/182) - Formula pada perhitungan Chi Square (Uji Kecocokan Distribusi).\n", | |
"\n", | |
"Strategi:\n", | |
"- Tidak dibandingkan dengan fungsi `scipy.stats.chisquare`." | |
], | |
"metadata": { | |
"id": "n3h9HHyH8Yh4" | |
} | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"# PERSIAPAN DAN DATASET" | |
], | |
"metadata": { | |
"id": "nCwAQOWb9U96" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"id": "FG1q9l2Y76tr", | |
"outputId": "4a44139c-c786-4efe-c146-cba56a90f9c2", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
} | |
}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
" Building wheel for hidrokit (setup.py) ... \u001b[?25l\u001b[?25hdone\n" | |
] | |
} | |
], | |
"source": [ | |
"try:\n", | |
" import hidrokit\n", | |
"except ModuleNotFoundError:\n", | |
" # saat dibuat menggunakan cabang @dev/dev0.3.7\n", | |
" !pip install git+https://github.com/taruma/hidrokit.git@latest -q" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import numpy as np\n", | |
"import pandas as pd\n", | |
"from scipy import stats\n", | |
"from hidrokit.contrib.taruma import hk172, hk124, hk127, hk126 \n", | |
"\n", | |
"frek_normal, frek_lognormal, frek_gumbel, frek_logpearson3 = hk172, hk124, hk127, hk126" | |
], | |
"metadata": { | |
"id": "LB6uUJIV9Xbh" | |
}, | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# contoh data diambil dari buku\n", | |
"# limantara hal. 118\n", | |
"\n", | |
"_HUJAN = np.array([85, 92, 115, 116, 122, 52, 69, 95, 96, 105])\n", | |
"_TAHUN = np.arange(1998, 2008) # 1998-2007\n", | |
"\n", | |
"data = pd.DataFrame(\n", | |
" data=np.stack([_TAHUN, _HUJAN], axis=1),\n", | |
" columns=['tahun', 'hujan']\n", | |
")\n", | |
"\n", | |
"data.tahun = pd.to_datetime(data.tahun, format='%Y')\n", | |
"data.set_index('tahun', inplace=True)\n", | |
"data" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 394 | |
}, | |
"id": "gmxQAUAA9ZRE", | |
"outputId": "5cc6f680-fcdb-4eec-8b34-2f3447b84c53" | |
}, | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" hujan\n", | |
"tahun \n", | |
"1998-01-01 85\n", | |
"1999-01-01 92\n", | |
"2000-01-01 115\n", | |
"2001-01-01 116\n", | |
"2002-01-01 122\n", | |
"2003-01-01 52\n", | |
"2004-01-01 69\n", | |
"2005-01-01 95\n", | |
"2006-01-01 96\n", | |
"2007-01-01 105" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-04f41b38-e725-47fc-9cbc-d6127ee74d93\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>hujan</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>tahun</th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1998-01-01</th>\n", | |
" <td>85</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1999-01-01</th>\n", | |
" <td>92</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2000-01-01</th>\n", | |
" <td>115</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>116</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2002-01-01</th>\n", | |
" <td>122</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2003-01-01</th>\n", | |
" <td>52</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2004-01-01</th>\n", | |
" <td>69</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2005-01-01</th>\n", | |
" <td>95</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2006-01-01</th>\n", | |
" <td>96</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2007-01-01</th>\n", | |
" <td>105</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-04f41b38-e725-47fc-9cbc-d6127ee74d93')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-04f41b38-e725-47fc-9cbc-d6127ee74d93 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-04f41b38-e725-47fc-9cbc-d6127ee74d93');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 3 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"# TABEL\n", | |
"\n", | |
"Terdapat 1 tabel untuk modul `hk141` yaitu:\n", | |
"- `t_chi_lm`: Tabel nilai kritis untuk Distribusi Chi Square ($X^2$) dari buku Rekayasa Hidrologi oleh Limantara. \n", | |
"\n", | |
"Dalam modul `hk141` nilai kritis $X^2$ akan dibangkitkan menggunakan fungsi `scipy.stats.chi2.isf` secara `default`. Mohon diperhatikan jika ingin menggunakan nilai $X^2$ yang berasal dari sumber lain. " | |
], | |
"metadata": { | |
"id": "YYwJuJGg95Zy" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# tabel dari limantara hal. 117\n", | |
"# Tabel Nilai Kritis untuk Distribusi Chi Square (X^2)\n", | |
"\n", | |
"# KODE: LM\n", | |
"\n", | |
"_DATA_LM = [\n", | |
" [0.039, 0.016, 0.698, 0.393, 3.841, 5.024, 6.635, 7.879],\n", | |
" [0.100, 0.201, 0.506, 0.103, 5.991, 0.738, 9.210, 10.597],\n", | |
" [0.717, 0.115, 0.216, 0.352, 7.815, 9.348, 11.345, 12.838],\n", | |
" [0.207, 0.297, 0.484, 0.711, 9.488, 11.143, 13.277, 14.860],\n", | |
" [0.412, 0.554, 0.831, 1.145, 11.070, 12.832, 15.086, 16.750],\n", | |
" [0.676, 0.872, 1.237, 1.635, 12.592, 14.449, 16.812, 18.548],\n", | |
" [0.989, 1.239, 1.690, 2.167, 14.067, 16.013, 18.475, 20.278],\n", | |
" [1.344, 1.646, 2.180, 2.733, 15.507, 17.535, 20.090, 21.955],\n", | |
" [1.735, 2.088, 2.700, 3.325, 16.919, 19.023, 21.666, 23.589],\n", | |
" [2.156, 2.558, 3.247, 3.940, 18.307, 20.483, 23.209, 25.188],\n", | |
" [2.603, 3.053, 3.816, 4.575, 19.675, 21.920, 24.725, 26.757],\n", | |
" [3.074, 3.571, 4.404, 5.226, 21.026, 23.337, 26.217, 28.300],\n", | |
" [3.565, 4.107, 5.009, 5.892, 22.362, 24.736, 27.688, 29.819],\n", | |
" [4.075, 4.660, 5.629, 6.571, 23.685, 26.119, 29.141, 31.319],\n", | |
" [4.601, 5.229, 6.262, 7.261, 24.996, 27.488, 30.578, 32.801],\n", | |
" [5.142, 5.812, 6.908, 7.962, 26.296, 28.845, 32.000, 34.267],\n", | |
" [5.697, 6.408, 7.564, 8.672, 27.587, 30.191, 33.409, 35.718],\n", | |
" [6.265, 7.015, 8.231, 9.390, 28.869, 31.526, 34.805, 37.156],\n", | |
" [6.884, 7.633, 8.907, 10.117, 30.144, 32.852, 36.191, 38.582],\n", | |
" [7.434, 8.260, 9.591, 10.851, 31.410, 34.170, 37.566, 39.997],\n", | |
" [8.034, 8.897, 10.283, 11.591, 32.671, 35.479, 38.932, 41.401],\n", | |
" [8.643, 9.542, 10.982, 12.338, 33.924, 36.781, 40.289, 42.796],\n", | |
" [9.260, 10.196, 11.689, 13.091, 36.172, 38.076, 41.638, 44.181],\n", | |
" [9.886, 10.856, 12.401, 13.848, 36.415, 39.364, 42.980, 45.558],\n", | |
" [10.520, 11.524, 13.120, 14.611, 37.652, 40.646, 44.314, 46.928],\n", | |
" [11.160, 12.198, 13.844, 15.379, 38.885, 41.923, 45.642, 48.290],\n", | |
" [11.808, 12.879, 14.573, 16.151, 40.113, 43.194, 46.963, 49.645],\n", | |
" [12.461, 13.565, 15.308, 16.928, 41.337, 44.461, 48.278, 50.993],\n", | |
" [13.121, 14.256, 16.047, 17.708, 42.557, 45.722, 49.588, 52.336],\n", | |
" [13.787, 14.953, 16.791, 18.493, 43.773, 46.979, 50.892, 53.672],\n", | |
"]\n", | |
"\n", | |
"_INDEX_LM = range(1, 31)\n", | |
"\n", | |
"_COL_LM = [0.995, .99, .975, .95, .05, .025, 0.01, 0.005]\n", | |
"\n", | |
"t_chi_lm = pd.DataFrame(\n", | |
" data=_DATA_LM, index=_INDEX_LM, columns=_COL_LM\n", | |
")\n", | |
"t_chi_lm" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 990 | |
}, | |
"id": "W3OOs5acDvrL", | |
"outputId": "f3606b7b-d9ff-4bbf-a480-77c64e918fd8" | |
}, | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" 0.995 0.990 0.975 0.950 0.050 0.025 0.010 0.005\n", | |
"1 0.039 0.016 0.698 0.393 3.841 5.024 6.635 7.879\n", | |
"2 0.100 0.201 0.506 0.103 5.991 0.738 9.210 10.597\n", | |
"3 0.717 0.115 0.216 0.352 7.815 9.348 11.345 12.838\n", | |
"4 0.207 0.297 0.484 0.711 9.488 11.143 13.277 14.860\n", | |
"5 0.412 0.554 0.831 1.145 11.070 12.832 15.086 16.750\n", | |
"6 0.676 0.872 1.237 1.635 12.592 14.449 16.812 18.548\n", | |
"7 0.989 1.239 1.690 2.167 14.067 16.013 18.475 20.278\n", | |
"8 1.344 1.646 2.180 2.733 15.507 17.535 20.090 21.955\n", | |
"9 1.735 2.088 2.700 3.325 16.919 19.023 21.666 23.589\n", | |
"10 2.156 2.558 3.247 3.940 18.307 20.483 23.209 25.188\n", | |
"11 2.603 3.053 3.816 4.575 19.675 21.920 24.725 26.757\n", | |
"12 3.074 3.571 4.404 5.226 21.026 23.337 26.217 28.300\n", | |
"13 3.565 4.107 5.009 5.892 22.362 24.736 27.688 29.819\n", | |
"14 4.075 4.660 5.629 6.571 23.685 26.119 29.141 31.319\n", | |
"15 4.601 5.229 6.262 7.261 24.996 27.488 30.578 32.801\n", | |
"16 5.142 5.812 6.908 7.962 26.296 28.845 32.000 34.267\n", | |
"17 5.697 6.408 7.564 8.672 27.587 30.191 33.409 35.718\n", | |
"18 6.265 7.015 8.231 9.390 28.869 31.526 34.805 37.156\n", | |
"19 6.884 7.633 8.907 10.117 30.144 32.852 36.191 38.582\n", | |
"20 7.434 8.260 9.591 10.851 31.410 34.170 37.566 39.997\n", | |
"21 8.034 8.897 10.283 11.591 32.671 35.479 38.932 41.401\n", | |
"22 8.643 9.542 10.982 12.338 33.924 36.781 40.289 42.796\n", | |
"23 9.260 10.196 11.689 13.091 36.172 38.076 41.638 44.181\n", | |
"24 9.886 10.856 12.401 13.848 36.415 39.364 42.980 45.558\n", | |
"25 10.520 11.524 13.120 14.611 37.652 40.646 44.314 46.928\n", | |
"26 11.160 12.198 13.844 15.379 38.885 41.923 45.642 48.290\n", | |
"27 11.808 12.879 14.573 16.151 40.113 43.194 46.963 49.645\n", | |
"28 12.461 13.565 15.308 16.928 41.337 44.461 48.278 50.993\n", | |
"29 13.121 14.256 16.047 17.708 42.557 45.722 49.588 52.336\n", | |
"30 13.787 14.953 16.791 18.493 43.773 46.979 50.892 53.672" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-32160207-8b91-4079-b7ac-e2302df48033\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>0.995</th>\n", | |
" <th>0.990</th>\n", | |
" <th>0.975</th>\n", | |
" <th>0.950</th>\n", | |
" <th>0.050</th>\n", | |
" <th>0.025</th>\n", | |
" <th>0.010</th>\n", | |
" <th>0.005</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>0.039</td>\n", | |
" <td>0.016</td>\n", | |
" <td>0.698</td>\n", | |
" <td>0.393</td>\n", | |
" <td>3.841</td>\n", | |
" <td>5.024</td>\n", | |
" <td>6.635</td>\n", | |
" <td>7.879</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>0.100</td>\n", | |
" <td>0.201</td>\n", | |
" <td>0.506</td>\n", | |
" <td>0.103</td>\n", | |
" <td>5.991</td>\n", | |
" <td>0.738</td>\n", | |
" <td>9.210</td>\n", | |
" <td>10.597</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>0.717</td>\n", | |
" <td>0.115</td>\n", | |
" <td>0.216</td>\n", | |
" <td>0.352</td>\n", | |
" <td>7.815</td>\n", | |
" <td>9.348</td>\n", | |
" <td>11.345</td>\n", | |
" <td>12.838</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>0.207</td>\n", | |
" <td>0.297</td>\n", | |
" <td>0.484</td>\n", | |
" <td>0.711</td>\n", | |
" <td>9.488</td>\n", | |
" <td>11.143</td>\n", | |
" <td>13.277</td>\n", | |
" <td>14.860</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>0.412</td>\n", | |
" <td>0.554</td>\n", | |
" <td>0.831</td>\n", | |
" <td>1.145</td>\n", | |
" <td>11.070</td>\n", | |
" <td>12.832</td>\n", | |
" <td>15.086</td>\n", | |
" <td>16.750</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>0.676</td>\n", | |
" <td>0.872</td>\n", | |
" <td>1.237</td>\n", | |
" <td>1.635</td>\n", | |
" <td>12.592</td>\n", | |
" <td>14.449</td>\n", | |
" <td>16.812</td>\n", | |
" <td>18.548</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>0.989</td>\n", | |
" <td>1.239</td>\n", | |
" <td>1.690</td>\n", | |
" <td>2.167</td>\n", | |
" <td>14.067</td>\n", | |
" <td>16.013</td>\n", | |
" <td>18.475</td>\n", | |
" <td>20.278</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>1.344</td>\n", | |
" <td>1.646</td>\n", | |
" <td>2.180</td>\n", | |
" <td>2.733</td>\n", | |
" <td>15.507</td>\n", | |
" <td>17.535</td>\n", | |
" <td>20.090</td>\n", | |
" <td>21.955</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>9</th>\n", | |
" <td>1.735</td>\n", | |
" <td>2.088</td>\n", | |
" <td>2.700</td>\n", | |
" <td>3.325</td>\n", | |
" <td>16.919</td>\n", | |
" <td>19.023</td>\n", | |
" <td>21.666</td>\n", | |
" <td>23.589</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>10</th>\n", | |
" <td>2.156</td>\n", | |
" <td>2.558</td>\n", | |
" <td>3.247</td>\n", | |
" <td>3.940</td>\n", | |
" <td>18.307</td>\n", | |
" <td>20.483</td>\n", | |
" <td>23.209</td>\n", | |
" <td>25.188</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>11</th>\n", | |
" <td>2.603</td>\n", | |
" <td>3.053</td>\n", | |
" <td>3.816</td>\n", | |
" <td>4.575</td>\n", | |
" <td>19.675</td>\n", | |
" <td>21.920</td>\n", | |
" <td>24.725</td>\n", | |
" <td>26.757</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>12</th>\n", | |
" <td>3.074</td>\n", | |
" <td>3.571</td>\n", | |
" <td>4.404</td>\n", | |
" <td>5.226</td>\n", | |
" <td>21.026</td>\n", | |
" <td>23.337</td>\n", | |
" <td>26.217</td>\n", | |
" <td>28.300</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>13</th>\n", | |
" <td>3.565</td>\n", | |
" <td>4.107</td>\n", | |
" <td>5.009</td>\n", | |
" <td>5.892</td>\n", | |
" <td>22.362</td>\n", | |
" <td>24.736</td>\n", | |
" <td>27.688</td>\n", | |
" <td>29.819</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>14</th>\n", | |
" <td>4.075</td>\n", | |
" <td>4.660</td>\n", | |
" <td>5.629</td>\n", | |
" <td>6.571</td>\n", | |
" <td>23.685</td>\n", | |
" <td>26.119</td>\n", | |
" <td>29.141</td>\n", | |
" <td>31.319</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>15</th>\n", | |
" <td>4.601</td>\n", | |
" <td>5.229</td>\n", | |
" <td>6.262</td>\n", | |
" <td>7.261</td>\n", | |
" <td>24.996</td>\n", | |
" <td>27.488</td>\n", | |
" <td>30.578</td>\n", | |
" <td>32.801</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>16</th>\n", | |
" <td>5.142</td>\n", | |
" <td>5.812</td>\n", | |
" <td>6.908</td>\n", | |
" <td>7.962</td>\n", | |
" <td>26.296</td>\n", | |
" <td>28.845</td>\n", | |
" <td>32.000</td>\n", | |
" <td>34.267</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>17</th>\n", | |
" <td>5.697</td>\n", | |
" <td>6.408</td>\n", | |
" <td>7.564</td>\n", | |
" <td>8.672</td>\n", | |
" <td>27.587</td>\n", | |
" <td>30.191</td>\n", | |
" <td>33.409</td>\n", | |
" <td>35.718</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>18</th>\n", | |
" <td>6.265</td>\n", | |
" <td>7.015</td>\n", | |
" <td>8.231</td>\n", | |
" <td>9.390</td>\n", | |
" <td>28.869</td>\n", | |
" <td>31.526</td>\n", | |
" <td>34.805</td>\n", | |
" <td>37.156</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>19</th>\n", | |
" <td>6.884</td>\n", | |
" <td>7.633</td>\n", | |
" <td>8.907</td>\n", | |
" <td>10.117</td>\n", | |
" <td>30.144</td>\n", | |
" <td>32.852</td>\n", | |
" <td>36.191</td>\n", | |
" <td>38.582</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>20</th>\n", | |
" <td>7.434</td>\n", | |
" <td>8.260</td>\n", | |
" <td>9.591</td>\n", | |
" <td>10.851</td>\n", | |
" <td>31.410</td>\n", | |
" <td>34.170</td>\n", | |
" <td>37.566</td>\n", | |
" <td>39.997</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>21</th>\n", | |
" <td>8.034</td>\n", | |
" <td>8.897</td>\n", | |
" <td>10.283</td>\n", | |
" <td>11.591</td>\n", | |
" <td>32.671</td>\n", | |
" <td>35.479</td>\n", | |
" <td>38.932</td>\n", | |
" <td>41.401</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>22</th>\n", | |
" <td>8.643</td>\n", | |
" <td>9.542</td>\n", | |
" <td>10.982</td>\n", | |
" <td>12.338</td>\n", | |
" <td>33.924</td>\n", | |
" <td>36.781</td>\n", | |
" <td>40.289</td>\n", | |
" <td>42.796</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>23</th>\n", | |
" <td>9.260</td>\n", | |
" <td>10.196</td>\n", | |
" <td>11.689</td>\n", | |
" <td>13.091</td>\n", | |
" <td>36.172</td>\n", | |
" <td>38.076</td>\n", | |
" <td>41.638</td>\n", | |
" <td>44.181</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>24</th>\n", | |
" <td>9.886</td>\n", | |
" <td>10.856</td>\n", | |
" <td>12.401</td>\n", | |
" <td>13.848</td>\n", | |
" <td>36.415</td>\n", | |
" <td>39.364</td>\n", | |
" <td>42.980</td>\n", | |
" <td>45.558</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>25</th>\n", | |
" <td>10.520</td>\n", | |
" <td>11.524</td>\n", | |
" <td>13.120</td>\n", | |
" <td>14.611</td>\n", | |
" <td>37.652</td>\n", | |
" <td>40.646</td>\n", | |
" <td>44.314</td>\n", | |
" <td>46.928</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>26</th>\n", | |
" <td>11.160</td>\n", | |
" <td>12.198</td>\n", | |
" <td>13.844</td>\n", | |
" <td>15.379</td>\n", | |
" <td>38.885</td>\n", | |
" <td>41.923</td>\n", | |
" <td>45.642</td>\n", | |
" <td>48.290</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>27</th>\n", | |
" <td>11.808</td>\n", | |
" <td>12.879</td>\n", | |
" <td>14.573</td>\n", | |
" <td>16.151</td>\n", | |
" <td>40.113</td>\n", | |
" <td>43.194</td>\n", | |
" <td>46.963</td>\n", | |
" <td>49.645</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>28</th>\n", | |
" <td>12.461</td>\n", | |
" <td>13.565</td>\n", | |
" <td>15.308</td>\n", | |
" <td>16.928</td>\n", | |
" <td>41.337</td>\n", | |
" <td>44.461</td>\n", | |
" <td>48.278</td>\n", | |
" <td>50.993</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>29</th>\n", | |
" <td>13.121</td>\n", | |
" <td>14.256</td>\n", | |
" <td>16.047</td>\n", | |
" <td>17.708</td>\n", | |
" <td>42.557</td>\n", | |
" <td>45.722</td>\n", | |
" <td>49.588</td>\n", | |
" <td>52.336</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>30</th>\n", | |
" <td>13.787</td>\n", | |
" <td>14.953</td>\n", | |
" <td>16.791</td>\n", | |
" <td>18.493</td>\n", | |
" <td>43.773</td>\n", | |
" <td>46.979</td>\n", | |
" <td>50.892</td>\n", | |
" <td>53.672</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-32160207-8b91-4079-b7ac-e2302df48033')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-32160207-8b91-4079-b7ac-e2302df48033 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-32160207-8b91-4079-b7ac-e2302df48033');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 4 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"# KODE" | |
], | |
"metadata": { | |
"id": "ryR8EYWJGBpM" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from scipy import interpolate\n", | |
"\n", | |
"def _func_interp_bivariate(df):\n", | |
" \"Membuat fungsi dari tabel untuk interpolasi bilinear\"\n", | |
" table = df[df.columns.sort_values()].sort_index().copy()\n", | |
"\n", | |
" x = table.index\n", | |
" y = table.columns\n", | |
" z = table.to_numpy()\n", | |
"\n", | |
" # penggunaan kx=1, ky=1 untuk interpolasi linear antara 2 titik\n", | |
" # tidak menggunakan (cubic) spline interpolation\n", | |
" return interpolate.RectBivariateSpline(x, y, z, kx=1, ky=1)\n", | |
"\n", | |
"def _as_value(x, dec=4):\n", | |
" x = np.around(x, dec)\n", | |
" return x.flatten() if x.size > 1 else x.item()" | |
], | |
"metadata": { | |
"id": "xSbkavoqECGd" | |
}, | |
"execution_count": 5, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"table_source = {\n", | |
" 'limantara': t_chi_lm\n", | |
"}\n", | |
"\n", | |
"anfrek = {\n", | |
" 'normal': frek_normal.calc_x_normal,\n", | |
" 'lognormal': frek_lognormal.calc_x_lognormal,\n", | |
" 'gumbel': frek_gumbel.calc_x_gumbel,\n", | |
" 'logpearson3': frek_logpearson3.calc_x_lp3,\n", | |
"}\n", | |
"\n", | |
"def _calc_k(n):\n", | |
" return np.floor(1 + 3.22 * np.log10(n)).astype(int)\n", | |
"\n", | |
"def _calc_dk(k, m):\n", | |
" return k - 1 - m\n", | |
"\n", | |
"def calc_xcr(alpha, dk, source='scipy'):\n", | |
" alpha = np.array(alpha)\n", | |
"\n", | |
" if source.lower() in table_source.keys():\n", | |
" func_table = _func_interp_bivariate(table_source[source.lower()])\n", | |
" return _as_value(func_table(dk, alpha, grid=False), 3)\n", | |
" if source.lower() == 'scipy':\n", | |
" #ref: https://stackoverflow.com/questions/32301698\n", | |
" return stats.chi2.isf(alpha, dk)\n", | |
"\n", | |
"def chisquare(\n", | |
" df, col=None, dist='normal', source_dist=None,\n", | |
" alpha=0.05, source_xcr='scipy', show_stat=True,\n", | |
" ):\n", | |
"\n", | |
" if source_dist is None:\n", | |
" source_dist = (\n", | |
" \"scipy\"\n", | |
" if dist.lower() in [\"normal\", \"lognormal\", \"logpearson3\"]\n", | |
" else \"gumbel\"\n", | |
" )\n", | |
"\n", | |
" col = df.columns[0] if col is None else col\n", | |
" data = df[[col]].copy()\n", | |
" n = len(data)\n", | |
" data = data.rename({col: 'x'}, axis=1)\n", | |
"\n", | |
" if dist.lower() in ['lognormal', 'logpearson3']:\n", | |
" data['log_x'] = np.log10(data.x)\n", | |
"\n", | |
" k = _calc_k(n)\n", | |
" prob_class = 1 / k\n", | |
" prob_list = np.linspace(0, 1, k+1)[::-1]\n", | |
" prob_seq = prob_list[1:-1]\n", | |
"\n", | |
" func = anfrek[dist.lower()]\n", | |
"\n", | |
" T = 1 / prob_seq\n", | |
" val_x = func(data.x, return_period=T, source=source_dist)\n", | |
"\n", | |
" # Chi Square Table\n", | |
" calc_df = pd.DataFrame()\n", | |
" min = data.x.min()\n", | |
" max = data.x.max()\n", | |
" seq_x = np.concatenate([[min], val_x, [max]])\n", | |
"\n", | |
" calc_df['no'] = range(1, k+1)\n", | |
"\n", | |
" class_text = []\n", | |
" for i in range(seq_x.size-1):\n", | |
" if i == 0:\n", | |
" class_text += [f'X <= {seq_x[i+1]:.4f}']\n", | |
" elif i == seq_x.size-2:\n", | |
" class_text += [f'X > {seq_x[i]:.4f}']\n", | |
" else:\n", | |
" class_text += [f'{seq_x[i]:.4f} < X <= {seq_x[i+1]:.4f}']\n", | |
" calc_df['batas_kelas'] = class_text\n", | |
"\n", | |
" # calculate fe\n", | |
" fe = []\n", | |
" for i in range(seq_x.size-1):\n", | |
" if i == 0:\n", | |
" fe += [(data.x <= seq_x[i+1]).sum()]\n", | |
" elif i == seq_x.size-2:\n", | |
" fe += [(data.x > seq_x[i]).sum()]\n", | |
" else:\n", | |
" fe += [data.x.between(seq_x[i], seq_x[i+1], inclusive='right').sum()]\n", | |
" calc_df['fe'] = fe\n", | |
"\n", | |
" ft = prob_class * n\n", | |
" calc_df['ft'] = [ft]*k\n", | |
"\n", | |
" if dist.lower() in ['normal', 'gumbel', 'lognormal']:\n", | |
" dk = _calc_dk(k, 2)\n", | |
" elif dist.lower() in ['logpearson3']:\n", | |
" # di buku soetopo nilai m nya diberi angka 3\n", | |
" dk = _calc_dk(k, 2)\n", | |
"\n", | |
" X_calc = np.sum(np.power(2, (calc_df.fe-calc_df.ft))/calc_df.ft)\n", | |
" X_critical = calc_xcr(alpha=alpha, dk=dk, source=source_xcr)\n", | |
" result = int(X_calc < X_critical)\n", | |
" result_text = ['Distribusi Tidak Diterima', 'Distribusi Diterima']\n", | |
" calc_df.set_index('no', inplace=True)\n", | |
"\n", | |
" if show_stat:\n", | |
" print(f'Periksa Kecocokan Distribusi {dist.title()}')\n", | |
" print(f'Jumlah Kelas = {k}')\n", | |
" print(f'Dk = {dk}')\n", | |
" print(f'X^2_hitungan = {X_calc:.3f}')\n", | |
" print(f'X^2_kritis = {X_critical:.3f}')\n", | |
" print(f'Result (X2_calc < X2_cr) = {result_text[result]}')\n", | |
"\n", | |
" return calc_df" | |
], | |
"metadata": { | |
"id": "nr0k9aKyGG2Q" | |
}, | |
"execution_count": 6, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"# FUNGSI" | |
], | |
"metadata": { | |
"id": "Zy9jLuEQIEpp" | |
} | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"## Fungsi `calc_xcr(alpha, dk, ...)`\n", | |
"\n", | |
"Function: `calc_xcr(alpha, dk, source='scipy')`\n", | |
"\n", | |
"Fungsi `calc_xcr(...)` digunakan untuk mencari nilai $X^2_{kritis}$ dari berbagai sumber berdasarkan nilai derajat kepercayaan $\\alpha$ dan nilai $DK$.\n", | |
"\n", | |
"- Argumen Posisi:\n", | |
" - `alpha`: Nilai _level of significance_ $\\alpha$. Dalam satuan desimal.\n", | |
" - `dk`: Nilai $DK$ hasil perhitungan antara $K$ (jumlah kelas) dan parameter distribusi $m$.\n", | |
"- Argumen Opsional:\n", | |
" - `source`: sumber nilai $X^2_{kritis}$. `'scipy'` (default). Sumber yang dapat digunakan antara lain: Limantara (`'limantara'`)." | |
], | |
"metadata": { | |
"id": "xQaXygUAIGj5" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"calc_xcr(0.05, 3)" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "nrukdX0uJ2Vs", | |
"outputId": "d65a33d7-3d04-4f11-efed-904d2c203771" | |
}, | |
"execution_count": 7, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"7.814727903251178" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 7 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"calc_xcr([0.05, 0.1, 0.2], 5, source='limantara')" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "-aUH_AugJ5j_", | |
"outputId": "8eeead39-f84e-4390-a50d-f18b9783d035" | |
}, | |
"execution_count": 8, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"array([11.07 , 10.519, 9.416])" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 8 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# perbandingan antara nilai tabel dan fungsi scipy\n", | |
"\n", | |
"source_test = ['limantara', 'scipy']\n", | |
"\n", | |
"_dk = 5\n", | |
"_alpha = [0.2, 0.15, 0.1, 0.07, 0.05, 0.01]\n", | |
"\n", | |
"for _source in source_test:\n", | |
" print(f'Xcr {_source:<12}=', calc_xcr(_alpha, _dk, source=_source))" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "pM_jik3MKFVC", | |
"outputId": "6cc25d2d-067b-4124-c71c-6d0a3a5ac17e" | |
}, | |
"execution_count": 9, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Xcr limantara = [ 9.416 9.967 10.519 10.849 11.07 15.086]\n", | |
"Xcr scipy = [ 7.28927613 8.11519941 9.2363569 10.19102791 11.07049769 15.08627247]\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"## Fungsi `chisquare(df, ...)`\n", | |
"\n", | |
"Function: `chisquare(df, col=None, dist='normal', source_dist='scipy', alpha=0.05, source_xcr='scipy', show_stat=True)`\n", | |
"\n", | |
"Fungsi `chisquare(...)` merupakan fungsi untuk melakukan uji chi square terhadap distribusi yang dibandingkan. Fungsi ini mengeluarkan objek `pandas.DataFrame`. \n", | |
"\n", | |
"- Argumen Posisi:\n", | |
" - `df`: `pandas.DataFrame`.\n", | |
"- Argumen Opsional:\n", | |
" - `col`: nama kolom, `None` (default). Jika tidak diisi menggunakan kolom pertama dalam `df` sebagai data masukan.\n", | |
" - `dist`: distribusi yang dibandingkan, `'normal'` (distribusi normal) (default). Distribusi yang dapat digunakan antara lain: Log Normal (`'lognormal'`), Gumbel (`'gumbel'`), Log Pearson 3 (`'logpearson3'`).\n", | |
" - `source_dist`: sumber perhitungan distribusi, `'scipy'` (default). Lihat masing-masing modul analisis frekuensi untuk lebih jelasnya.\n", | |
" - `alpha`: nilai $\\alpha$, `0.05` (default).\n", | |
" - `source_xcr`: sumber nilai $X^2_{kritis}$, `'scipy'` (default). Sumber yang dapat digunakan antara lain: Limantara (`'limantara'`).\n", | |
" - `show_stat`: menampilkan hasil luaran uji, `True` (default)." | |
], | |
"metadata": { | |
"id": "w4_Zw33TKUWf" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"chisquare(data)" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 310 | |
}, | |
"id": "2Tv06tUxLC0X", | |
"outputId": "133d61f2-5efe-48bd-b24c-6c7e31bf1aa7" | |
}, | |
"execution_count": 10, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Periksa Kecocokan Distribusi Normal\n", | |
"Jumlah Kelas = 4\n", | |
"Dk = 1\n", | |
"X^2_hitungan = 1.697\n", | |
"X^2_kritis = 3.841\n", | |
"Result (X2_calc < X2_cr) = Distribusi Diterima\n" | |
] | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" batas_kelas fe ft\n", | |
"no \n", | |
"1 X <= 79.9499 2 2.5\n", | |
"2 79.9499 < X <= 94.7000 2 2.5\n", | |
"3 94.7000 < X <= 109.4501 3 2.5\n", | |
"4 X > 109.4501 3 2.5" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-b81dafa1-a2d6-4aff-b1cb-224a3d6b9988\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>batas_kelas</th>\n", | |
" <th>fe</th>\n", | |
" <th>ft</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>no</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>X <= 79.9499</td>\n", | |
" <td>2</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>79.9499 < X <= 94.7000</td>\n", | |
" <td>2</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>94.7000 < X <= 109.4501</td>\n", | |
" <td>3</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>X > 109.4501</td>\n", | |
" <td>3</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-b81dafa1-a2d6-4aff-b1cb-224a3d6b9988')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-b81dafa1-a2d6-4aff-b1cb-224a3d6b9988 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-b81dafa1-a2d6-4aff-b1cb-224a3d6b9988');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 10 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"chisquare(data, dist='gumbel', source_dist='soetopo')" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 310 | |
}, | |
"id": "U2vXMkHRLFhb", | |
"outputId": "4665d48b-dfee-4dcf-b575-24d592a7d2c4" | |
}, | |
"execution_count": 11, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Periksa Kecocokan Distribusi Gumbel\n", | |
"Jumlah Kelas = 4\n", | |
"Dk = 1\n", | |
"X^2_hitungan = 2.121\n", | |
"X^2_kritis = 3.841\n", | |
"Result (X2_calc < X2_cr) = Distribusi Diterima\n" | |
] | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" batas_kelas fe ft\n", | |
"no \n", | |
"1 X <= 75.7758 2 2.5\n", | |
"2 75.7758 < X <= 91.7367 1 2.5\n", | |
"3 91.7367 < X <= 111.9862 4 2.5\n", | |
"4 X > 111.9862 3 2.5" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-331721e7-3f00-4f2a-b6e3-cce071957853\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>batas_kelas</th>\n", | |
" <th>fe</th>\n", | |
" <th>ft</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>no</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>X <= 75.7758</td>\n", | |
" <td>2</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>75.7758 < X <= 91.7367</td>\n", | |
" <td>1</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>91.7367 < X <= 111.9862</td>\n", | |
" <td>4</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>X > 111.9862</td>\n", | |
" <td>3</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-331721e7-3f00-4f2a-b6e3-cce071957853')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-331721e7-3f00-4f2a-b6e3-cce071957853 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-331721e7-3f00-4f2a-b6e3-cce071957853');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 11 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"chisquare(data, 'hujan', dist='logpearson3', alpha=0.2, source_xcr='limantara')" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 310 | |
}, | |
"id": "JVogXG-jLJda", | |
"outputId": "b497ab44-a1f8-496f-b754-945383ad1d9b" | |
}, | |
"execution_count": 12, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Periksa Kecocokan Distribusi Logpearson3\n", | |
"Jumlah Kelas = 4\n", | |
"Dk = 1\n", | |
"X^2_hitungan = 2.121\n", | |
"X^2_kritis = 3.266\n", | |
"Result (X2_calc < X2_cr) = Distribusi Diterima\n" | |
] | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" batas_kelas fe ft\n", | |
"no \n", | |
"1 X <= 80.4303 2 2.5\n", | |
"2 80.4303 < X <= 97.1113 4 2.5\n", | |
"3 97.1113 < X <= 111.6241 1 2.5\n", | |
"4 X > 111.6241 3 2.5" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-012d23fc-c546-4bf8-945e-112263b9de02\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>batas_kelas</th>\n", | |
" <th>fe</th>\n", | |
" <th>ft</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>no</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>X <= 80.4303</td>\n", | |
" <td>2</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>80.4303 < X <= 97.1113</td>\n", | |
" <td>4</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>97.1113 < X <= 111.6241</td>\n", | |
" <td>1</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>X > 111.6241</td>\n", | |
" <td>3</td>\n", | |
" <td>2.5</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-012d23fc-c546-4bf8-945e-112263b9de02')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-012d23fc-c546-4bf8-945e-112263b9de02 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-012d23fc-c546-4bf8-945e-112263b9de02');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 12 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"# Changelog\n", | |
"\n", | |
"```\n", | |
"- 20220613 - 1.1.0 / v0.4.1 - perbaikan, ubah source_dist jadi None dengan default scipy kecuali gumbel.\n", | |
"- 20220317 - 1.0.0 - Initial\n", | |
"```\n", | |
"\n", | |
"#### Copyright © 2022 [Taruma Sakti Megariansyah](https://taruma.github.io)\n", | |
"\n", | |
"Source code in this notebook is licensed under a [MIT License](https://choosealicense.com/licenses/mit/). Data in this notebook is licensed under a [Creative Common Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/). \n" | |
], | |
"metadata": { | |
"id": "PjG-gD6kLUnt" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment