Skip to content

Commit

Permalink
Merge pull request #29 from alexanderlata/main
Browse files Browse the repository at this point in the history
fix typos and add critical value for het_white
  • Loading branch information
artamonoff authored May 11, 2024
2 parents d0719f4 f5bda67 commit 4d3da5b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 15 deletions.
61 changes: 47 additions & 14 deletions econometrica-1/jupyter-notebooks/diagnostic-het.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -133,7 133,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -143,7 143,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -164,16 164,16 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(44.53371850842671, 4.970083203924699e-09)"
"(44.53371850842652, 4.970083203925146e-09)"
]
},
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -193,16 193,16 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11.070497693516351"
"9.487729036781154"
]
},
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -211,7 211,7 @@
"# Задаём уровень значимости\n",
"sign_level = 0.05\n",
"# Критическое значение распределения chi2\n",
"chi2.ppf(q=1-sign_level, df=mod.exog.shape[1])"
"chi2.ppf(q=1-sign_level, df=mod.df_model)"
]
},
{
Expand All @@ -238,16 238,16 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(75.45405182710722, 3.0150449532093895e-11)"
"(75.45405182710691, 3.0150449532098e-11)"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -258,6 258,39 @@
"lm, lm_pvalue"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Критическое значение $\\chi^2$-распределения"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"23.684791304840576"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Задаём уровень значимости\n",
"sign_level = 0.05\n",
"# Найдем степени свободы\n",
"k = mod.df_model # число регрессоров\n",
"df_white = 2 * k k * (k-1) / 2\n",
"# Критическое значение распределения chi2\n",
"chi2.ppf(q=1-sign_level, df=df_white)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -288,7 321,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
24 changes: 23 additions & 1 deletion econometrica-1/jupyter-templates/diagnostic-het-template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 95,7 @@
"# Задаём уровень значимости\n",
"sign_level = \n",
"# Критическое значение распределения chi2\n",
"chi2.ppf(q=1-sign_level, df=mod.exog.shape[1])"
"chi2.ppf(q=1-sign_level, df=mod.df_model)"
]
},
{
Expand Down Expand Up @@ -130,6 130,28 @@
"lm, lm_pvalue"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Критическое значение $\\chi^2$-распределения"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Задаём уровень значимости\n",
"sign_level = \n",
"# Найдем степени свободы\n",
"k = mod.df_model # число регрессоров\n",
"df_white = 2 * k k * (k-1) / 2\n",
"# Критическое значение распределения chi2\n",
"chi2.ppf(q=1-sign_level, df=df_white)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 4d3da5b

Please sign in to comment.