wide_conjoint: Example of a raw, "wide" conjoint dataset to demonstrate...

Description Usage Format See Also Examples

Description

A simulated dataset containing 100 respondents' responses to four decision tasks (a,b,c,d) involving a forced choice between two alternative profiles, described by three features (1,2,3), as well as a secondary rating-scale outcome and a response time measure, along with two respondent-varying covariates. This is used in testing and examples within the package.

Usage

1

Format

A data frame with 100 observations on the following variables:

respondent

a numeric vector indicating the respondent identifier

feature1a1

Feature 1 for task A left profile, a factor

feature1b1

Feature 1 for task B left profile, a factor

feature1c1

Feature 1 for task C left profile, a factor

feature1d1

Feature 1 for task D left profile, a factor

feature1a2

Feature 1 for task A right profile, a factor

feature1b2

Feature 1 for task B right profile, a factor

feature1c2

Feature 1 for task C right profile, a factor

feature1d2

Feature 1 for task D right profile, a factor

feature2a1

Feature 2 for task A left profile, a factor

feature2b1

Feature 2 for task B left profile, a factor

feature2c1

Feature 2 for task C left profile, a factor

feature2d1

Feature 2 for task D left profile, a factor

feature2a2

Feature 2 for task A right profile, a factor

feature2b2

Feature 2 for task B right profile, a factor

feature2c2

Feature 2 for task C right profile, a factor

feature2d2

Feature 2 for task D right profile, a factor

feature3a1

Feature 3 for task A left profile, a factor

feature3b1

Feature 3 for task B left profile, a factor

feature3c1

Feature 3 for task C left profile, a factor

feature3d1

Feature 3 for task D left profile, a factor

feature3a2

Feature 3 for task A right profile, a factor

feature3b2

Feature 3 for task B right profile, a factor

feature3c2

Feature 3 for task C right profile, a factor

feature3d2

Feature 3 for task D right profile, a factor

choice_a

outcome for task A indicating which profile was chosen, randomly 1 or 2, each equally probable

choice_b

outcome for task B indicating which profile was chosen, randomly 1 or 2, each equally probable

choice_c

outcome for task C indicating which profile was chosen, randomly 1 or 2, each equally probable

choice_d

outcome for task D indicating which profile was chosen, randomly 1 or 2, each equally probable

rating_a1

rating for task A left profile, random variable between 1 and 7, uniformly distributed

rating_a2

rating for task A right profile, random variable between 1 and 7, uniformly distributed

rating_b1

rating for task B left profile, random variable between 1 and 7, uniformly distributed

rating_b2

rating for task B right profile, random variable between 1 and 7, uniformly distributed

rating_c1

rating for task C left profile, random variable between 1 and 7, uniformly distributed

rating_c2

rating for task C right profile, random variable between 1 and 7, uniformly distributed

rating_d1

rating for task D left profile, random variable between 1 and 7, uniformly distributed

rating_d2

rating for task D right profile, random variable between 1 and 7, uniformly distributed

timing_a

timing for task A in seconds, random draws from a beta distribution (2,5) times 10

timing_b

timing for task A in seconds, random draws from a beta distribution (2,5) times 10

timing_c

timing for task A in seconds, random draws from a beta distribution (2,5) times 10

timing_d

timing for task A in seconds, random draws from a beta distribution (2,5) times 10

covariate1

random draws from a uniform distribution between -1 and 1

covariate2

random draws from the set of 1 and 2

See Also

cj_tidy cj

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
data("wide_conjoint")
# feature_variables
list1 <- list(
 feature1 = list(
     names(wide_conjoint)[grep("^feature1.{1}1", names(wide_conjoint))],
     names(wide_conjoint)[grep("^feature1.{1}2", names(wide_conjoint))]
 ),
 feature2 = list(
     names(wide_conjoint)[grep("^feature2.{1}1", names(wide_conjoint))],
     names(wide_conjoint)[grep("^feature2.{1}2", names(wide_conjoint))]
 ),
 feature3 = list(
     names(wide_conjoint)[grep("^feature3.{1}1", names(wide_conjoint))],
     names(wide_conjoint)[grep("^feature3.{1}2", names(wide_conjoint))]
 ),
 rating = list(
     names(wide_conjoint)[grep("^rating.+1", names(wide_conjoint))],
     names(wide_conjoint)[grep("^rating.+2", names(wide_conjoint))]
 )
)
# task variables
list2 <- list(choice = paste0("choice_", letters[1:4]),
              timing = paste0("timing_", letters[1:4]))
str(cj_tidy(wide_conjoint, profile_variables = list1, task_variables = list2, id = ~ respondent))

## End(Not run)

Example output

Classescj_dfand 'data.frame':	800 obs. of  12 variables:
 $ respondent: int  1 2 3 4 5 6 7 8 9 10 ...
 $ covariate1: num  0.59 0.731 0.735 0.656 -0.302 ...
 $ covariate2: int  2 1 2 2 1 2 2 1 1 1 ...
 $ task      : int  1 1 1 1 1 1 1 1 1 1 ...
 $ profile   : Factor w/ 2 levels "A","B": 1 1 1 1 1 1 1 1 1 1 ...
 $ feature1  : Factor w/ 4 levels "Feature1_levela",..: 3 1 4 2 1 3 2 4 4 3 ...
 $ feature2  : Factor w/ 6 levels "Feature2_levele",..: 1 1 4 1 3 2 4 5 3 3 ...
 $ feature3  : Factor w/ 4 levels "Feature3_levelk",..: 1 2 2 1 2 3 3 2 3 4 ...
 $ rating    : int  1 4 2 1 7 7 3 2 3 3 ...
 $ choice    : num  2 1 2 2 2 1 1 2 1 2 ...
 $ timing    : num  5.28 4.1 3.81 2.82 2.99 ...
 $ pair      : int  1 2 3 4 5 6 7 8 9 10 ...

cregg documentation built on July 8, 2020, 6:57 p.m.