Lars Relund NielsenLars Relund Nielsen
Department of Economics and Business Economics
Fuglesangs Allé 4
DK-8210 Aarhus V
Office 2621-114
Phone: +45 871 65145/+45 61 300 299 (mobile)
E-mail: lars@relund.dk

Cand.scient.oecon. (M.Sc.), Ph.D. 2004 in Mathematics and Economics at the University of Aarhus. Professor at Department of Economics and Business Economics, Business and Social Sciences, Aarhus University.

Distance matrix calculations in R

R 7. July 2015

Many models in Operations Research needs a distance matrix between nodes in a network. If the distance matrix is based on road distances it can be found using R. Let us try to compute the distances between a set for zip codes in Denmark. First we load all zip codes for Jutland in Denmark: Læs mere »

Publishing R markdown to WordPress

R 31. March 2015

In some cases it may be useful to write a WordPress post in R Markdown and afterwards publish it to my blog. This can be done using the RWordPress package. First we setup a link to my blog:

if (!require('RWordPress'))
   install.packages('RWordPress', repos = 'http://www.omegahat.org/R', type = 'source')
library(RWordPress)
options(WordPressLogin = c(<your username> = '<your password>'),
        WordPressURL = 'http://www.research.relund.dk/wp/xmlrpc.php')

Next the post is written in a Rmd file and afterwards published to WordPress:

id<-knit2wp('RWordPress_post.Rmd', title = 'Publishing R markdown to WordPress', 
            categories = c('R'), publish=F )

Now the post with id is a draft on my blog and I can have a look at it before publishing it. If I want to update the post I do:

knit2wp('RWordPress_post.Rmd', title = 'Publishing R markdown to WordPress', postid=id, 
            action='editPost', categories = c('R'), publish = F )

To highlight the above code I use the WP Code Highlight.js plugin. If you use other syntax highlight plugins you may have to change the code a bit.

Migrating from svn (R-forge) to git (GitHub)

R 19. March 2015

I recent migrated my R package mdp from my R-forge svn repo to GitHub. Do the following:

  1. Create an empty folder mdp and open a shell and import the svn to git (I only imported the pkg sub-folder svn+ssh://relund@svn.r-forge.r-project.org/svnroot/mdp/pkg)
    git svn clone svn+ssh://relund@svn.r-forge.r-project.org/svnroot/mdp/pkg .     # import the svn
    git branch -a    # info, should show a git-svn remote branch
    git svn info     # show svn details (also URL)
  2. Now add your local repo to GitHub. First, create an empty GitHub repo and next run from the shell:
    git remote add origin https://github.com/relund/mdp.git
    git push -u origin master

    The first line tells Git that your local repo has a remote version on GitHub, and calls it “origin”. The second line pushes all your current work to that repo.

Now you have a local Git repo and 2 remote repos (one at GitHub and one at R-forge). You want to use GitHub as the main repo. That is, add files, make changes to the master branch and commit to the master branch and GitHub as usual. At some point in time you want to commit the current revision to the remote svn repo at R-forge (so that the package can be checked at different OS etc.):

git svn info               # show svn details (also URL)
git svn dcommit –-dry-run  # show which svn branch you will commit into:
git svn rebase             # pull changes from svn repository
git svn dcommit            # push your local git commits to svn repository

Resources

Using RStudio together with Git and GitHub on Windows

R 11. March 2015

I have started to use Git and GitHub together with RStudio. Git is a distributed version control system which is very useful when doing reproducible research. It is a good way to handle programming/coding. Moreover, Git (via GitHub) allows groups of people to work on the same documents (often code) at the same time, and without stepping on each other’s toes. RStudio is an excellent integrated development environment built specifically for R. Læs mere »

How to install a fully working LaTeX environment

LaTeX 17. February 2015

This post is a guide on how to install the computer typesetting system LaTeX and the corresponding programs for editing and creating LaTeX documents, and converting them to Portable Document Format (pdf) on Windows.

You will need to install the following software in the following order

  1. A LaTeX engine. A free engine under Windows is MikTeX (containing a lot of other useful stuff). Just install the basic installer, which will download the packages you need automatically.
  2. A LaTeX editor. I recommend the free editor TeXStudio which is very powerful. Download and install the latest version. If you want another spellchecker language (e.g. Danish), have a look at this page.
  3. Even though that TeXStudio have a built-in pdf viewer. I also suggest to install SumatraPDF.

Happy typing 🙂

Markov decision theory

Teaching 28. March 2014

During the this semester I am teaching the course “Markov decision theory” at the Department of Mathematics. The course presents the algorithmic aspects of Markov decision theory and illustrates the wide applicability of this theory to a variety of realistic problems. First, the course consider the Poisson process followed by Renewal/Reward Processes. Next we study the theory of Markov chains. Then follows a thorough presentation of the theory of Markov Decision Processes, including some applications. Finally, further applications are discussed based on reports made by the students. A course plan is given here.

PhD thesis: Methods for Sensor Based Farrowing Prediction and Floor-heat Regulation: The Intelligent Farrowing Pen

Research 28. March 2014

One of my PhD students, for who I am a co-supervisor, has just finished the defense of her thesis titled “Methods for Sensor Based Farrowing Prediction and Floor-heat Regulation: The Intelligent Farrowing Pen“. I would like to congratulate Aparna with her PhD title and for a good thesis and presentation at the defense. I have included the thesis summary below. Læs mere »

Ranking paths in stochastic time-dependent networks

Research 29. November 2013

The research paper “Ranking paths in stochastic time-dependent networks” have been accepted for publication in European Journal of Operational Research.

In this paper we address optimal routing problems in networks where travel times are both stochastic and time-dependent. In these networks, the best route choice is not necessarily a path, but rather a time-adaptive strategy that assigns successors to nodes as a function of time. Nevertheless, in some particular cases an origin-destination path must be chosen a priori, since time-adaptive choices are not allowed. Unfortunately, finding the a priori shortest path is an NP-hard problem.

We propose a solution method for the a priori shortest path problem, and we show that it can be easily extended to the ranking of the first K shortest paths. Our method exploits the solution of the time-adaptive routing problem as a relaxation of the a priori problem. Computational results are presented showing that, under realistic distributions of travel times and costs, our solution methods are effective and robust.

MCDM 2013 in Malaga

Conference/meeting, Research 8. August 2013

mcdm_malaga

From 17-22 June 2013 I have been participating in MCDM 2013 in Malaga. The 22nd International Conference on Multiple Criteria Decision Making. The conference was held in a nice atmosphere and the city can be recommended. I coauthored a talk about the Bicriterion Stochastic Knapsack Problem which is a problem we currently are working on.

Course on supervision

Administration, Teaching 13. May 2013

During the past months I have been participating in a course about supervision. The course, which runs over several days, covers master, PhD and fellow supervision and use results from research, practice and experiences from the participants. It aims at strengthen the participants’ overall supervisory skills in the form of

  • clear and specific criteria-based guidance
  • better feedback when commenting on text from the student
  • establishment and maintenance of a mutually binding supervision agreement
  • initial, ongoing and final project evaluation and feedback
  • using meta-communication of supervision content and processes

The course included video-filming ourselves in doing supervision which was a good way of seeing how one actually perform. The course can be recommended to all university staff doing supervision.

© Lars Relund Nielsen
Entries RSS Comments RSS Log in