Publications by Bogumił Kamiński
Missing tikzDevice
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.Fortunately I was able to find package on the web. Unfortunately – installing old ...
1236 sym
Model fitting exam problem
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, neural net using nnet with size equal to 2 and 10 and regression tree using rpart. What...
3566 sym
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 explanatory variables x1 to x50. All these variables are IID from uniform distribution on...
3033 sym 2 img
Testing function arguments in GNU R
Recently I have read a nice post on ensuring that proper arguments are passed to a function using GNU R class system. However, I often need a more lightweight solution to repetitive function argument testing.The alternative idea is to test function arguments against a specified pattern given in a string. The pattern I use has the form...
5451 sym
Testing function agruments in GNU R
Recently I have read a nice post on ensuring that proper arguments are passed to a function using GNU R class system. However, I often need a more lightweight solution to repetitive function argument testing.The alternative idea is to test function arguments against a specified pattern given in a string. The pattern I use has the form...
5451 sym
Genetic drift simulation
While preparing for the new teaching semester I have created an implementation of NetLogo GenDrift P local in GNU R.The model works as follows. Initially a square grid having side size is randomly populated with n types of agents (denoted by colors).Each agent randomly changes type (color) to one of its eight neighbors colors. In...
1051 sym R (1767 sym/1 pcs) 2 img
Visualizing optimization process
One of the approaches to graph drawing is application of so called force-directed algorithms. In its simplest form the idea is to layout the nodes on plane so that all edges in the graph have approximately equal length. This problem has very intuitive visualization so it is a nice case for showing how different optimization algorithms...
1916 sym R (1278 sym/1 pcs) 2 img
Cont model back after a year
During ESSA2013 conference I had a discussion about Cont model I have commented a year ago.In original paper Cont highlights that his model produces distribution of returns characterized by positive excess kurtosis. In this post I want to investigate this assertion.Cont simulation has three key parameters (check out the paper for det...
3410 sym 2 img
Cont model – Part II
In my last post I have investigated properties of Cont model (you can download the paper here). Today I would like to show how we can use simulations to further simplify its analysis.First let us start with the observation that the model does not really require two parameters d and l as they are directly linked. If we multiply d�...
3905 sym 4 img
Calibration of p-value under variable selection: an example
Very often people report p-values for linear regression estimates after performing variable selection step. Here is a simple simulation that shows that such a procedure might lead to wrong calibration of such tests.Consider a simple data generating process where y ~ N(0, 1) and x1, x2 ~ U(0,1). Assume that we take n=20 independent sam...
3420 sym 2 img