Clicky

馃榿 Are We Getting Happier?

Note: This post was originally written using Julia v0.2, GLPK, and Hedonometer data through 2014. It has been updated to use Julia v1.11, HiGHS, and data through May 26, 2025. Hedonometer popped onto my radar a couple weeks ago. It鈥檚 a nifty project, attempting to convert samples of words found in the Twitter Gardenhose feed into a time series of happiness. While I鈥檓 not a computational social scientist, I must say the data does have a nice intuitive quality to it. There are obvious trends in happiness associated with major holidays, days of the week, and seasons. It seems like the sort of data that could be decomposed into trends based on those various components. The Hedonometer group has, of course, done extensive analyses of their own data which you can find on their papers page. ...

July 18, 2014 路 Ryan O'Neil

馃 Data Fitting 2a - Very, Very Simple Linear Regression in R

Note: This post was updated to include an example data file. I thought it might be useful to follow up the last post with another one showing the same examples in R. R provides a function called lm, which is similar in spirit to NumPy鈥檚 linalg.lstsq. As you鈥檒l see, lm鈥檚 interface is a bit more tuned to the concepts of modeling. We begin by reading in the example CSV into a data frame: ...

February 16, 2011 路 Ryan O'Neil

馃 Data Fitting 2 - Very, Very Simple Linear Regression in Python

This post is based on a memo I sent to some former colleagues at the Post. I鈥檝e edited it for use here since it fits well as the second in a series on simple data fitting techniques. If you鈥檙e among the many enlightened individuals already using regression analysis, then this post is probably not for you. If you aren鈥檛, then hopefully this provides everything you need to develop rudimentary predictive models that yield surprising levels of accuracy. ...

February 15, 2011 路 Ryan O'Neil

馃 Data Fitting 1 - Linear Data Fitting

Note: This post was updated to work with Python 3 and PySCIPOpt. The original version used Python 2 and python-zibopt. Data fitting is one of those tasks that everyone should have at least some exposure to. Certainly developers and analysts will benefit from a working knowledge of its fundamentals and their implementations. However, in my own reading I鈥檝e found it difficult to locate good examples that are simple enough to pick up quickly and come with accompanying source code. ...

November 23, 2010 路 Ryan O'Neil