{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## Case 1 ##\n", "\n", "How does intelligence and education impact the level of income?\n", "\n", "Use the following data:\n", "'https://github.com/masterfloss/data/blob/main/exerciseInt.xlsx?raw=true'\n", "\n", "In order to estimate a regression, import the statsmodels module (https://www.statsmodels.org):\n", "\n", "`\n", "import statsmodels.api as sm\n", "model = sm.OLS(y, X).fit()\n", "predictions = model.predict(X) \n", "model.summary()\n", "`\n", "* y may be a serie with data correponding to the target (or dependent variable)\n", "* X may be a dataframe with data corresponding to the features (or independent variable)\n", "\n", "1. Create several models using different features\n", "2. Use several regressors\n", "3. Compare the accuracy of each model using each regressor \n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df=pd.read_excel('https://github.com/masterfloss/data/blob/main/exerciseInt.xlsx?raw=true')" ] } ], "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.9.7" } }, "nbformat": 4, "nbformat_minor": 2 }