diff --git a/tobit.ipynb b/tobit.ipynb index 7edb39c..b34e22f 100644 --- a/tobit.ipynb +++ b/tobit.ipynb @@ -2,20 +2,14 @@ "cells": [ { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The autoreload extension is already loaded. To reload it, use:\n", - " %reload_ext autoreload\n" - ] + "collapsed": false, + "jupyter": { + "outputs_hidden": false } - ], + }, + "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", @@ -37,9 +31,12 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [], "source": [ @@ -47,110 +44,20 @@ "ns = 100\n", "nf = 10\n", "x, y_orig, coef = make_regression(n_samples=ns, n_features=nf, coef=True, noise=0.0, random_state=rs)\n", - "x = pd.DataFrame(x)\n", + "x = pd.DataFrame(x, columns=[f'feature_{i}' for i in range(1, nf+1)])\n", "y = pd.Series(y_orig)" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "image/png": [ - "iVBORw0KGgoAAAANSUhEUgAAAXIAAAEACAYAAACuzv3DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\n", - "AAALEgAACxIB0t1+/AAAEYtJREFUeJzt3V2M5XV9x/H3BxYEpLIlmGUrJNBGGmzTLkiRqpUBwSIx\n", - "gBe1ktjSShtjK1DbqoAXO+qFVAN60dQLAbPFh9aiEoitslKO0VgR7S4uT0UiVGjZWVsQMdQUy7cX\n", - "5z9ynOzsnHNmzp7z232/khP+j+f/YXbms7/zf9hJVSFJatcB0w4gSVodi1ySGmeRS1LjLHJJapxF\n", - "LkmNs8glqXFDFXmSA5NsS3JLN39kkq1JHkhya5L1k40pSVrOsCPyy4B7gcWbzi8HtlbVCcBt3bwk\n", - "aQpWLPIkxwDnAtc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N8mP4g86dmIWeSXwL+jP4p\n", - "lieBf0jypsFthsk5VpFX1XLFTJKPV9VZ3eyN9D9+Qf8Uy7EDmx7Dc6ddJmKFnG8FPtttd2d3IfGo\n", - "WcqZ5Ffpjyzu6n6gjwG+leRls5RzUZI/oP+R+9UDi/d6zhUszXMsP/uJYWqSHES/xG+oqpu6xQtJ\n", - "jq6qnUk2ArumlxCAlwPnJTkXOAR4QZIbmL2cj9L/JHtnN38j/UHRzhnLeQrwtar6b4AknwV+kxFz\n", - "TuLUyoNJTu+mzwQe6KZvBt6Y5OAkx9M/tfGNCRx/WDfRz0eSE4CDq+q/mKGcVXV3VW2oquOr6nj6\n", - "35wndx+5ZiYn9O8Eof9x+/yq+vHAqpnKCXwTeHGS45IcDPxul3Gq0v+b+jrg3qr68MCqm+lf/KL7\n", - "701L992bqurKqjq2+358I/DPVfV7zF7OncAj3c82wFnAPcAtzFBO4H7gtCSHdt8DZwH3MmrOCVyF\n", - "PYX+ub3twL8AJw2su5L+xa776e5smdaL/h0LNwA7gG8Bc7OYc0nm79LdtTJrOYHvAP8ObOtefzOL\n", - "Obs8r6V/V8iDwBXTztNleiX9c87bB76G5wBHAl+iPyC6FVg/7awDmU/nubtWZi4n8OvAncBd9D99\n", - "HzGjOd9J/y+ZHfQvbB40ak4fCJKkxvk7OyWpcRa5JDXOIpekxlnkktQ4i1ySGmeRS1LjLHJJapxF\n", - "LkmN+3+0hvCCD2bOdQAAAABJRU5ErkJggg==\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" + "collapsed": false, + "jupyter": { + "outputs_hidden": false } - ], + }, + "outputs": [], "source": [ "n_quantiles = 3 # two-thirds of the data is truncated\n", "quantile = 100/float(n_quantiles)\n", @@ -167,9 +74,12 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [], "source": [ @@ -179,184 +89,14 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "image/png": [ - "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEZCAYAAABxbJkKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\n", - "AAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xm4HVWZ7/HvD0KAMBgmk0AHEtGo4MQg0gKaYNQIdC5q\n", - "i4J4I50LXlsF24mAIEFtBYcLNP2oVwQ6jRAZFMR2ygETmxZEYwMBAkQ0EKachCmEecjbf6y1TWVz\n", - "9j77xFO7Tk79Ps9Tz65aNb1773Pq3bWqai1FBGZmVk8bVR2AmZlVx0nAzKzGnATMzGrMScDMrMac\n", - "BMzMasxJwMysxpwEakrSZEn3tJn/bUkndTMmG5ok3SXpbR0u+2FJ15Qdkw0eJ4FhQNLjklbnYY2k\n", - "JwvTh6/PNiPioxHx5bz9tgmjTJJ2k3SlpEclPSbpV5L+tjB/Qn7PL/pbljRa0nmSHsjr3iHp+O6+\n", - "g2Eh8jCoJM2WdMFgb9cGxklgGIiILSNiq4jYCrgbOKQxHRFzq45vfUnaFfgNcBMwARgHXA7Mk7Rv\n", - "B5s4AxgFvCoitgamA3eWE+2GQdKIqmOwocVJYBiTtKmkMyXdl4czJI1sWuYESSslLZV0RKH83yR9\n", - "SdIo4OfAjvnM4jFJY5u28ab8a1uFsndLuimP7yNpoaRVkpZL+maHb2E28JuIODkiHo2IJyLibOAC\n", - "4PQO1t8bmBsRqwAi4o6I+GGrhSVNl3SrpEckzZf0qsK8uyR9WtJN+azkB5I2bbOtoyUtzp/XrZL2\n", - "yOU7SvqhpBWS/izpE4V1Zku6RNKcvN4tkvYqzD9e0r153u2SDszlLb/nfBZ3r6TPSXoAOFfJLEl3\n", - "SnpQ0sWStins50OS7s7zTmz3AUvaLp+prZJ0PbBr0/yzJC3L8xdK2j+XTwNOAN6f/65uyOVHFT63\n", - "P0k6pt3+bRBEhIdhNABLgQPz+BeBa4Ht8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gL/Ny8wEzsnVPKOAVYV1i9tuFf9hkm7J6+9OquZ5LXB9\n", - "LvsC8OX82RwFXCppEfA88J1inGbtuClpsxJI2iIinsjjs0h9v/5TxWGZvYivCZiV42BJJ5D+x+4i\n", - "3RVkNuT4TMDMrMZ8TcDMrMacBMzMasxJwMysxpwEzMxqzEnAzKzGnATMzGrsfwAON0N+IMktSQAA\n", - "AABJRU5ErkJggg==\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" + "collapsed": false, + "jupyter": { + "outputs_hidden": false } - ], + }, + "outputs": [], "source": [ "fig, ax = plt.subplots()\n", "ind = np.arange(len(coef))\n", @@ -387,7 +127,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "## Commands in R for Tobit analysis of Affairs data:\n", @@ -411,116 +154,14 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
affairsgenderageyearsmarriedchildrenreligiousnesseducationoccupationrating
0 0 1 37 10.00 0 3 18 7 4
1 0 0 27 4.00 0 4 14 6 4
2 0 0 32 15.00 1 1 12 1 4
3 0 1 57 15.00 1 5 18 6 5
4 0 1 22 0.75 0 2 17 6 3
\n", - "
" - ], - "text/plain": [ - " affairs gender age yearsmarried children religiousness education \\\n", - "0 0 1 37 10.00 0 3 18 \n", - "1 0 0 27 4.00 0 4 14 \n", - "2 0 0 32 15.00 1 1 12 \n", - "3 0 1 57 15.00 1 5 18 \n", - "4 0 1 22 0.75 0 2 17 \n", - "\n", - " occupation rating \n", - "0 7 4 \n", - "1 6 4 \n", - "2 1 4 \n", - "3 6 5 \n", - "4 6 3 " - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" + "collapsed": false, + "jupyter": { + "outputs_hidden": false } - ], + }, + "outputs": [], "source": [ "data_file = 'tobit_data.txt'\n", "df = pd.read_table(data_file, sep=' ')\n", @@ -534,24 +175,14 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "-1 451\n", - " 0 150\n", - "dtype: int64" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" + "collapsed": false, + "jupyter": { + "outputs_hidden": false } - ], + }, + "outputs": [], "source": [ "y = df.affairs\n", "x = df.drop(['affairs', 'gender', 'education', 'children'], axis=1)\n", @@ -562,9 +193,12 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [], "source": [ @@ -574,22 +208,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([-0.17933256, 0.55414179, -1.68622027, 0.32605329, -2.2849727 ])" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" + "collapsed": false, + "jupyter": { + "outputs_hidden": false } - ], + }, + "outputs": [], "source": [ "tr.coef_" ] @@ -604,23 +230,23 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" + "pygments_lexer": "ipython3", + "version": "3.12.0" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 4 } diff --git a/tobit.py b/tobit.py index 61fc9e1..7e70f54 100644 --- a/tobit.py +++ b/tobit.py @@ -153,7 +153,7 @@ def fit(self, x, y, cens, verbose=False): self.ols_coef_ = b0[1:] self.ols_intercept = b0[0] if self.fit_intercept: - self.intercept_ = result.x[1] + self.intercept_ = result.x[0] self.coef_ = result.x[1:-1] else: self.coef_ = result.x[:-1]