BLOG

What is a Python Dictionary

Tags : 

Python Dictionary Python Dictionary¶ Dictionary is a method in which data is stored in pairs of keys and values. These are also called Associative Arrays in other programming languages. What is key-value pair?¶ key is a unique identifier for a given record. Values are data stored in that identifier. For example, Let us say that

Read More

Getting Started with Data Visualization in Python Pandas

Tags : 

DOWNLOAD DATASETS¶ To download the datasets used in this tutorial, pleas see the following links 1. gapminder.tsv 2. pew.csv 3. billboard.csv 4. ebola.csv 5. tips.csv TED Talk Dataset Excercises¶ In [5]: # Change directory In [6]: cd "D:\Dropbox\CLASSES\Data Science for Finance\Python\Lecture 1 – Assignment" D:\Dropbox\CLASSES\Data Science for Finance\Python\Lecture 1 – Assignment In [7]: import pandas as pd In [8]:

Read More

asrol Cumulative Returns Over 12-months, skipping the Current month

Anomaly Hunters has asked: How Can I find cumulative returns from month T-1 to T-12, i.e. not including the current month in the calculation. I want to do it on a rolling window for each firm. Let us use a small dataset. We shall create this dataset in Stata with the following code clear input

Read More

Step-by-Step: Portfolio Risk in Stata and Excel

Portfolio Risk in Excel To build our concept of the portfolio risk, we shall calculate it first manually in EXCEL, then we shall replicate the results using matrix notations in Stata. Consider the following set of returns for two assets, i.e asset A and B.     A       B    .249917 .819483 .739069 .821416 .895491 .276843 .902722 .001586

Read More

How Fama and French June to July Portfolios are Constructed?

Tags : 

The description of portfolios’ construction given in various Fama and Fench papers is usually confusing for many researchers, especially those who are new to asset pricing models. The typical language used in Fama and French papers reads like this The size breakpoint for year t is the median NYSE market equity at the end of

Read More

fillmissing: Fill Missing Values in Stata

Tags : 

This post presents a quick tutorial on how to fill missing values in variables in Stata. This tutorial uses fillmissing program which can be downloaded by typing the following command in Stata command window net install fillmissing, from(http://fintechprofessor.com) replace   Important Note: This post does not imply that filling missing values is justified by theory.

Read More

Export output of Table command from Stata to Word using asdoc

Exporting tables from table command was the most challenging part in asdoc programming. Nevertheless, asdoc does a pretty good job in exporting table from table command. asdoc accepts almost all options with table command, except cellwidth(#), stubwidth(#), and csepwidth(#).   7.1 One-way table Example 54 : One-way table; frequencies shown by default sysuse auto, clearasdoc

Read More

Customized tables using option row() of asdoc – Stata

This is rather a quick example of how to use option row() of asdoc for creating highly customized tables. We are interested in a table that is given bellow. * Load example dataset sysuse auto,clear *Write the header row of the table with table title asdoc, row(Dependent variable:domestic or foreign, Domestic mean/frequency, Domestic SD, Foreign

Read More

tabstat with asdoc in Stata

asdoc makes some elegant tables when used with tabstat command. There are several custom-made routines in asdoc that creates clean tables from tabstat command. asdoc fully supports the command structure and options of tabstat. And, yes asdoc allows one additional statistics, that is, t-statistics alongside the allowed statistics in tabstat. For reporting purposes, asdoc categorizes

Read More

Quick setup of Python with Stata 16

Tags : 

With the announcement of Stata 16, Python commands can be executed directly from the Stata command prompt, do files or ado programs. That would definitely expand the possibilities of doing extraordinary things without leaving the Stata environment. However, this integration exposes Stata to all the problems of Python installations and its packages. First of all,

Read More