CCAPM is different from the traditional CAPM. Here is the 'root' formula of the consumption-based model of asset pricing:
p = E(m x) = E(x* x) = <x*, x>
where
p - the asset price
m - stochastic discount factor
x - payoff
x* - the unique discount factor in the payoff space X.
This video explains it in details.
This blog is made to post some interesting things on Software Development and Quantitative Analysis. (T.Liu)
Friday, February 20, 2015
Friday, January 30, 2015
Financial Data for Statistical Learning
There are plenty of financial and economic data which can be used in Machine Learning and Data Mining exercises. Here is list of mine:
FRED - Federal Research Economic Data.
CRSP - Center for Research in Security Prices
Ken-French - Fama-French 3-factor model data
John Cochrane - Data and Programs, Liquidity factor, Grumpy Economist.
Robet Shiller - Online data, and other research data.
Web Scraping is the new way to get the free "real-time" data.:)
Here is introduction given by Christopher Reeves.
Python (urllib, re, scrapy) and R(quantmod) are my favorite languages for FIN/ECON data scraping.
FRED - Federal Research Economic Data.
CRSP - Center for Research in Security Prices
Ken-French - Fama-French 3-factor model data
John Cochrane - Data and Programs, Liquidity factor, Grumpy Economist.
Robet Shiller - Online data, and other research data.
Web Scraping is the new way to get the free "real-time" data.:)
Here is introduction given by Christopher Reeves.
Python (urllib, re, scrapy) and R(quantmod) are my favorite languages for FIN/ECON data scraping.
Saturday, January 24, 2015
ffn
Intruction to ffn - Financial Functions for Python
ffn is a Python library for quantitative finance. It stands on the shoulders of giants (Pandas, Numpy, Scipy, etc.) and provides a vast array of utilities, from performance measurement and evaluation to graphing and common data transformations.
Its APIs support data retrieval, data manipulation, performance measurement, numerical routines and financial functions.
Statistical Significance vs. Economic Significance
Statistical Significance
|
Economic significance
|
Is it fitted well?
|
Is it an important factor?
|
[large] t-stat or [small] p-value
|
[large] bj values
|
Low t-stat => need more sample data?
|
Small bj values => Multicollinearity?
|
This is a sample regression output from fitlm() in Matlab:
Linear regression model:
y ~ 1 + x1
Estimated Coefficients:
Estimate SE tStat pValue
(Intercept) 0.0028283 0.0023652 1.1958 0.23514
x1 0.91903 0.045009 20.419 2.5487e-34
Number of observations: 86, Error degrees of freedom: 84
Root Mean Squared Error: 0.0143
R-squared: 0.832, Adjusted R-Squared 0.83
F-statistic vs. constant model: 417, p-value = 2.55e-34
Linear regression model:
y ~ 1 + x1
Estimated Coefficients:
Estimate SE tStat pValue
(Intercept) 0.0028283 0.0023652 1.1958 0.23514
x1 0.91903 0.045009 20.419 2.5487e-34
Number of observations: 86, Error degrees of freedom: 84
Root Mean Squared Error: 0.0143
R-squared: 0.832, Adjusted R-Squared 0.83
F-statistic vs. constant model: 417, p-value = 2.55e-34
Saturday, November 29, 2014
Machine Learning vs Statistics (Statistical Learning)
In a sense, the difference between Machine Learning and Statistics (Statistical Learning) is what is the difference between a computer scientist and a statistician. In my humble opinion, they are becoming more similar as time goes by. On the other hand, Machine Learning is probably more empirical and works on problems by utilizing various optimization algorithms while Statistics (Statistical Learning) is more emphasizing on the assumptions and model validation -- more rigorous in mathematics and more often to talk about VC dimensions, KL divergence, conjugate prior, and etc. In practice, ML uses Matlab or Python while SL favors R.
Rob Tibshirani, the author of "The Elements of Statistical Learning" gave a 'comparison of machine learning and statistics, here is a screenshot for your convenience:
In useR! 2004, Brian D. Ripley, another statistician, said: 'machine learning is statistics minus any checking of models and assumptions'.
A lecturer at Udacity gives a good comparison in one sentence, "Statistics focuses on analyzing the existing data and drawing valid conclusions, while Machine Learning focuses on making prediction and less worrying about the assumption as long as it makes good predictions".
Since 2001, the comparison become less member the things have changed when William Cleveland introduced "data Science" as an independent discipline. As JOHN MOUNT said, "Machine learning and statistics may be the stars, but data science orchestrates the whole show."Monday, November 17, 2014
Network Analysis with NetworkX
NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.
NetworkX has been integrated with PyGraphviz, which is a Python interface to Graphviz -- the excellent open-source drawing tools initiated by AT&T Labs Research).
Here is the notes to build and integrate the Graphviz with NetworkX.
1, Install NetworkX
I have WinPython 2.7, so installing NetworkX with WinPython's control panel is simple.
2, Install Graphviz
Install Graphviz in "C:\graphviz"
Add "C:\graphviz\bin" in PATH environment variable.
Copy "C:\graphviz\include\graphviz" to "\python-2.7.x\include\"
Copy cdt.lib and cgraph.lib in "C:\graphviz\lib\release\lib" to "\python-2.7.x\libs\"
3. Configure Visual C++ Compiler
set VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
4. Build and Install PyGraphviz
Open command prompt in WinPython and run
pip install pygraphviz-1.3rc2.zip
Now import pygraphviz to test and start to use it with NetworkX.
NetworkX has been integrated with PyGraphviz, which is a Python interface to Graphviz -- the excellent open-source drawing tools initiated by AT&T Labs Research).
Here is the notes to build and integrate the Graphviz with NetworkX.
1, Install NetworkX
I have WinPython 2.7, so installing NetworkX with WinPython's control panel is simple.
2, Install Graphviz
Install Graphviz in "C:\graphviz"
Add "C:\graphviz\bin" in PATH environment variable.
Copy "C:\graphviz\include\graphviz" to "\python-2.7.x\include\"
Copy cdt.lib and cgraph.lib in "C:\graphviz\lib\release\lib" to "\python-2.7.x\libs\"
3. Configure Visual C++ Compiler
set VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
4. Build and Install PyGraphviz
Open command prompt in WinPython and run
pip install pygraphviz-1.3rc2.zip
Now import pygraphviz to test and start to use it with NetworkX.
Sunday, October 12, 2014
Java Style Guide
Checkstyle is a tool to facilitate the use of coding standard. It allows us to define a coding style, and it can then check if our code follows the style automatically.
Not surprisingly, there exists an Eclipse plugin for Checkstyle. The URL of Checkstyle update site is:
http://eclipse-cs.sf.net/update/
This is a sample checkstyle.xml of Google's Java Style Guide: google_checks.xml
Note that google_checks.xml is created for CheckStyle(CS) 5.8, not for CS 5.7. Since the Eclipse Plugin for CheckStyle is integrated with CS 5.7 (as of 10/12/2014), we may need to wait until the plugin is migrated to CS 5.8.
Not surprisingly, there exists an Eclipse plugin for Checkstyle. The URL of Checkstyle update site is:
http://eclipse-cs.sf.net/update/
This is a sample checkstyle.xml of Google's Java Style Guide: google_checks.xml
Note that google_checks.xml is created for CheckStyle(CS) 5.8, not for CS 5.7. Since the Eclipse Plugin for CheckStyle is integrated with CS 5.7 (as of 10/12/2014), we may need to wait until the plugin is migrated to CS 5.8.
Subscribe to:
Posts (Atom)
