There are two major threats to complex MCMC estimations:
- Wrong energy settings (hibernate after 2 hours of inactivity)
- Automatic Updates (install updates at 3 a.m.)
I thought about the latter threat. At times, you may hand some R code to other co-workers, especially when you need to estimate lots of different models in a short period of time. If they have auto-updates enabled, your results are quickly in jeopardy. While automatically saving the workspace [if(rep==10000) save.image(“save.RData”)] is definitely a very good idea, deactivating automatic updates on windows is still important for long-term calculations.
Therefore I thought about ways to deactivate automatic updates from within R. A major obstacle is UAC (user account control) which turns your administrator account into something … with less right. Windows frequently asks for privilege elevation. Sadly, elevation does not work without further administrative tools, which you will not find on every PC around. Therefore I decided to use the “runas” command, which will ask the user for her password once.
Although this is not a perfect solution yet, it is also a very nice example on some interesting functions: paste, sub, system.
“runas” apparently does not work with “net stop” command, therefore a .bat file needs to be created which can be started using runas. The .bat is created from within R.
Random John reminded my that an option to turn auto update back on would be nice. Well, I added that.