# Parallelized Implementation of bootCI for DCchoice

11 Nov 2018I’ve been helping a small team work on some willingness-to-pay
analysis using double-bounded choice survey data. I’ll post more
about that soon, but I am writing now to talk about the double-bounded
choice models in R. The
DCchoice
library is really nice and makes the analysis about as simple as
possible. Further, the text *Stated Preference Methods Using
R* is fantastic.

But…the confidence interval bootstrap routine is really slow with
double-bounded choice models. Single-bounded not so much. But it
was taking hours to run, even for only 1000 samples. I was using
SciServer for running the model and it
gives me 16 cores, so I rewrote bootCI to use them all. The script
is below and you have to have both `doMC`

and `foreach`

loaded.
There’s a new option `threads`

that allows you to set the number
of threads to use.

*This work used SciServer, a collaborative research environment for
large-scale data-driven science. It is developed at, and administered
by, the Institute for Data Intensive Engineering and
Science at the Johns Hopkins University.
SciServer is funded by the National Science Foundation
Award ACI-1261715. For more information about SciServer, please
visit http://www.sciserver.org.*