DCEmgmt: DCEmgmt function

Description Usage Arguments Examples

View source: R/DCEmgmt.R

Description

Prepare the results of a DCE to be analysed through choice models.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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

DCEmgmt documentation built on Oct. 26, 2021, 9:06 a.m.