Type: | Package |
Title: | R Commander Plug-in for Discrete Choice Experiments |
Version: | 0.3-1 |
Date: | 2025-06-14 |
Depends: | support.CEs (≥ 0.7-0), survival |
Imports: | Rcmdr |
Description: | Adds menu items for discrete choice experiments (DCEs) to the R Commander. DCE is a question-based survey method that designs various combinations (profiles) of attribute levels using the experimental designs, asks respondents to select the most preferred profile in each choice set, and then measures preferences for the attribute levels by analyzing the responses. For details on DCEs, refer to Louviere et al. (2000) <doi:10.1017/CBO9780511753831>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://sites.google.com/view/r4sp/rcmdrplugin |
RcmdrModels: | clogit |
NeedsCompilation: | no |
Packaged: | 2025-06-14 03:16:12 UTC; r |
Author: | Hideo Aizaki [aut, cre] |
Maintainer: | Hideo Aizaki <azk-r@spa.nifty.com> |
Repository: | CRAN |
Date/Publication: | 2025-06-14 03:50:02 UTC |
R Commander Plug-in for Discrete Choice Experiments
Description
This package adds menu items for discrete choice experiments (DCEs) to the R Commander. DCE is a question-based survey method that designs various combinations (profiles) of attribute levels using the experimental designs, asks respondents to select the most preferred profile in each choice set, and then measures preferences for the attribute levels by analyzing the responses. For details on DCEs, refer to Louviere et al. (2000).
Details
This package is an R Commander plug-in package for DCEs. It depends on support.CEs (Aizaki 2012), survival (Therneau 2020; Therneau and Grambsch 2000), and Rcmdr (Fox 2005, 2017; Fox and Bouchet-Valat 2020). Refer to Aizaki (2012), Aizaki et al. (2014), and ‘Non-Market Valuation with R’ <https://nmvr.skr.jp/> for a brief introduction to DCEs in R. A manual for this package is available at <https://sites.google.com/view/r4sp/rcmdrplugin>.
After successfully installing and loading RcmdrPlugin.DCE,
the R Commander window will appear, and then you will find ‘DCE
’
added to the top-level menus in the R Commander window.
Selecting ‘DCE
’ displays menu items. When selecting a menu item,
the corresponding dialog box opens. The following dialog boxes are
provided by RcmdrPlugin.DCE:
The dialog box for ‘
Design choice sets...
’ designs choice sets for DCE with the rotation design method or mix-and-match method using the functionrotation.design
in support.CEs.The dialog box for ‘
Display questions...
’ shows DCE questions from the choice sets designed in the first dialog box using the functionquestionnaire
in support.CEs.The dialog box for ‘
Collect responses...
’ shows three types of dialog boxes to collect user's responses to DCE questions according to choice sets designed in previous dialog box.The dialog box for ‘
Create data set for analysis...
’ creates a data set for DCE analysis from the choice sets designed in the first dialog box and a data set containing responses to DCE questions using the functionce.dataset
in support.CEs. The menu item is activated if a data frame is selected as the active data set.The dialog box for ‘
Create interactions...
’ creates interactions between attribute/level variables and covariates in the data set for DCE analysis. The menu item is activated if the data set for DCE analysis created in the previous dialog box is selected as the active data set.The dialog box for ‘
Fit model...
’ implements a conditional logit model analysis of the data set for analysis using the functionsclogit
in survival andgofm
in support.CEs. The menu item is activated if the data set for DCE analysis created in the previous dialog box is selected as the active data set.The dialog box for ‘
Calculate MWTP...
’ calculates marginal willingness to pays (MWTPs) of nonmonetary variables from the model fitted in the previous dialog box using the functionmwtp
in support.CEs. The menu item is activated if the fitted model is selected as the active model.The dialog box for ‘
Load saved objects...
’ loads an R Data file saved in the dialog box for ‘Design choice sets...
’ or ‘Create data set for analysis...
’ using the functionload
in base.
Acknowledgments
This work was supported by JSPS KAKENHI Grant Number JP20K06251.
Author(s)
Hideo Aizaki
References
Aizaki H (2012) Basic Functions for Supporting an Implementation of Choice Experiments in R. Journal of Statistical Software, 50(C2): 1–24. https://www.jstatsoft.org/article/view/v050c02.
Aizaki H (2021) support.CEs: Basic Functions for Supporting an Implementation of Choice Experiments. R package version 0.5-0. https://CRAN.R-project.org/package=support.CEs.
Aizaki H, Nakatani T, Sato K (2014) Stated Preference Methods Using R. Chapman and Hall/CRC.
Fox J (2005) The R Commander: A Basic Statistics Graphical User Interface to R. Journal of Statistical Software, 14(9): 1–42. https://www.jstatsoft.org/article/view/v014i09.
Fox J (2017) Using the R Commander: A Point-and-Click Interface for R. Chapman and Hall/CRC.
Fox J, Bouchet-Valat M (2020) Rcmdr: R Commander. R package version 2.7-1. https://cran.r-project.org/package=Rcmdr.
Louviere JJ, Hensher DA, Swait JD (2000) Stated Choice Methods: Analysis and Application. Cambridge University Press.
Therneau T (2020) survival: Survival Analysis. R package version 3.2-7. https://CRAN.R-project.org/package=survival.
Therneau TM, Grambsch PM (2000) Modeling Survival Data: Extending the Cox Model. Springer.
Examples
if(interactive()) {
library(RcmdrPlugin.DCE)
}
Create Data Set for DCE Analysis
Description
Create a data set for analysis from choice sets for DCEs and data set containing responses to DCE questions.
Details
This dialog box uses the function ce.dataset
in support.CEs to create a data set for DCE analysis from the choice
sets designed in the ‘Design Choice Sets for DCE
’ dialog box
and a data set containing responses to DCE questions.
This dialog box is activated if a data frame is selected as the active
data set.
For details on the results of this dialog box, refer to help for
the function ce.dataset
.
GUI elements of this dialog box are as follows.
-
Name for data set
: An R object name into which a data set generated using this dialog box is stored. The default name ‘DCEdata
’ can be changed following R's rules for naming objects. If changed, you should take note of the new object name, which will be used later. -
Save to file
: A check box for saving the resultant data set to an external file in RDA format (.rda
). If necessary, check this box. -
Design
: An R object name containing DCE choice sets generated in the ‘Design Choice Sets for DCE
’ dialog box. The default name ‘DCEdesign
’ is displayed automatically. The correct name should be entered if the name for design (DCEdesign
) was changed in the dialog box for DCE design. -
Responses to DCE questions
: Names of variables containing responses to DCE questions in the active data set. Variable names are separated by commas (e.g., q1, q2, q3, ...). -
Opt-out option
: A check box for an opt-out option. When the opt-out option was used in the DCE questions, check this box.
Design Choice Sets for DCE
Description
Design choice sets for DCEs.
Details
This dialog box uses the function rotation.design
in package support.CEs to design choice sets for DCE with
the rotation design method or mix-and-match method.
For details on the results of this dialog box, refer to help for the
function rotation.design
.
GUI elements of this dialog box are as follows.
-
Name for design
: An R object name into which choice sets generated using this dialog box are stored. The default name ‘DCEdesign
’ can be changed following R's rules for naming objects. If changed, you should take note of the new object name, which will be used later. -
Save to file
: A check box used to save the resultant design to an external file in RDA format (.rda
). If necessary, check this box. -
Design method
: A method used to generate DCE choice sets. Select one from two radio buttons corresponding to ‘Rotation
’ and ‘Mix-and-Match
’. For the details on these methods, see help for functionrotation.design
. -
Number of alternatives per set (without opt-out)
: The number of alternatives per choice set (question), where an opt-out option is not counted as this number even if the opt-out option will be used in your survey. -
Number of blocks
: The number of blocks into which the resultant DCE choice sets are divided. -
Quantitative
: A check box showing that a quantitative attribute is set in the corresponding row. -
Attribute
: An attribute variable name following R's rules for naming variables. Type names without skipping from the first row. -
Level 1
toLevel 6
: Level variable names corresponding to the attribute entered in the first column. These variable names must also follow R's rules for naming variables. Type names without skipping from the ‘Level 1
’. -
Seed for random number generator (optional)
: An integer value used as a seed for generating random numbers. If reproducibility is needed, type an arbitrary value into this box. -
Reproduce choice sets designed with R < 3.6.0
: A check box for reproducing DCE choice sets generated with R versions older than 3.6.0. If necessary, check this box.
Create Interactions between Attributes/Levels and Covariates
Description
Create interactions between attribute/level variables and covariates in the data set for DCE analysis.
Details
This dialog box creates interactions between attribute/level variables and
covariates in the data set for DCE analysis. This dialog box is activated if
the data set created in the ‘Create Data Set for DCE Analysis
’
dialog box is selected as the active data set.
GUI elements of this dialog box are as follows.
-
Attribute/level variables
: Variables to be used as attribute and/or level variables in the model. Select one or more variables from this list box. -
Covariates
: Variables to be used as covariates in the model. Select one or more variables from this list box.
Fit Model to DCE Data
Description
Fit a model to DCE data.
Details
This dialog box fits a conditional logit model to the data set for DCE
analysis using the functions clogit
in survival
and gofm
in support.CEs.
This dialog box is activated if the DCE data set created in the
‘Create Data Set for DCE Analysis
’ dialog box is selected
as the active data set.
For details on the results of this dialog box, refer to helps for
clogit
and gofm
.
GUI elements of this dialog box are as follows.
-
Name for model
: An R object name into which the results of a fitted model obtained using this dialog box are stored. The default name ‘DCEmodel.x
’, wherex
indicates the integer number assigned automatically from1
, can be changed following R's rules for naming objects. -
Response variable
: A variable containing responses to DCE questions in the active data set. This variable name is fixed asRES
, which cannot be changed by users (A fixed variable is colored in green). -
Independent variables
: Variables used as independent variables in the model. Select one or more variables from this list box. -
Stratification variable
: A variable for identifying each combination of respondents and DCE questions. This variable name is fixed asSTR
. -
Subset expression
: A logical expression for specifying a subset of the observations in the active dataset to be used for the fitting.
Calculate Marginal Willingness to Pay
Description
Calculate marginal willingness to pay (MWTP) values of nonmonetary variables from the fitted model.
Details
This dialog box uses the function mwtp
in
support.CEs to calculate MWTP values of nonmonetary variables
from the model fitted in the ‘Fit Model to DCE Data
’
dialog box.
This dialog box is activated if the fitted model is selected as
the active model. For details on the results of this dialog
box, refer to help for the function mwtp
.
GUI elements of this dialog box are as follows.
-
Name for output
: An R object name into which the calculated results obtained through this dialog box are stored. The default name ‘MWTP
’ can be changed following R's rules for naming objects. -
Monetary variable
: A variable used as the monetary variable in the calculation of MWTP(s). Select one from this drop-down list of variables. -
Nonmonetary variables
: Variables used as the nonmonetary variable(s) in the calculation of MWTP(s). Select one or more variables from this list box. -
Calculation method
: A method used to calculate confidence intervals for MWTP(s). Select one from two radio buttons corresponding to ‘Krinsky and Robb
’ and ‘Delta
’. For the details on these methods, see help formwtp
. -
Confidence level
: A confidence level used for calculating the confidence intervals for MWTP(s). The default is0.95
. -
Number of replications
: A total number of replications for the Krinsky and Robb method. -
Seed for random number generator (optional)
: An integer value used as a seed for generating random numbers. If reproducibility is needed, type an arbitrary value into this box.
Display DCE Questions
Description
Display a series of questions for DCEs.
Details
This dialog box displays a series of DCE questions that are converted from
the choice sets designed in the ‘Design Choice Sets for DCE
’
dialog box. This dialog box uses the function
questionnaire
in support.CEs.
For details on the results of this dialog box,
refer to help for questionnaire
.
GUI element of this dialog box is as follows.
-
Design
: An R object name containing DCE choice sets generated in the ‘Design Choice Sets for DCE
’ dialog box. The default name ‘DCEdesign
’ is displayed automatically. The correct name should be entered if the name of DCE choice sets (DCEdesign
) was changed in the dialog box for DCE design.
Collect Responses to DCE Questions
Description
Collect user's responses to DCE questions.
Details
Three types of dialog boxes are provided to collect user's responses to
DCE questions that are converted from the choice sets designed in
the ‘Design Choice Sets for DCE
’ dialog box.
The first dialog box (‘Set Options for Response Collection
’)
sets four options for response collections:
-
Design
: An R object name containing DCE choice sets generated in the ‘Design Choice Sets for DCE
’ dialog box. The default name ‘DCEdesign
’ is displayed automatically. The correct name should be entered if the name of DCE choice sets (DCEdesign
) was changed in the dialog box for DCE design. -
Opt-out option
: When the opt-out option will be used in the DCE questions, check this box. -
Save to file
: When the user's responses should be saved to an external file in CSV format (.csv
), check this box. -
Block number
: When the DCE choice sets are divided into two or more blocks, set the block number to which the user will be assigned.
After confirming all the settings on the first dialog box, press
the ‘OK
’ button to continue.
A series of dialog boxes (‘Collect Responses to DCE Questions
’)
sequentially opens to collect the user's responses to DCE questions.
In each dialog box, alternatives designed in the
‘Design Choice Sets for DCE
’
dialog box are presented. The user is asked to select their most preferred
alternative from the drop-down list box. After making the selection,
the user clicks the ‘OK
’ button to open a new dialog box
corresponding to the next DCE question.
When all user responses to DCE questions have been collected, a dialog
box (‘Save As
’) opens if the ‘Save to file
’
option was selected in the first dialog box. This saves the user's
responses to an external file in CSV format.