compose_distinct: Compose random choice sets

View source: R/compose_distinct.R

compose_distinctR Documentation

Compose random choice sets

Description

This is an internal function which creates distinct choice sets configurations for give experimental design. The function simplifies the size adjustment of Z depending on the population size of X. Each individuals faces a personalised Z version.

Usage

compose_distinct(experimental_design, n = NULL, size)

Arguments

experimental_design

An 'experimental_design' object.

n

Number of different choice situations per individual. Is NULL by default, ensuring that the function will retreive the n value from the 'experimental_design'.

size

Population size for Z to be adjusted to.

Value

data.frame Z dataset

Examples

# Create alternatives
alt1 <- alternative$new()
alt1$add_attributes(Quality = runif(min = 0, max = 1), Price = rnorm(mean = 5))
alt2 <- alternative$new()
alt2$add_attributes(Size = runif(min = 0, max = 1), Price = rnorm(mean = 6))

# Regroup alternatives into design
edesign <- experimental_design$new(alternatives = list(alt1, alt2), n = 4)

# Compose
Z <- compose_distinct(edesign, size = 2)

nikitagusarov/dcesimulatr documentation built on Jan. 7, 2023, 4:27 p.m.