Blog Archives

Regression regularization example

May 31, 2013
By
Regression regularization example

Recently I needed a simple example showing when application of regularization in regression is worthwhile. Here is the code I came up with (along with basic application of parallelization of code execution). Assume you have 60 observations and 50 expla...

Read more »

Model fitting exam problem

May 20, 2013
By

Recently I have run an exam where the following question had risen many problems for students (here I give its shortened formulation). You are given the data generating process y = 10x + e, where e is error term. Fit linear regression using lm, ne...

Read more »

Missing tikzDevice

April 30, 2013
By

I love using tikzDevice. When preparing LaTeX documents I switched to prepare all graphs in GNU R and then port them to TeX using tikzDevice. Recently I have moved to GNU R 3.0.0 and was shocked to find that this package is no longer available on CRAN....

Read more »

Estimating continuous piecewise linear regression

April 2, 2013
By
Estimating continuous piecewise linear regression

When talking about smoothing splines a simple point to start with is a continuous piecewise linear regression with fixed knots. I did not find any simple example showing how to estimate the it in GNU R so I have created a little snippet that does the j...

Read more »

GNU R loop speed comparison

March 16, 2013
By
GNU R loop speed comparison

Recently I had several discussions about using for loops in GNU R and how they compare to *apply family in terms of speed. I have not seen a direct benchmark comparing them so I decided to execute one (warning: some of the code presented today tak...

Read more »

Hexadecimal literals in GNU R

March 11, 2013
By

Recently I have used hexadecimal numbers in GNU R. The way they are parsed surprised me and is inconsistent with Java. As R Language Definition pdf only briefly mentions hexadecimal numbers here is what I have found.First I have checked the following c...

Read more »

Times per second benchmark

March 5, 2013
By

In GNU R the simplest way to measure execution time of a piece code is to use system.time. However, sometimes I want to find out how many times some function can be executed in one second. This is especially useful when we want to compare function...

Read more »

Solving 9-puzzle with GNU R

January 4, 2013
By
Solving 9-puzzle with GNU R

During holiday break I have decided to solve 9-puzzle, which is 3x3 variant of a well known 15-puzzle. The solution has proven to be a nice application of igraph package. Warning: this time the code takes a bit more tame than usual in my...

Read more »

Wrapper functions in GNU R

December 26, 2012
By

Recently I have been working with GNU R optimization routines a lot. Function optim has a nice trace option that allows to monitor optimization progress. Another standard function optimize has no such feature but it is pos...

Read more »

Predictive models in R: a new book in Polish

December 14, 2012
By
Predictive models in R: a new book in Polish

Together with Mateusz Zawisza I have just published a new book in Polish on building predictive models in GNU R. It can be bought at Oficyna Wydawnicza SGH. The book presents complete examples of basic data mining processes.Although the book is in Poli...

Read more »