Formulae Auto-Derivation for Nested Logit Models

This file uses the Symbolic Python (SymPy) package to derive the elasticity formulae for Nested Logit Models. SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily …

more ...

Using Jupyter Notebook with Pelican in Windows

Update: This solution does not work with nbconvert >= 6. Tested on nbconvert == 5.6.1.

Jupyter-Pelican is a plugin that helps Pelican to generate static contents from Jupyter notebook. I like it because it allows the user to put the metadata in the first cell of the notebook. No need to create a separate file for the metadata or edit the metadata of the notebook. However, this option will encounter a permission denied error on Windows OS because Windows does not allow (at least easily) openning a temporary file for a second time, according to the documentation of tempfile.NamedTemporaryFile more ...


Creating Pretty Tables in Python with PTable

Creating an output table in Python using PTable is fast and easy. This article introduces the most useful functionalities of PTable, such as adding rows and columns, changing text alignment and floating number format, and clearing data, to get a quick start to make the ideal table in no time …

more ...

Calculating t-statistic for OLS Regression in Python

In a previous article, we calculated the OLS estimate and its variance using only the Numpy package in Python. In most cases, we would also need the t-statistic and its p-value to see if the coefficients we got are statistically significant. To achieve this, we will use SciPy, a powerful …

more ...

Ordinary Least Squares Regression in Python from Scratch

This article introduces how to calculate the coefficients for an Ordinary Least Squares regression in Python using only the NumPy package. NumPy is the fundamental package for scientific computing with Python. It performs in some way similar to R. First, let us import the NumPy package.

# Import NumPy
import numpy …
more ...

How to Install Rpy2 in Windows 10

Rpy2 is a popular Python interface to R. It allows Python users to enjoy the breadth and depth of R packages in Python. Yet, unlike in UNIX-like operating systems, it is not straightforward to install and set up rpy2 in Windows. This article shows a simple way to install the …

more ...