Title: | DCE Data Reshaping and Processing |
Version: | 0.0.1 |
Description: | Prepare the results of a DCE to be analysed through choice models.'DCEmgmt' reshapes DCE data from wide to long format considering the special characteristics of a DCE. 'DCEmgmt' includes the function 'DCEestm' which estimates choice models once the database has been reshaped with 'DCEmgmt'. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.2 |
Depends: | R (≥ 3.5.0) |
Suggests: | knitr, rmarkdown, stats |
VignetteBuilder: | knitr |
Imports: | mlogit (≥ 1.0-2), survival |
NeedsCompilation: | no |
Packaged: | 2021-10-25 11:54:20 UTC; danie |
Author: | Daniel Perez-Troncoso [aut, cre] |
Maintainer: | Daniel Perez-Troncoso <danielperez@ugr.es> |
Repository: | CRAN |
Date/Publication: | 2021-10-26 08:40:02 UTC |
DCEmgmt function
Description
Prepare the results of a DCE to be analysed through choice models.
Usage
DCEmgmt(data, droprow, keepvar, create.id, blocks, sets, alts, options, design)
Arguments
data |
Data.frame with the survey data in wide data format. See 'data(survey)' |
droprow |
Rows to be deleted. Specify a single row (droprow = x) or more than one (dropdown = x:y). |
keepvar |
Select the case-specific variables to be kept. For example: keepvar = c("x", "y"). |
create.id |
Create a variable called "id" with a unique identificator per respondent. create.id = TRUE |
blocks |
Specifies the variables designating each choice set block. Each choice set variable must be named as a letter (for instance Q) followed by a number (starting by 1). Thus, the first block of choice sets can be named Q1, Q2, Q3, Q4 whereas the second can be called F5, F6, F7, F8. In this case, block = c("Q", "F"). If there is only one block, block = c("Q"). |
sets |
Specify the number of choice sets per block. If there is only one block, specify the total number of choice sets. For instance, sets = 8. |
alts |
Specify the number of alternatives per choice set. For example, alts = 3. |
options |
Vector indicating the string used to designate the choice. For example, option = c("Option A", "Option B", "Option C"). See examples. |
design |
Data frame with the design matrix in dummy or effects coding. PONER EJEMPLO |
Examples
data(survey)
data(design)
data.c<-DCEmgmt(data = data,
droprow = 1:5,
keepvar = c("age", "height"),
create.id = TRUE,
blocks = c("B1_", "B2_"),
sets = 8,
alts = 2,
options = c("Prefiero el servicio A", "Prefiero el servicio B"),
design = design)
#The data frame data.c contains the coded DCE data
Survey data from the DCE in Consumers' preferences and WTP for personalised nutrition (https://doi.org/10.1007/s40258-021-00647-3)
Description
Survey data from the DCE in Consumers' preferences and WTP for personalised nutrition (https://doi.org/10.1007/s40258-021-00647-3)
Usage
data(survey)
Format
An object of class tbl_df
(inherits from tbl
, data.frame
) with 242 rows and 21 columns.
Source
doi: 10.1007/s40258-021-00647-3DOI
References
P?rez-Troncoso et al. (2021) Applied Health Economics and Health Policy 19, 757-767 (PubMed)
Examples
data <- data(survey)
Coded dataset
Description
Coded dataset
Usage
data(data.c)
Format
An object of class data.frame
with 3744 rows and 20 columns.
Source
doi: 10.1007/s40258-021-00647-3
References
Perez-Troncoso et al. (2021) Applied Health Economics and Health Policy 19, 757-767 (PubMed)
Examples
data. <- data(data.c)
Design matrix from the DCE in Consumers' preferences and WTP for personalised nutrition (https://doi.org/10.1007/s40258-021-00647-3)
Description
Design matrix from the DCE in Consumers' preferences and WTP for personalised nutrition (https://doi.org/10.1007/s40258-021-00647-3)
Usage
data(design)
Format
An object of class tbl_df
(inherits from tbl
, data.frame
) with 32 rows and 14 columns.
Source
doi: 10.1007/s40258-021-00647-3
References
P?rez-Troncoso et al. (2021) Applied Health Economics and Health Policy 19, 757-767 (PubMed)
Examples
design <- data(design)