{"nbformat":4,"nbformat_minor":0,"metadata":{"kernelspec":{"display_name":"Python 3 (Anaconda 2019)","env":{"LD_LIBRARY_PATH":"/ext/anaconda-2019.03/lib","PROJ_LIB":"/ext/anaconda-2019.03/share/proj","PYTHONHOME":"/ext/anaconda-2019.03/lib/python3.7","PYTHONPATH":"/ext/anaconda-2019.03/lib/python3.7:/ext/anaconda-2019.03/lib/python3.7/site-packages"},"language":"python","metadata":{"cocalc":{"description":"Python/R distribution for data science","priority":5,"url":"https://www.anaconda.com/distribution/"}},"name":"anaconda2019"},"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.7.3"},"colab":{"name":"LinearRegression-Display.ipynb","provenance":[],"collapsed_sections":[]}},"cells":[{"cell_type":"markdown","metadata":{"collapsed":false,"id":"LEcIcxdp9SF8"},"source":["# Linear Regression Using Python"]},{"cell_type":"markdown","metadata":{"collapsed":false,"id":"rFu_ELMK9SGD"},"source":["## Theory"]},{"cell_type":"markdown","metadata":{"collapsed":false,"id":"CovRyeP-9SGF"},"source":["Suppose that you want to fit a set data points $(x_i,y_i)$, where\n","$i = 1,2,\\ldots,N$, to a straight line, $y=ax+b$. The process of determining the best-fit line is called linear regression. This involves choosing the parameters $a$ and $b$ to minimize the sum of the squares of the differences between the data points and the linear function. How the difference are defined varies. If there are only uncertainties in the y direction, then the differences in the vertical direction (the gray lines in the figure below) are used. If there are uncertainties in both the $x$ and $y$ directions, the orthogonal (perpendicular) distances from the line (the dotted red lines in the figure below) are used."]},{"cell_type":"markdown","source":["