Wednesday, June 20, 2012

api for plots

In regard to the code for the plots, the function is:

 mv_mean_contour(self, mu1_l, mu1_u, mu2_l, mu2_u, step1, step2,
                        levs=[.2, .1, .05, .01, .001], plot_dta=False)

The user enters the mean ranges of both variables and the interval in which to conduct a joint hypothesis test of the means.  Before, these had to be entered by the user because there were problems with hypothesis tests with very large likelihood ratios.  however, I think I fixed this problem and can now make all of the input parameters optional.  It will take some fiddling first. 

Sunday, June 10, 2012

Optimization

I knew that coming into this project, being familiar with numerical optimization methods would be important.  As the "beginning" period has ended and the "stretch" has begun, I am happy to say that I already learned the theory and implementation of Newton's method for optimization.  With the exception of simulated annealing, this is the only optimization method I feel comfortable enough with the theory to be able to code it myself and know when it is appropriate and when it isn't.  Constant learning is without question the top benefit of participating in GSOC.

On another note, I had some fun with empirical likelihood confidence regions.  Below is a plot of the confidence regions for the mean daily percent return for the Google and Microsoft stock from June 10, 2011 to June 10, 2012.

and here is the same thing but for only the last 30 trading days and the actual returns plotted. 


Monday, May 28, 2012

Week 1 wrap up

To my surprise, week 1 went smoother than I had imagined.  The key contributor to that is the requirement to submit a patch for my application to GSOC.  Submitting the patch forced me to learn some of the statsmodels conventions as well as some new tricks in Python.  Without having that foundation, my progress would have been much slower.

In week one I laid the foundation for EL by creating an class to initialize El statistics, a class of helper functions that are either optimized or searched for a root and the class of EL functions the end user would see.  Although the only end-user implementation has been hypothesis tests and confidence intervals for the mean, the class of helper functions will be able to be reused later and make further progress even faster. 

For this week, I hope to implement hypothesis tests and confidence intervals for variance and covariance as well as hypothesis tests for the multivariate case.  Although not in my original plan, if there is time I would like to add some 2d confidence region plots.

On another note, I have officially made this my official GSOC theme song

Saturday, May 12, 2012

Still Reading

As I am eager to get started, I am still reading and researching.  One paper that I found helpful was by Bera and Bilas  "The MM, ME, ML, EL, EF and GMM approaches to estimation: a synthesis."  This paper stirred some ideas on how to make the EL project as general as possible so some of the implementations can be used in other models. 

Sunday, May 6, 2012

Tick Tock

I am waiting for the semester to end so that I can focus my full time on my GSOC project.  Last week was finals week for me so I didn't get to do much thinking about empirical likelihood.  However, two Py-stat related events did happen.

First, I had a meeting with a professor to discuss how I can continue contributing to statsmodels after GSOC.  To say the least, the options are limitless.

Secondly, I found out I will actually be taking an Empirical Likelihood class next semester.  I wanted to make sure it wouldn't duplicate what I will be doing for GSOC so I email the professor.  She responded, "most materials are not covered by Owen's book, because they are from my own past few years' research."  This is very exciting since this summer I will be able to tie down the basics of e.l. and next semester I will bring my knowledge (and of course statsmodels) to the frontier. 

Thursday, April 26, 2012

Accepted!

I found out on Monday that my project, "Empirical Likelihood in Statsmodels" was accepted for GSoC.  It was great news for me and I am eager to get started.

Submitting the patch as part of the application proved to be very helpful.  Spending a couple days just reading the current code really helped me determine exactly how I will be organizing my project.  Also, going through the code drilled in how classes work in Python and I found out what class inheritance was and how to use it.

This week I will be in contact with my mentor(s) to discuss some more of the structure of my project.  I also hope to use the next couple days to get more familiar with git-hub.   I want to make sure that I have all the essentials tightened up before the official coding period begins.   

Wednesday, April 4, 2012

It begins...kind of

As the application period comes to an end, I realized I put as much thought into my application as a hefty class assignment.  In fact, I would say that just putting the application together helped me to better understand the material that I hope to code for statsmodels this summer and taught me as much if not more than a typical class project usually does.

Briefly, I proposed to implement empirical likelihood estimation in python.  Empirical likelihood is a non-parametric method of estimation that gives observed data a very loud voice.  I am particularly  drawn to this and nonparametric statistics in general  for 2 (main) reasons. 

First, it frees the researcher from many of the distributional assumptions that are typically found in standard econometrics and statistics textbooks.  Although there are countless reasons to remove these assumptions,  one is to predict movements in stock prices.  Many classical models rely on assumptions or normality (or Brownian motion), when forecasting stock prices or pricing options.  However, it has been shown that stock prices follow a distribution with heavy tails.  Ignoring these fat tails (higher probabilities of large movements) can be problematic for researchers and practitioners alike.

The second reason I am attracted to empirical likelihood and nonparametric statistics is more pragmatical (or lazy, however you look at it).  Statisticians spend plenty of resources deriving complicated analytical solutions that only apply "in the limit" and can often be very misleading when used in finite samples among people who are unsure of their worth.  While these are sometimes helpful for practitioners or policy maker that only wants to "throw" a couple variables into a statistical software, it seems as though the derivation of these analytical solutions is somewhat of a mis-allocation of resources (brain power of some very smart people) since specific questions can be answered much more easily through other computational methods.  Undoubtedly though,  we will never stop developing these nice, pretty analytical solutions.  It is in out nature.

"One reason comes from our wish, as theoreticians, to explore the source of the a priori practical principles that lie in our reason.  " -Immanuel Kant, Groundwork of the Metaphysics of Morals.