compose_identical: Compose identical choice sets

View source: R/compose_identical.R

compose_identicalR Documentation

Compose identical choice sets

Description

This is an internal function which creates identical choice sets configurations for give experimental design. The function simplifies the size adjustment of Z depending on the population size of X.

Usage

compose_identical(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_identical(edesign, size = 2)

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