Type: | Package |
Title: | R Commander Plug-in for Case 1 Best-Worst Scaling |
Version: | 0.3-0 |
Date: | 2025-04-30 |
Depends: | crossdes, support.BWS (≥ 0.4-1), support.CEs, survival |
Imports: | Rcmdr |
Description: | Adds menu items to the R Commander for implementing case 1 (object case) best-worst scaling (BWS1) from designing choice sets to measuring preferences for items. BWS1 is a question-based survey method that constructs various combinations of items (choice sets) using the experimental designs, asks respondents to select the best and worst items in each choice set, and then measures preferences for the items by analyzing the responses. For details, refer to Aizaki and Fogarty (2023) <doi:10.1016/j.jocm.2022.100394>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://sites.google.com/view/r4sp/rcmdrplugin |
RcmdrModels: | clogit |
NeedsCompilation: | no |
Packaged: | 2025-04-30 03:39:16 UTC; r |
Author: | Hideo Aizaki [aut, cre] |
Maintainer: | Hideo Aizaki <azk-r@spa.nifty.com> |
Repository: | CRAN |
Date/Publication: | 2025-04-30 07:50:15 UTC |
R Commander Plug-in for Case 1 Best–Worst Scaling
Description
This package adds menu items to the R Commander for implementing case 1 (object case) best–worst scaling (BWS1) from designing choice sets to measuring preferences for items. BWS1 is a question-based survey method that constructs various combinations of items (choice sets) using the experimental designs, asks respondents to select the best and worst items in each choice set, and then measures preferences for the items by analyzing the responses. For details on BWS1, refer to Louviere et al. (2015).
Details
This package is an R Commander Plug-in package for BWS1. It depends on R packages crossdes (Sailer 2005), support.BWS (Aizaki 2021; Aizaki and Fogarty 2023; Aizaki et al. 2014), support.CEs (Aizaki 2012), and survival (Therneau 2021; Therneau and Grambsch 2000) as well as the Rcmdr package (Fox 2005, 2017ab; Fox and Bouchet-Valat 2021). Refer to Aizaki and Fogarty (2023) and ‘Non-Market Valuation with R’ <https://nmvr.skr.jp/> for a brief introduction to BWS1 in R. A manual for this package is available at <https://sites.google.com/view/r4sp/rcmdrplugin>.
After successfully installing and loading RcmdrPlugin.BWS1,
the R Commander window will appear, and then you will find ‘BWS1
’
added to the top-level menus in the R Commander window.
Selecting ‘BWS1
’ displays several menu items. When selecting a
menu item, the corresponding dialog box opens. The following dialog
boxes are provided by RcmdrPlugin.BWS1:
The dialog box for ‘
Design choice sets...
’ designs choice sets for BWS1 with an balanced incomplete block design (BIBD) using functionsfind.BIB
andisGYD
in the package crossdes.The dialog box for ‘
Display questions...
’ displays a series of questions for BWS1 according to choice sets designed in the previous dialog box using the functionbws.questionnaire
in the package support.BWS.The dialog box for ‘
Collect responses...
’ displays three types of dialog boxes to collect user's responses to BWS1 questions according to choice sets designed in the previous dialog box.The dialog box for ‘
Create data set for analysis...
’ creates a data set for analysis from the BIBD generated in the first dialog box and a data set containing responses to BWS1 questions using the functionbws.dataset
in support.BWS.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 BWS1 analysis created in the previous dialog box, and then stores them into a data frame using the functionbws.count
in support.BWS.Selecting ‘
Summarize scores
’ summarizes the BW scores calculated in the previous dialog box and displays the results in the Output pane of the R Commander window.The dialog box for ‘
Draw distributions of scores...
’ draws distributions (bar plots) of the BW scores by item using an R basic graphic functionbarplot
(S3 method for class ‘bws.count2’:bws.count
).The dialog box for ‘
Draw mean scores...
’ draws a bar plot of means of the BW scores by item using the functionbarplot
(S3 method for class ‘bws.count2’:bws.count
).The dialog box for ‘
Draw relationship between means and sds of scores...
’ draws a plot of the relationship between means and standard deviations of the BW scores by item using an R basic graphic functionplot
(S3 method for class ‘bws.count2’:bws.count
).The dialog box for ‘
Fit model...
’ implements a modeling analysis using the data set for BWS1 analysis generated in the previous dialog box using the functionsclogit
in survival andgofm
in support.CEs.The dialog box for ‘
Calculate shares of preferences...
’ calculates shares of preferences for items from the model fitted in the previous dialog boxes using the functionbws.sp
in support.BWS.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, Code Snippets, 50(2): 1–24. DOI: 10.18637/jss.v050.c02
Aizaki H (2021) support.BWS: Tools for Case 1 Best-Worst Scaling. R package version 0.4-4. https://CRAN.R-project.org/package=support.BWS.
Aizaki H, Fogarty J (2023) R packages and tutorial for case 1 best-worst scaling. Journal of Choice Modelling, 46: 100394. DOI: 10.1016/j.jocm.2022.100394
Aizaki H, Nakatani T, Sato K (2014) Stated Preference Methods Using R. Chapman and Hall/CRC. DOI: 10.1201/b17292
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 (2017a) Using the R Commander: A Point-and-Click Interface for R. Chapman and Hall/CRC. DOI: 10.1201/9781315380537
Fox J (2017b) Writing R Commander Plug-in Packages. Version 3.4-0.
Fox J, Marquez MM, Bouchet-Valat M (2024) Rcmdr: R Commander. R package version 2.9-5. https://cran.r-project.org/package=Rcmdr.
Louviere JJ, Flynn TN, Marley AAJ (2015) Best-Worst Scaling: Theory, Methods and Applications. Cambridge University Press. DOI: 10.1017/CBO9781107337855
Sailer O (2005) crossdes: A package for design and randomization in crossover studies. Rnews, 5/2: 24–27.
Therneau T (2021) survival: Survival Analysis. R package version 3.2-13. https://CRAN.R-project.org/package=survival.
Therneau TM, Grambsch PM (2000) Modeling Survival Data: Extending the Cox Model. Springer. DOI: 10.1007/978-1-4757-3294-8
Examples
if (interactive()) {
library(RcmdrPlugin.BWS1)
}
Calculate BWS1 Scores
Description
Calculate various BW scores for each respondent from the data set for BWS1 analysis.
Details
This dialog box, which uses the function bws.count
in support.BWS, calculates various BW scores for each respondent
from the data set for BWS1 analysis created in the
‘Create Data Set for BWS1 Analysis
’ dialog box.
This dialog box is activated if the data set for BWS1 analysis is selected
as the active data set. For details on the results of this dialog box,
refer to help for the function bws.count
.
The resultant data frame is selected automatically as the active data set.
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 ‘BWS1data
’ can be changed following R's rules for naming objects.
Draw Distributions of BWS1 Scores
Description
Draw distributions of the BW scores by item.
Details
This dialog box draws distributions (bar plots) of the BW scores by item
using an R basic graphic function barplot.bws.count2
(barplot
for S3 class ‘bws.count2
’).
This dialog box is activated if the data set containing BWS1
scores generated in the ‘Calculate BWS1 Scores
’ dialog box
is selected as the active data set.
For details on the results of this dialog box, refer to help for
bws.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.
Draw Mean BWS1 Scores
Description
Draw a bar plot of means of the BW scores by item.
Details
This dialog box draws a bar plot of means of the BW scores by item
using the function barplot.bws.count2
(barplot
for S3 class ‘bws.count2
’).
This dialog box is activated if the data set containing BWS1 scores
generated in the ‘Calculate BWS1 Scores
’ dialog box is
selected as the active data set.
For details on the results of this dialog box, refer to help for
bws.count
.
GUI elements of this dialog box are as follows.
-
Score type
: Type of score to be drawn. Select one from four radio buttons corresponding to ‘Best-minus-Worst (BW)
’, ‘Standardized BW
’, ‘Best
’, and ‘Worst
’. -
Error bar type
: A type of error bar added in the bar plot. Select one from four radio buttons corresponding to ‘None
’, ‘Standard deviation
’, ‘Standard error
’, and ‘Confidence interval
’. -
Confidence level
: A confidence level when adding the confidence interval on the bar plot. This option is valid only when selecting ‘Confidence interval
’ as the error bar type. -
Left margin of plot
: Number of lines of margin to be specified on the left side of the plot.
Draw Relationship between Means and Standard Deviations of BWS1 Scores
Description
Draw a plot of the relationship between means and standard deviations of the BW scores by item.
Details
This dialog box draws a plot of the relationship between means and
standard deviations of the BW scores by item using the function
plot.bws.count2
(plot
for S3 class
‘bws.count2
’).
This dialog box is activated if the data set containing BWS1 scores
generated in the ‘Calculate BWS1 Scores
’ dialog box is
selected as the active data set.
For details on the results of this dialog box, refer to help for
bws.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
’. -
Position of point labels
: A position of labels for points in the plot. Select one from four radio buttons corresponding to ‘Below
’, ‘Left
’, ‘Above
’, and ‘Right
’. -
x-axis
: the x limits of the plot. The lower limit and the upper limit are specified in the ‘from
’ box and the ‘to
’ box, respectively. -
y-axis
: the y limits of the plot. The lower limit and the upper limit are specified in the ‘from
’ box and the ‘to
’ box, respectively.
Create Data Set for BWS1
Description
Create a data set for BWS1 analysis from choice sets for BWS1 and data set containing responses to BWS1 questions.
Details
This dialog box uses the function bws.dataset
in
support.BWS to create a data set for BWS1 analysis from the choice
sets designed in the ‘Design Choice Sets for BWS1
’ dialog box
and a data set containing responses to BWS1 questions.
This dialog box is activated if the data set containing responses to BWS1
questions is selected as the active data set. For details on the results of
this dialog box, refer to help for bws.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 ‘BWS1data
’ 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 BWS1 choice sets generated in the ‘Design Choice Sets for BWS1
’ dialog box. The default name ‘BWS1design
’ is displayed automatically. The correct name should be entered if the name of BWS1 choice sets (BWS1design
) was changed in the dialog box for BWS1 design. -
Items
: An R object name containing BWS1 items entered in the ‘Design Choice Sets for BWS1
’ dialog box. The default name ‘BWS1items
’ is displayed automatically. The correct name should be entered if the name of BWS1 items (BWS1items
) was changed in the dialog box for BWS1 design. -
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. -
Response variable format
: A format of response variable. Select one from two radio buttons corresponding to ‘Row number format
’ and ‘Item number format
’. See help for a functionbws.dataset
for the definition of two formats. -
Model type
: The specific type of model used for an analysis. Select one from three radio buttons corresponding to ‘Maxdiff model
’, ‘Marginal model
’, and ‘Marginal sequential model
’. Search help for a functionbws.dataset
for details on three models. -
Number of BWS1 questions
: The number of BWS1 questions per respondent. According to the design parameters set in the ‘Design Choice Sets for BWS1
’ dialog box, this slider is set to 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
: Types/formats 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, the letters of the 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 BWS1
Description
Design choice sets for BWS1 with a balanced incomplete block design.
Details
This dialog box uses the functions find.BIB
and
isGYD
in package crossdes to
design choice sets for BWS1 with a balanced incomplete block design.
For details on the results of this dialog box, refer to the help content
for the functions find.BIB
and
isGYD
.
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 ‘BWS1design
’ 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 items
: An object name for items entered in the ‘Items
’ table (explained later). The default name ‘BWS1items
’ 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 both the resultant design object and the items object to a single external file in RDA format (.rda
). If necessary, check this box. -
Number of items
: A total number of items to be evaluated in BWS1 questions. -
Number of questions
: A total number of BWS1 questions. -
Number of items per question
: The number of items that appeared in each BWS1 question. -
Items
: Item names. As items typed into this table will be used as variables in the following process, item names must follow R's rules for naming variables. Type names without skipping from ‘Item 1
’. -
Number of iterations
: Total number of iterations for searching for a design that meets the design parameters assigned above. The default is1000
. -
Seed for random number generator (optional)
: An integer value used as a seed for generating random numbers. If reproducibility is required, type an arbitrary value into this box.
Fit Model to BWS1 Data
Description
Fit a model to BWS1 data.
Details
This dialog box implements a modeling analysis using the data set
for BWS1 analysis with the functions clogit
in
survival and gofm
in support.CEs.
This dialog box is activated if the data set for BWS1 analysis created
in the ‘Create Data Set for BWS1 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 through this dialog box are stored. The default name ‘BWS1model.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 BWS1 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). -
Base item
: An item used as the reference (base) item in the model. Select one item from the radio buttons that correspond to the items. A list of items is automatically displayed on the dialog 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 BWS1 questions. This variable name is fixed as ‘STR
’. -
Subset expression
: A logical expression for specifying a subset of the observations in the active data set to be used for the fitting.
Display BWS1 Questions
Description
Displays a series of questions for BWS1.
Details
This dialog box displays a series of questions for BWS1 according to the
choice sets designed in the ‘Design Choice Sets for BWS1
’ dialog
box using the function
bws.questionnaire
in support.BWS.
For details on the results of this dialog box, refer to the help content for
bws.questionnaire
.
GUI elements of this dialog box are as follows.
-
Design
: An R object name containing the BWS1 choice sets generated in the ‘Design Choice Sets for BWS1
’ dialog box. The default name ‘BWS1design
’ is displayed automatically. The correct name should be entered if the name of the BWS1 choice sets (BWS1design
) was changed in the dialog box for BWS1 design. -
Items
: An R object name containing the BWS1 items entered in the ‘Design Choice Sets for BWS1
’ dialog box. The default name ‘BWS1items
’ is displayed automatically. The correct name should be entered if the name of BWS1 items (BWS1items
) was changed in the dialog box for BWS1 design.
Collect Responses to BWS1 Questions
Description
Collect user's responses to BWS1 questions.
Details
Three types of dialog boxes are provided to collect user's responses to
BWS1 questions that are converted from the choice sets designed in
the ‘Design Choice Sets for BWS1
’ dialog box.
The first dialog box (‘Set Options for Response Collection
’)
sets three options for response collections:
-
Design
: An R object name containing BWS1 choice sets generated in the ‘Design Choice Sets for BWS1
’ dialog box. The default name ‘BWS1design
’ is displayed automatically. The correct name should be entered if the name of BWS1 choice sets (BWS1design
) was changed in the dialog box for BWS1 design. -
Items
: An R object name containing the BWS1 items entered in the ‘Design Choice Sets for BWS1
’ dialog box. The default name ‘BWS1items
’ is displayed automatically. The correct name should be entered if the name of BWS1 items (BWS1items
) was changed in the dialog box for BWS1 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 BWS1 Questions
’)
sequentially opens to collect the user's responses to BWS1 questions.
In each dialog box, items designed in the ‘Design Choice Sets for BWS1
’
dialog box are presented. The user is asked to select their best and worst
items 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 BWS1 question.
When all user responses to BWS1 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.
Calculate Shares of Preferences
Description
Calculate shares of preferences for items from the fitted model.
Details
This dialog box calculates shares of preferences for items from
the model fitted in the ‘Fit Model to BWS1 Data
’
dialog box using the function
bws.sp
in support.BWS.
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 bws.sp
.
GUI elements of this dialog box are as follows.
-
Base item
: An item used as the reference (base) item in the model. This is selected automatically according to the setting for fitting the model in the ‘Fit Model to BWS1 Data
’ dialog box. -
Item names (optional)
: Item names to be calculated. -
Order
: A type of sorting order. Select one from three radio buttons corresponding to ‘None
’, ‘Increasing
’, and ‘Decreasing
’.