Stated Preference Methods Using R
by Hideo Aizaki, Tomoaki Nakatani, and Kazuo Sato
Since Aug 11, 2014
Last update Aug 6, 2025
by Hideo Aizaki, Tomoaki Nakatani, and Kazuo Sato
Since Aug 11, 2014
Last update Aug 6, 2025
This is the website for Stated Preference Methods Using R (SPMUR) published as a title of Chapman & Hall/CRC The R Series.
News
A new package support.BWS2 for supporting an implementaiton of Case 2 Best-Worst Scaling is available from CRAN: https://CRAN.R-project.org/package=support.BWS2
DCchoice includes new functions for one-and-one-half-bound dichotomous choice contingent valuation (Cooper et al., 2002).
DCchoice is available from CRAN: https://CRAN.R-project.org/package=DCchoice
Outline of SPMUR
SPMUR explains how to apply stated preference (SP) methods such as contingent valuation (CV), discrete choice experiments (DCEs), and best-worst scaling (BWS) to elicit people's preferences using R. SPMUR focuses on introductory-level variants of three methods: single-bounded dichotomous choice and double-bounded dichotomous choice CV based on parametric and nonparametric approaches for analyzing responses; DCEs based on orthogonal main-effect designs (OMEDs) for designing choice situations and conditional and binary logit models for analyzing responses; and object case (case 1) BWS based on OMED or balanced incomplete block design for designing choice situation and counting and modeling approaches for analyzing responses. For the table of contents, refer the SPMUR page on the publisher's website.
Supplementary materials on SPMUR such as Errata, FAQs, reproduction of examples, contact, and site policy are given below.
Errata
FAQs
1. What is R?
R is a free environment for statistical computing and graphics (https://www.r-project.org/). R runs on operating systems such as Windows, Mac OS X, and Linux. R can extend its functionality by installing various add-on packages. More than 5,000 packages are distributed from the Comprehensive R Archive Network (CRAN). R enables us to learn statistical techniques such as SP methods with limited cost. For detailed information, refer the website for R.
2. How do I get R?
R is available from CRAN. CRAN also provides steps for installing R on your computer based on the operating system, such as Windows, Mac OS X, and Linux. Since there are many mirror sites for CRAN, first, access the CRAN page on the R website, and then search mirror sites closest to your location.
3. How do I use R?
We recommend that R beginners first attempt Chapter 5 of SPMUR, or one of the R manuals, such as "An Introduction to R." The R manuals may be available in your R, or can be downloaded from CRAN or the R website. After understanding the basic usage, attempt Chapters 2, 3, and 4 of SPMUR. In addition to informative R manuals, many books, documents, and websites explain how to use R. Books and documents related to R are listed in CRAN and the R website. The R series also provides titles for basic topics on R, as well as ones for specific statistical techniques such as SPMUR. Since R users are worldwide, information on R is available, through the web, in English, as well as other languages. For example, RjpWiki provides a place for the exchange of information on R in Japanese, and thus, it is of help to Japanese R beginners.
4. How do I install R packages related to SPMUR?
The authors' packages related to SPMUR are available from CRAN. After installing R onto your computer and then starting an R session, the following code is executed (or copy and paste) on the R console to install packages needed for each chapter (the other packages on which each package depends may be installed simultaneously). For general and detailed information on installing packages, see R FAQ, R Mac OS X FAQ, and R Windows FAQ that are provided through the R website and CRAN.
The R code for installing packages used in Chapter 2 (CV):
install.packages("BiocManager")
BiocManager::install("DCchoice")
The R code for installing packages used in Chapter 3 (DCEs):
install.packages(c("support.CEs", "mded"), dep = TRUE)
The R code for installing packages used in Chapter 4 (BWS):
install.packages(c("support.BWS", "DoE.base", "crossdes"), dep = TRUE)
5. How do I reproduce examples in each chapter?
See the section Reproduction of Examples below.
Reproduction of Examples
Examples in Chapters 2, 3, and 4 of SPMUR can be reproduced on your R. Note that some lines of code may not return outputs that are the same in SPMUR, because random numbers are generated without the set.seed() function.
Dataset examples in Chapters 2, 3, and 4 are stored in the following packages:
For Chapter 3, support.CEs package.
For Chapter 4, support.BWS package.
Note that datasets used in Sections 3.3 and 4.3 are embedded in example codes that are explained below.
The R code for examples in Chapters 2, 3, and 4 are contained in the following:
For Chapter 2, examples_ch2.R
For Chapter 3, examples_ch3.R
For Chapter 4, examples_ch4.R
These files are licensed under the GNU GPLv2 or later. Note that these files are saved as a text file, and that some lines of code in these files are not shown in SPMUR explicitly. For example, the plot() function was used in SPMUR implicitly to draw some figures, and a comment "not shown in SPMUR" is added to such lines.
Before reproducing examples, first, type and execute the following code on the R console:
options(prompt = "R> ", continue = " ", width = 60, digits = 4, show.signif.stars = FALSE)
This sets the appearance format for R that is used in SPMUR.
When executing all lines of code at once, the file assumed to be examples_ch2.R is stored in the current working directory. Then, type and execute the following code on the R console, after executing the code using options() given above.
source(file = "examples_ch2.R", echo = TRUE, max.deparse.length = Inf)
Note that this code executes all lines of code for Chapter 2 simultaneously. When executing those for Chapters 3 or 4, the argument file is set as "examples_ch3.R" or "examples_ch4.R".
Contact
We welcome your comments, suggestions, or error reports. First author's e-mail address is azk-r_at_spa.nifty.com (_at_ should be replaced with @).
Site Policy
While reasonable efforts have been made to provide reliable information, we are not responsible for any errors in the material provided on this website and shall not be liable for any damages of any kind arising from the use of any material found on this website.