About me

I am a quantiative analyst and developer with special interests in econometrics, data analysis and modelling in Financial Markets and Trading, News and Social Networks. I have a strong expertise in statistical programming using the open source software R.

I obtained my PhD in 2014 on the topic of truncation, a particular case of data selection, in Finance and Econometrics at the University of Basel, supervised by Prof Dr Heinz Zimmermann and Prof Dr Christian Kleiber.

I have written a number of R packages and published two articles in the R Journal. I also referee manuscripts for the R Journal and the Journal of Multivariate Analysis (JVMA).

Currently, I am heading the Product Management department at financial.com in Munich, where my team is responsible for the development of product strategies in the financial sector. We heavily use R and Shiny for rapid prototyping and sketching of new ideas.

I like the collaboration in multinational research teams and I am always looking for interesting projects and contacts in data science and R. Please contact me via email or connect me on LinkedIn, XING or Twitter.

email linkedin xing twitter github


Creating Rating Inputs in Shiny

I had a situtation where I wanted to build a rating or voting input for R Shiny, an Amazon like input widget that displays five stars and users can click on one of the stars and vote from 1 to 5.

When searching for existing javascript libraries for rating inputs, I quickly came across the “bootstrap-rating” library from http://dreyescat.github.io/bootstrap-rating/, which does a very nice job for different kind of rating scales and icons.

I wrote a package ShinyRatingInput which is wrapping up Magazine bootstrap-rating for the use with Shiny. The ShinyRatingInput package and a sample app are available on GitHub and a live app on https://stefanwilhelm.shinyapps.io/ShinyRatingInput-Sample.

ShinyRatingInput allows for easy creating of rating input controls in Personalizado Shiny, such as:

To install, install the devtools package if necessary (install.packages("devtools")) and run:

Usage and Examples

First, choose the rating scale from dataStart to dataStop with dataStart excluded from the interval. The default scale is (0, 5] or [1, 2, 3, 4, 5]. Fractional ratings can be defined using the dataFractions parameter. For example, parameters dataStart=0, dataStop=5 and dataFractions=2 together create an input to choose from [0.5, 1, 1.5, 2, …, 4.5, 5].

Second, choose the rating symbol icon from FontAwesome icons, Glyphicons or your custom icons. Font Awesome and Glyphicons are included in the package.
These go in as the dataFilled and dataEmpty parameters. You can add additional CSS classes to the dataFilled and dataEmpty symbols to control the size or colors.

The following examples


are created with these parametrisations of ratingInput:

Some implementation details

The wrapping startnummers of bootstrap-rating is basically an example on how to integrate a third party library into an R package. Other good examples of R packages wrapping javascript libraries for Shiny are shinyDash and shiny-jsdemo.

Using bootstrap-rating, users specify wholesale nfl jerseys the inputs as hidden input elements such as

with a CSS class (“rating” by default) and addtional “data-” attributes. This defines a rating control to select ratings [0.5, 1, 1.5, …, 5] based on red heart icons. JavaScript and jQuery is then used on this input element to create the rating icons.

In R, one needs to define a wrapper method ratingInput(), which loads the JS and CSS files and maps the parameters to bootstrap-rating.
In Shiny apps, we also need to have an inputId for each of the inputs for correct input binding.
Additionally, I want to display additional control texts cheap jerseys like “Please select rating”, which gives the method as


For <input type="hidden"> elements, no Shiny input binding exists, so users need to write one on their own (See the discussion on https://groups.google.com/forum/#!topic/shiny-discuss/FU-aDoxKBNA). The solution proposed there was to use normal text inputs with “display:none”, because for text inputs meals the Shiny binding is already available. Hence, I use <input type="text" style="display:none"> instead of  <input type="hidden">.

Interactive Highcharts Heat Maps in R with rCharts


This post shows how to create Highchart Heat Maps in R using the rCharts package. Heat maps are newer Highcharts extensions. Getting rCharts to display heat maps is a little more involved, since the current version of rCharts 0.4.5 does not ship these extensions. Showing heat maps in R with rCharts requires direct linking of these additional JavaScript files.

I will show both how to create a standalone HTML page and a Shiny app. We use the example from http://www.highcharts.com/demo/heatmap to create a map for the sales per employee data.

Here is the code in order to create a standalone HTML page containing a Highcharts Heat Map:

rCharts 0.4.5. currently does include only the standard Highcharts JavaScript files and no extensions for Heat Maps or Highstocks like modules/heatmap.js or stocks/highstock.js. So I include these additional files using the p$addAssets() method.

Still, one need to include more than just the heatmap.js to get it work. The problem seems to be that simply adding the heatmap.js is not enough, there seems to be a version conflict with the HighCharts JavaScript files in rCharts. Therefore, I load some more Highcharts and jQuery JS files externally in order not to run into some NullPointerExceptions when creating the Heatmap.

In Shiny Apps, one can load the JS in the tag$head() function of ui.R instead of the p$addAssets() method:

The Shiny app is available at http://stefanwilhelm.shinyapps.io/heatmap/. The source code of the Shiny example can be found on GitHub at https://github.com/stefanwilhelm/heatmap.

I have asked Ramnath Vaidyanathan, the author of rCharts, to include Highcharts extensions like modules/heatmap.js directly into the package to make them easier to use in R. I will update this post once this change is implemented in rCharts. Until then, you might find my proposed workarounds useful for creating Highcharts Heat Maps.

Edit Apr 19, 2015:
When your data set is larger than 1000 data points, you need to increase the Highcharts turboThreshold parameter as follows

For this Highcharts limitation to 1000 data points by default, see the Highcharts documentation or StackOverflow questions like highcharts-3-cannot-render-more-than-1000-points-in-one-series.
Thanks to Bing Zhang for a question that led me to this issue.



Working Papers

R packages


This package contains useful methods for the truncated multivariate normal distribution. An overview article has been published in The R Journal as “tmvtnorm: A Package For the Truncated Multivariate Normal Distribution” (joint with Manjunath B G). More information about this package is available at CRAN http://cran.r-project.org/tmvtnorm


fCertificates contains a collection for pricing methods for structured derivatives in Germany and Switzerland. It covers simple structures like covered calls, or so-called Easy-Express certificates. All these certificates have in common that they may be duplicated using simpler plain-vanilla call and put options or barrier options (e.g. down-and-out put). More information is available at the package website at http://CRAN.R-project.org/package=fCertificates.


This package implements a number of methods for pricing autocallables, which are primarily marketed under the name of Express Certificates in Germany. It prices these derivatives in a framework of truncated multinormal returns and, hence, builds upon the tmvtnorm package. More information is available at the package website at http://CRAN.R-project.org/package=fExpressCertificates.


This package implements the Bayesian estimation of spatial limited-dependent variable models in R like spatial lag and error probit, spatial ordered probit and spatial Tobit. The estimation has been optimized for large data sets with the help of sparse spatial weights matrices.

More information, including code examples, is available at CRAN http://CRAN.R-project.org/package=spatialprobit and in our R Journal article “Estimating Spatial Probit Models in R” (joint with Miguel Godinho de Matos).