A. Colin Cameron: Python for Regression

Python is a low-level language. Statistical analysis additionally uses several python packages.
Rather than directly install Python it is best to install Anaconda.
This installs base Python plus many packages,
including Numpy, Pandas, SciKit-Learn, TensorFlow, StatsModels.

Once Anaconda is installed you can run a Python program from within Anaconda.
For example, use the Spyder GUI interface (which is simlar to R Studio for R).

It can be useful to run Python within Stata.
This can be particularly useful for setting up data in Stata and then transferring data from Stata to Python.

Install and use Anaconda

Link Stata to Python

Some Python coding tips

Python regression example

Python within Stata example

carsdata.csv

carsdata.dta


A. Colin Cameron / UC-Davis Economics /  http://www.econ.ucdavis.edu/faculty/cameron