# Can I ask about computer hardware?

I need to buy a new computer because tasks I am running with R are taking 2-4 days to run (MCMC, multiple imputations) so I am looking for some advice on what to prioritise - more RAM, faster CPU speed, more L3 cache, etc. Is it OK to ask about this ?

• This would be on the fringes, I would think. It sounds like your real question is probably something different, like: I'm using X package on a data set of size Y, and I'm finding it's take Z seconds (minutes, years, millennia, etc.) to run. What can I do to optimize things? My target acceptable execution time is T. – cardinal Jun 22 '12 at 11:48
• If the answer comes back and is: Buy a bigger box then so be it. – cardinal Jun 22 '12 at 11:51
• Here's a recent example of such question: stats.stackexchange.com/questions/29669 – cardinal Jun 22 '12 at 11:53
• And (+1) for raising the question on meta first since you had doubts! – cardinal Jun 22 '12 at 12:05
• @cardinal thanks, I appreciate the "buy a bigger box" comment, but since resources (money) are finite, I need to $prioritise$ where to spend the money. The link you gave doesn't really address this, from what I can tell. I am using built-in routines, for example just the MCMCglmm() function in the MCMCglmm package and one single call to that takes around 6 hours and I have many models to run, so I don't think I can obtain any speed-up by coding..... – Joe King Jun 22 '12 at 12:34
• Thanks for the reply, Joe. My current opinion is that your question has the best chance of being on-topic and attracting attention here if you describe the statistical computing problem you're actually trying to solve, perhaps accompanied by your explicit concern that the only "out" you have is to purchase a bigger machine and you're unsure how to trade off the specs. This way you also leave yourself open to potentially "surprising" solutions, e.g., alternative packages, use of multicore support or linking R to different computational backends/libraries. – cardinal Jun 22 '12 at 13:01
• You seem to be doing some impressively advanced stuff, by the way. – cardinal Jun 22 '12 at 13:02
• Not that this will answer your question, but how you approach the problem will determine the correct site. An alternative would be to use the cloud, which provides resources on-demand. I use a shared server, which is conceptually similar, and it performs computations in an hour that would take my machine days, and my machine is pretty quick, but I spend more time analyzing the results than generating them, and this post-analysis takes way less memory, and can generally be done on my desktop. That way, I can have a regular desktop and still get work done. – David LeBauer Jun 22 '12 at 14:28
• some related questions on SO are about using a cloud server. Your question might be a better fit at SO, superuser, serverfault, etc. etc., depending on the direction that you go, and if you ask it, it could always be migrated. – David LeBauer Jun 22 '12 at 14:28
• @cardinal I am out of my depth, to be honest, so I'm really grateful for the help from members here. I will do as you suggest. – Joe King Jun 22 '12 at 14:44
• Just providing a link to your question (nicely done, by the way, with a +1 from me): stats.stackexchange.com/q/30942/2970 – cardinal Jun 24 '12 at 15:18

You seem to be asking a hardware question requiring statistical programming knowledge.

SuperUser's faq explicitly states that hardware-related topics are on-topic.

CrossValidated's faq makes no mention of hardware-related questions as being on-topic. The closest it gets is to say that programming questions requiring statistical expertise to understand or answer are on-topic.

StackOverflow's faq makes no explicit mention of hardware-related questions as being on-topic, but does state that "practical, answerable problems that are unique to the programming profession" are on-topic.

Computational Science's faq states that "computational methods used in technical disciplines" are on topic.

Your question is certainly on-topic at SuperUser, but because it requires statistical programming knowledge, it might not be exposed to an audience with the expertise that you desire. For CrossValidated, your question is a hardware question requiring statistical programming knowledge, as opposed to a programming question requiring statistical programming knowledge. I think it is technically off-topic. For StackOverflow, since your question is a hardware question requiring statistical programming expertise, it is unique to the programming profession. I think this makes it on-topic. Finally, Computational Science's faq is a bit vague to me, but a search for "hardware" on that site brings up a few questions in the same vein as yours (e.g. here, here, and here).

Before Computational Science went into beta, I probably would have asked a question like yours on StackOverflow. You likely still can and will get good answers. However, Computational Science seems more geared toward your question.

• There is also a computational science SE to consider – David LeBauer Jun 23 '12 at 4:00
• @David: Thanks, I had forgotten about computational science. I think it is the best fit for OP after all. – jthetzel Jun 23 '12 at 13:40

Joe, you are a statistician, and must have taken courses on experiment design. Design an experiment to see how your programs scale on the existing architecture first: take a typical data set, decrease it in size by factors of 3 and 10, and increase it in size by factors of 3 and 10. Likewise, find a way to wary the computational complexity. This may not be so easy, although increasing/decreasing number of variables in MI and number of parameters in MCMC should be a step in that direction. Come up with a factorial design and time it.

One would naturally expect the computational time to grow with the problem size and difficulty. My experience timing my own Stata factor analysis code was that $$T \sim n^{0.7} p^{2.3}$$ where $n$ was the sample size and $p$ was the dimensionality of the problem. The exponent for the latter is actually the best existing rate for matrix inversion which is one of the intense tasks in the program. The exponent on the sample size is intriguing, as I was expecting the time to be linear in the sample size; this may have to do with the small sample likelihoods being more weird and difficult to optimize, though.

If you start seeing huge increases in computing time beyond these natural power laws, you must be hitting the memory limits, which would be an indication that you need larger RAM. If you don't see any issues with the memory size, for the problems you will likely be working on, you would be far much better off buying a faster chip with more parallel threads.

• FYI. :) – cardinal Jun 27 '12 at 20:08
• OK. Future statistician, then :) – StasK Jun 28 '12 at 11:45
• Yes. Let's hope so! – cardinal Jun 28 '12 at 13:19
• Thank you. dimensionality of the problem is the number of predictors in the model ? – Joe King Jun 29 '12 at 20:05
• If you have a regression-like model, then you only need to inverse the $p\times p$ matrix once. However, in my factor analysis/multivariate problem, I had to compute the $p\times p$ matrix for every evaluation of the likelihood, and that's what took the toll. So whether the number of variables is a good predictor of the computing time really depends on the model that you are dealing with. If you are building some regression trees, the measure of complexity would probably be some combination of the # of variables and the # of splits. – StasK Jul 5 '12 at 15:21