Type: | Package |
Title: | R Commander Plug-in for Case 2 Best-Worst Scaling |
Version: | 0.3-0 |
Date: | 2025-04-28 |
Depends: | support.BWS2 (≥ 0.4-0), support.CEs, survival |
Imports: | Rcmdr, DoE.base |
Description: | Adds menu items for case 2 (profile case) best-worst scaling (BWS2) to the R Commander. BWS2 is a question-based survey method that constructs profiles (combinations of attribute levels) using an orthogonal array, asks respondents to select the best and worst levels in each profile, and measures preferences for attribute levels by analyzing the responses. For details, see Aizaki and Fogarty (2019) <doi:10.1016/j.jocm.2019.100171>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://sites.google.com/view/r4sp/rcmdrplugin |
RcmdrModels: | clogit |
NeedsCompilation: | no |
Packaged: | 2025-04-28 07:55:07 UTC; r |
Author: | Hideo Aizaki [aut, cre] |
Maintainer: | Hideo Aizaki <azk-r@spa.nifty.com> |
Repository: | CRAN |
Date/Publication: | 2025-04-28 08:20:02 UTC |
R Commander Plug-in for Case 2 Best-Worst Scaling
Description
This package adds menu items for case 2 (profile case) best-worst scaling (BWS2) to the R Commander. BWS2 is a question-based survey method that constructs profiles (combinations of attribute levels) using an orthogonal array, asks respondents to select the best and worst levels in each profile, and measures preferences for attribute levels by analyzing the responses. For details, see Aizaki and Fogarty (2019) <doi:10.1016/j.jocm.2019.100171>.
Details
This package is an R Commander plug-in package for Case 2 (profile case) best–worst scaling (BWS2). It depends on DoE.base (Groemping 2018), Rcmdr (Fox 2005, 2017; Fox and Bouchet-Valat 2021), support.BWS2 (Aizaki 2021; Aizaki and Fogarty 2019), support.CEs (Aizaki 2012, 2021), and survival (Therneau 2022; Therneau and Grambsch 2000). Refer to Aizaki and Fogarty (2019) and ‘Non-Market Valuation with R’ <https://nmvr.skr.jp/> for a brief introduction to BWS2 in R, and Louviere et al. (2015) and Flynn et al. (2007) for BWS2. A manual for this package is available at <https://sites.google.com/view/r4sp/rcmdrplugin>.
After successfully installing and loading RcmdrPlugin.BWS2,
the R Commander window will appear, and then you will find ‘BWS2
’
added to the top-level menus in the R Commander window.
Selecting ‘BWS2
’ displays menu items. When selecting a menu item,
the corresponding dialog box opens. The following dialog boxes are
provided by RcmdrPlugin.BWS2:
The dialog box for ‘
Design choice sets...
’ designs choice sets (profiles) for BWS2 with an orthogonal design using the functionoa.design
in DoE.base.The dialog box for ‘
Display questions...
’ displays BWS2 questions from the profiles designed in the first dialog box using the functionbws2.questionnaire
in support.BWS2.The dialog box for ‘
Create data set for analysis...
’ creates a data set for analysis combining the choice sets designed in the first dialog box and a data set containing responses to BWS2 questions using the functionbws2.dataset
in support.BWS2.Selecting the menu item ‘
Measure preferences...
’ gives options: ‘Counting approach
’ and ‘Modeling approach
’. Each has additional sub-items (see below).The dialog box for ‘
Calculate scores...
’ calculates various BW scores for each respondent from the data set for BWS2 analysis created in the previous dialog box, and then stores them into a data frame using the functionbws2.count
in support.BWS2. The menu item is activated if a data set for BWS2 analysis created in the previous dialog box is selected as the active data set.Selecting ‘
Sum up scores
’ sums up the BW scores calculated in the previous dialog box and displays the results in the Output pane of the R Commander window. The menu item is activated if a data frame containing BW scores created in the previous dialog box is selected as the active data set.The dialog box for ‘
Draw distributions of scores...
’ draws distributions (bar plots) of the BW scores by level using an R basic graphic functionbarplot
(S3 method for class ‘bws2.count’:bws2.count
). The menu item is activated if a data frame containing BW scores 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 BWS2 analysis created in the previous dialog box using the functionsclogit
in survival andgofm
in support.CEs. The menu item is activated if a data set for BWS2 analysis created in the previous dialog box is selected as the active data set.The dialog box for ‘
Load saved objects...
’ loads an R Data (rda) 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. DOI: 10.18637/jss.v050.c02.
Aizaki H (2022) support.BWS2: Tools for Case 2 Best-Worst Scaling. R package version 0.4-0. https://CRAN.R-project.org/package=support.BWS2.
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, Fogarty J (2019) An R package and tutorial for case 2 best–worst scaling. Journal of Choice Modelling, 32, 100171. DOI: 10.1016/j.jocm.2019.100171.
Aizaki H, Nakatani T, Sato K (2014) Stated Preference Methods Using R. Chapman and Hall/CRC.
Flynn TN, Louviere JJ, Peters TJ, Coast J (2007) Best-Worst Scaling: What it can do for health care research and how to do it. Journal of Health Economics, 26, 171–189. DOI: 10.1016/j.jhealeco.2006.04.002.
Fox J (2005) The R Commander: A Basic Statistics Graphical User Interface to R. Journal of Statistical Software, 14(9): 1–42. DOI: 10.18637/jss.v014.i09.
Fox J (2017) Using the R Commander: A Point-and-Click Interface for R. Chapman and Hall/CRC.
Fox J, Bouchet-Valat M (2021) Rcmdr: R Commander. R package version 2.7-2. https://CRAN.R-project.org/package=Rcmdr.
Groemping U (2018) R Package DoE.base for Factorial Experiments. Journal of Statistical Software, 85(5), 1–41. DOI: 10.18637/jss.v085.i05.
Louviere JJ, Flynn TN, Marley AAJ (2015) Best-Worst Scaling: Theory, Methods and Applications. Cambridge University Press. DOI: 10.1017/CBO9781107337855.
Therneau T (2022) survival: Survival Analysis. R package version 3.3-1. 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.BWS2)
}
Calculate BWS2 Scores
Description
Calculate various BW scores for each respondent from the data set for BWS2 analysis.
Details
This dialog box calculates various BW scores for each respondent from
the data set for BWS2 analysis created in
the ‘Create Data Set for BWS2 Analysis
’ dialog box and
then stores them as a data frame using the function
bws2.count
in support.BWS2.
This dialog box is activated if the data set for BWS2 analysis is selected
as the active data set.
For details on the results of this dialog box, refer to help for function
bws2.count
.
GUI elements of this dialog box are as follows.
-
Name for scores
: An R object name into which a data set generated using this dialog box is stored. The default name ‘BWS2data
’ can be changed followingR's rules for naming objects.
Draw Distributions of BWS2 Scores
Description
Draw distributions of the BW scores by level.
Details
This dialog box draws distributions (bar plots) of the BW scores by level
by using the function barplot.bws2.count
(barplot
for S3 class ‘bws2.count
’).
This dialog box is activated if the data frame containing BW scores created
in the ‘Calculate BWS2 Scores
’ dialog box is selected as
the active data set.
For details on the results of this dialog box,
refer to help for bws2.count
.
GUI elements of this dialog box are as follows.
-
Score type
: Type of score to be drawn. Select one from three radio buttons corresponding to ‘Best-minus-Worst
’, ‘Best
’, and ‘Worst
’. -
Arrangement of bar plots (optional)
: An arrangement of bar plots to be drawn. The number of bar plots drawn by this dialog box is equal to the number of items (K). Total K bar plots are drawn in an NR-by-NC array (matrix) on the device by row, where NR and NC are integer values entered in the ‘row(s)
’ box and the ‘column(s)
’ box, respectively.
Create Data Set for BWS2 Analysis
Description
Create a data set for BWS2 analysis combining the choice sets and data set containing responses to BWS2 questions.
Details
This dialog box uses the function bws2.dataset
in support.BWS2 to create a data set for BWS2 analysis combining
the choice sets designed in the ‘Design Choice Set for BWS2
’
dialog box and a data set containing responses to BWS2 questions.
For details on the results of this dialog box, refer to help for the function
bws2.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 ‘BWS2data
’ 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 BWS2 choice sets generated in the ‘Design Choice Set for BWS2
’ dialog box. The default name ‘BWS2design
’ is displayed automatically. The correct name should be entered if the name of BWS2 choice sets (BWS2design
) was changed in the dialog box for BWS2 design. -
Attributes and levels
: An R object name containing attributes and their levels set in the ‘Design Choice Set for BWS2
’ dialog box. The object name ‘BWS2attributes
’ cannot be changed (A fixed variable is colored in green). -
ID variable
: A variable name identifying respondents. The default name ‘id
’ can be changed according to the corresponding variable name in the active data set. -
Model type
: Type of model used for the analysis. Select one from three radio buttons corresponding to ‘Paired model
’, ‘Marginal model
’, and ‘Marginal sequential model
’. See help for the functionbws2.dataset
for details on three models. -
Reverse attribute variables
: A check box to indicate when the signs of the attribute variables are reversed for the possible worst. -
Base attribute
: The base attribute when attribute variables are created as effect-coded variables. No variable is selected when attribute variables are created as dummy coded variables. -
Base level for X
: the base level in attributeX
when level variables are created as effect-coded variables. No variable is selected when level variables are created as dummy coded variables. -
Number of BWS2 questions
: Number of BWS2 questions per respondent. According to the design parameters set in the ‘Design Choice Set for BWS2
’ dialog box, this slider is set at the appropriate number. Depending on the number, the number of rows of the ‘Names of best- and worst-response variables
’ table varies. -
Letters of best- and worst-response variables
: A type of letters used for best- and worst-variable names shown in the ‘Names of best- and worst-variable names
’ table. Select one from three radio buttons corresponding to ‘Uppercase
’, ‘Lowercase
’, and ‘None
’. According to the selection, letters of best- and worst variable names in the table are changed. When selecting ‘None
’, no variable names appear in the table. Users must type appropriate names in each cell of the table. -
Names of best- and worst-response variables
: Names of best- and worst-response variables stored in the active data set. These names must follow R's rules for naming variables.
Please click the ‘Cancel
’ button and open this dialog box again
if it does not work as expected.
Design Choice Sets for BWS2
Description
Design choice sets for BWS2 with an orthogonal design.
Details
This dialog box designs choice sets (profiles) for BWS2 with an orthogonal
design using the function oa.design
in
DoE.base.
GUI elements of this dialog box are as follows.
-
Name for design
: An R object name into which choice sets generated using the dialog box are stored. The default name ‘BWS2design
’ 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. -
Name for attributes and levels
: An object name into which attributes and their levels entered in the ‘Attributes and their levels
’ table (explained later) are stored. The default name ‘BWS2attributs
’ cannot be changed (A fixed variable is colored in green). -
Save to file
: A check box for saving both the resultant design object and the items object to a single external file in RDA format (.rda
). If necessary, check this box. -
Attributes and their levels
: A specification (table) of attributes and their levels used to generate BWS2 choice sets. -
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
’. -
Randomize the order of sets
: A check box for randomizing the row order of resultant choice sets. A row corresponds to a set in the resultant choice sets. -
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.
Fit Model to BWS2 Data
Description
Fit a model to BWS2 data.
Details
This dialog box fits a conditional logit model to the data set for BWS2
analysis using the functions clogit
in survival
and gofm
in support.CEs.
This dialog box is activated if the data set for BWS2 analysis created in
the ‘Create Data Set for BWS2 Analysis
’ dialog box is selected
as the active data set.
For details on the results of this dialog box, refer to helps for functions
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 through this dialog box are stored. The default name ‘BWS2model.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 BWS2 questions in the active data set. This variable name is fixed as ‘RES
’, which cannot be changed by users (A fixed variable is colored in green). -
Attribute variables
: Attribute variables used in the model. Select zero or more variables from this list box. -
Level variables
: Level variables used in the model. Select appropriate variables from this list box. -
Covariates
: Variables used as covariates in the model. Select zero or more variables from this list box. -
Stratification variable
: A variable for identifying each combination of respondents and BWS2 questions. This variable name is fixed as ‘STR
’. -
Subset expression
: A logical expression for specifying a subset of the observations in the active dataset to be used for the fitting.
Display BWS2 Questions
Description
Display a series questions for BWS2.
Details
This dialog box displays a series of questions for BWS2 according to
the profiles designed in the ‘Design Choice Sets for BWS2
’
dialog box using the function
bws2.questionnaire
in support.BWS2.
For details on the results of this dialog box,
refer to help for bws2.questionnaire
.
GUI elements of this dialog box are as follows.
-
Design
: An R object name containing BWS2 choice sets generated in the ‘Design Choice Sets for BWS2
’ dialog box. The default name ‘BWS2design
’ is displayed automatically. The correct name should be entered if the name for design (BWS2design
) was changed in the dialog box for BWS2 design. -
Attributes and levels
: An R object name containing attributes and their levels set in the previous dialog box. The object name ‘BWS2attributes
’ cannot be changed (A fixed variable is colored in green). -
Position of attribute column
: A position where attribute levels are shown in questions. Select one from three radio buttons corresponding to ‘Left
’, ‘Center
’, and ‘Right
’.
Collect Responses to BWS2 Questions
Description
Collect user's responses to BWS2 questions.
Details
Three types of dialog boxes are provided to collect user's responses to
BWS2 questions that are converted from the choice sets designed in
the ‘Design Choice Sets for BWS2
’ dialog box.
The first dialog box (‘Set Options for BWS2 Response Collection
’)
sets two options for response collections:
-
Design
: An R object name containing BWS2 choice sets generated in the ‘Design Choice Sets for BWS2
’ dialog box. The default name ‘BWS2design
’ is displayed automatically. The correct name should be entered if the name of BWS2 choice sets (BWS2design
) was changed in the dialog box for BWS2 design. -
Save to file
: When the user's responses should be saved to an external file in CSV format (.csv
), check this box.
After confirming all the settings on the first dialog box, press
the ‘OK
’ button to continue.
A series of dialog boxes (‘Collect Responses to BWS2 Questions
’)
sequentially opens to collect the user's responses to BWS2 questions.
In each dialog box,
levels designed in the ‘Design Choice Sets for BWS2
’
dialog box are presented. The user is asked to select their best and worst
levels from the drop-down list boxes. After making the selection,
the user clicks the ‘OK
’ button to open a new dialog box
corresponding to the next BWS2 question.
When all user responses to BWS2 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.