{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Estimation: Bias and Verification of Standard Errors\n", "\n", "Methods/Functions\n", "\n", "`mean`, `var`, `RandomState`, `RandomState.chisquare`, `array`, `DataFrame.plot.kde`, `stats.norm.ppf`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 25\n", "Simulate a set of i.i.d. $\\chi_{5}^{2}$ random variables and use the method of moments\n", "to estimate the mean and variance." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-09-28T12:33:31.192145Z", "iopub.status.busy": "2023-09-28T12:33:31.192145Z", "iopub.status.idle": "2023-09-28T12:33:31.367280Z", "shell.execute_reply": "2023-09-28T12:33:31.367280Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 26\n", "Compute the asymptotic variance of the method of moment estimator." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-09-28T12:33:31.371290Z", "iopub.status.busy": "2023-09-28T12:33:31.370292Z", "iopub.status.idle": "2023-09-28T12:33:31.384589Z", "shell.execute_reply": "2023-09-28T12:33:31.383576Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 27\n", "Repeat Exercises 24 and 25 a total of 1000 times.\n", "Examine the finite sample bias of these estimators relative to the true values." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-09-28T12:33:31.387587Z", "iopub.status.busy": "2023-09-28T12:33:31.387587Z", "iopub.status.idle": "2023-09-28T12:33:31.467651Z", "shell.execute_reply": "2023-09-28T12:33:31.466643Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 28\n", "Repeat Exercises 24 and 25 a total of 1000 times.\n", "Compare the covariance of the estimated means and variance (1000 of each) to the asymptotic covariance of the parameters (use the average of the 1000 estimated variance-covariances). Are these close? How does the sample size affect this?" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-09-28T12:33:31.470651Z", "iopub.status.busy": "2023-09-28T12:33:31.470651Z", "iopub.status.idle": "2023-09-28T12:33:31.475691Z", "shell.execute_reply": "2023-09-28T12:33:31.475691Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 29\n", "In the previous problem, for each parameter, form a standardized parameter estimate as\n", "\n", "$$z_{i}=\\frac{\\sqrt{n}\\left(\\hat{\\theta}_{i}-\\theta_{i,0}\\right)}{\\sqrt{\\hat{\\Sigma}_{ii}}}$$ \n", "\n", "where\n", "\n", "$$\\sqrt{n}\\left(\\hat{\\theta}-\\theta_{0}\\right)\\stackrel{d}{\\rightarrow} N\\left(0,\\Sigma\\right)$$\n", "\n", "so that $\\hat{\\Sigma}$ is the estimated asymptotic covariance. What percent of these $z_{i}$\n", "are larger in absolute value than 10%, 5% and 1% 2-sided critical values from a normal?" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-09-28T12:33:31.475691Z", "iopub.status.busy": "2023-09-28T12:33:31.475691Z", "iopub.status.idle": "2023-09-28T12:33:32.918690Z", "shell.execute_reply": "2023-09-28T12:33:32.918690Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 30\n", "Produce a density plot of the $z_{i}$ standardized parameters and compare to a standard normal." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-09-28T12:33:32.921697Z", "iopub.status.busy": "2023-09-28T12:33:32.921697Z", "iopub.status.idle": "2023-09-28T12:33:34.193871Z", "shell.execute_reply": "2023-09-28T12:33:34.193871Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 31\n", "Repeat the same exercise for the Bernoulli problem from the previous question." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-09-28T12:33:34.197982Z", "iopub.status.busy": "2023-09-28T12:33:34.196933Z", "iopub.status.idle": "2023-09-28T12:33:34.302643Z", "shell.execute_reply": "2023-09-28T12:33:34.301637Z" } }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" }, "pycharm": { "stem_cell": { "cell_type": "raw", "metadata": { "collapsed": false }, "source": [] } } }, "nbformat": 4, "nbformat_minor": 4 }