Memoization in R : Illustrative example

January 4, 2012
By

I came across a nice problem at project euler that gave me sense of satisfaction that was unusual, I think that because I don't usually get the solutions right the first time as I did in this case. Anyhow, I shall try and decode the R codes that I...

Read more »

Example 7.17 in Introduction to Monte Carlo methods with R

January 4, 2012
By
Example 7.17 in Introduction to Monte Carlo methods with R

I received the following email about Introducing Monte Carlo Methods with R a few days ago: Hallo Dr. Robert, I  am studying your fine book for myself. There´s a little problem in examples 7.17 and 8.1: in the R code a function “gu” is used and a reference given to ex. 5.17, but I cann´t

Read more »

Doing Bayesian Data Analysis now in JAGS

January 3, 2012
By

Around Christmas time I presented my first impressions of Kruschke’s Doing Bayesian Data Analysis. This is a very nice book but one of its drawbacks was that part of the code used BUGS, which left mac users like me stuck. … Continue reading →

Read more »

Plotting Doctor Who Ratings (1963-2011) with R

January 3, 2012
By
Plotting Doctor Who Ratings (1963-2011) with R

Introduction First day back to work after New Year celebrations and my brain doesn’t really want to think too much. So I went out for lunch and had a nice walk in the park. Still had 15 minutes to kill before my lunch break was over and so decided to kill some time with a quick web

Read more »

useR! 2012 Simple Abstract Helper

January 3, 2012
By
useR! 2012 Simple Abstract Helper

useR! 2012 has issued a call for abstracts! I've extended the WebSweave concept to offer a tool to create simple abstracts online, including those with markup, which may then be submitted at the conference website. Use the following link for the Simple Abstract Helper.

Read more »

Extract different characters between two strings of equal length

January 3, 2012
By
Extract different characters between two strings of equal length

In the desperate effort of understanding the secret of life it may be too simplistic to just count the differences between two strings of equal length. You might as well want to know where they differ. You can do that recycling most of the function published in a previous post. You can use it to

Read more »

Coefplot: New Package for Plotting Model Coefficients

January 3, 2012
By
Coefplot: New Package for Plotting Model Coefficients

By Joseph Rickert Even to the practiced eye, looking at coefficients in R model summaries can be tedious. And, capturing information about the significance of coefficients from scores or maybe even hundreds of models in a way that makes writing the final report a bit easier is a time consuming and thankless task. Of course, once you know what...

Read more »

Parallel R (Linux User & Developer Issue 108)

January 3, 2012
By
Parallel R (Linux User & Developer Issue 108)

In the 108. issue of Linux User & Developer was an article “Supercharge your R experience” about using parallel techniques to analyse large amounts of data with R. 4 page step-by-step tutorial shows the basics needed for installing needed packages … Continue reading →

Read more »

Baltimore gun offenders and where academics don’t live

January 3, 2012
By
Baltimore gun offenders and where academics don’t live

Jeff recently posted links to data from cities and states. He and I wrote R code that plots gun offender locations for Baltimore. Specifically we plot the locations that appear on this table. I added locations of the Baltimore neighborhoods where most ...

Read more »

2012, Turing year

January 3, 2012
By
2012, Turing year

Buying the special issue of La Recherche on “La révolution des mathématiques”, I discovered that this is the Alan Turing Year in celebration of the 100th anniversary of Turing‘s birth. The math department at the University of Leeds has a webpage on all the events connected with this celebration. From all over the World. (There

Read more »

Were markets exceptionally volatile in 2011?

January 2, 2012
By
Were markets exceptionally volatile in 2011?

2011 was a volatile year, no doubt about that, but was it exceptionally so from a historic point of view? To quantify the volatility, I used the Dow Jones Industrial average, which goes back to 1928 on Yahoo Finance: A volatile year no doubt, but once again confirming the fact that, in markets behaviour at

Read more »

Lesson 1: Overview of R Language & CloudStat School

January 2, 2012
By
Lesson 1: Overview of R Language & CloudStat School

This is the first lesson of CloudStat School, Lesson 1: Overview of R Language & CloudStat School. The objective of this lesson is introducing R Language and how you can be a R programmer or a data analyst through CloudStat School. At the end of this l...

Read more »

Voting Networks in the Danish Parliament

January 2, 2012
By
Voting Networks in the Danish Parliament

One of my Christmas presents was the book Beautiful Visualization. Chapter 8 by Andrew Odewahn is a very nice piece on visualizing the U.S Senate social graph. Odewahn basically builds an affinity network, where ties represent whether two senator have ...

Read more »

R resources

January 2, 2012
By

Earlier we spoke about PITCHfx resources, and now we will learn about R resources. Well, what is R? Straight from wikipedia:R is a programming language and software environment for statistical computing and graphics. The R lang...

Read more »

Monetary Policy & Credit Easing pt. 8: Econometrics Tests in R

January 2, 2012
By

Hello, folks its time to cover some important econometrics tests you can do in R.The Akaike information criterion is a measure of the relative goodness of fit of a statistical model.  If you have 10 models and order them by AIC, the...

Read more »

Example

January 2, 2012
By
Example

Here is a little example of what I do. While learning R isn't easy, it can be very powerful and efficient once you get your feet wet. I intend for this example to whet  your appetite. This should take you less than 20 minutes. By the end, you will...

Read more »

Portfolio Optimization in R, Part 4 Redeux

January 2, 2012
By
Portfolio Optimization in R, Part 4 Redeux

So where did we mess up?  In the calculation of returns for the market cap weighted portfolio and the portfolio optimization portfolio, we simply took the starting weights (W0) and multiplied them by the relevant series of returns.resEqual = as.matrix(returns) %*% t(ret)andsubRes = as.matrix(subRes) %*% t(ret)To correct this, we have 2 options. Recalculate the weight at each time point assuming a starting weight. ...

Read more »

Portfolio Optimization in R, Part 4 Redeux

January 2, 2012
By
Portfolio Optimization in R, Part 4 Redeux

So where did we mess up? In the calculation of returns for the market cap weighted portfolio andthe portfolio optimization portfolio, we simply took the starting weights (W0)and multiplied them by the relevant series of returns.resEqual = as.matri...

Read more »

Plotting earthquake data

January 2, 2012
By
Plotting earthquake data

Since 4th September 2010 we have had over 2,800 quakes (considering only magnitude 3+) in Christchurch. Quakes come in swarms, with one or few strong shocks, followed by numerous smaller ones and then the ocasional shock, creating an interesting data … Continue reading →

Read more »

Market predictions for years 2011 and 2012

January 2, 2012
By
Market predictions for years 2011 and 2012

A review of market predictions and results for 2011, and a calibration for 2012 predictions (of 19 equity indices plus oil). Previously One year ago the post “Revised market prediction distributions” presented plots showing the variability of various markets assuming no market-moving forces. The follow-up post “Some market predictions enhanced some of those plots with … Continue reading...

Read more »

CloudStat School – The Introduction

January 1, 2012
By

CloudStat School is a not yet released open source project. The objective is to create an interactive R Learning Platform. The best way to learn R programming is doing while learning. In CloudStat School, you will see a console box at your top left han...

Read more »

Reproducible Research with R: Cost of energy and mutual shadows in a two-axis tracking PV system

January 1, 2012
By
Reproducible Research with R: Cost of energy and mutual shadows in a two-axis tracking PV system

  Some days ago the journal Renewable Energy published my last paper “Cost of energy and mutual shadows in a …Continuar leyendo »

Read more »

Decoding a Substitution Cipher using Simulated Annealing

January 1, 2012
By
Decoding a Substitution Cipher using Simulated Annealing

My last post discussed a method to decode a substitution cipher using a Metropolis-Hastings algorithm. It was brought to my attention that this code could be improved by using Simulated Annealing methods to jump around the sample space and avoid some of the local maxima. Here is a basic description of the difference: In a

Read more »

R-Function to Source all Functions from a GitHub Repository

January 1, 2012
By
R-Function to Source all Functions from a GitHub Repository

Here's a function that sources all scripts from an arbitrary github-repository. At the moment the function downloads the whole repo and sources functions kept in a folder named "Functions" - this may be adapted for everyones own purpose.# Script name: ...

Read more »

NIPALS: Principal Components Analysis with "R" (Part: 002)

January 1, 2012
By
NIPALS: Principal Components Analysis with "R" (Part: 002)

We started some posts based on the tutorials of:"Multivariate Statistical Analysis using the R package chemometrics"The first post was:Principal Components Analysis with "R" (Part: 001)Now we continue with a second part.The graphics help us to dec...

Read more »

Top 20 R posts of 2011 (and some R-bloggers statistics)

January 1, 2012
By
Top 20 R posts of 2011 (and some R-bloggers statistics)

R-bloggers.com is now two years young. The site is an (unofficial) online R journal written by bloggers who agreed to contribute their R articles to the site. In this post I wish to celebrate R-bloggers’ second birthmounth by sharing with you: Links to the top 20 posts of 2011 Statistics on “how well” R-bloggers did Read more...

Read more »

Monetary Policy & Credit Easing pt. 7: R Econometrics Tests

January 1, 2012
By

In post 6 we introduced some econometrics code that will help those working with time-series to gain asymptoticly efficient results.  In this post we look at the different commands and libraries necessary for testing our assumptions and such. Testing our Assumptions and Meeting the Gauss-Markov TheoremIn this section we will seek to test and verify the assumptions of the simple linear...

Read more »

Free Online Stanford Machine Learning Course: Andrew Ng. Post Mortem.

January 1, 2012
By
Free Online Stanford Machine Learning Course: Andrew Ng. Post Mortem.

Happy New Year to all the viewers of this blog and just a short reminder that the course will be available again this January.http://www.ml-class.org/course/auth/welcomeHaving audited the course, I would highly recommend it to anyone who is interested ...

Read more »

RTextTools v1.3.5: Saving models, text labels, and a game plan for 2012

RTextTools v1.3.5 addresses some key concerns that have been raised in recent months. Many of the algorithms used in RTextTools require that any new data presented to a trained classifier contain the same features as the original document-term matrix. Since this rarely (if ever) happens in the real world, I have added an originalMatrix parameter to the create_matrix() function...

Read more »