mnl_design_array_to_dataframe: Convert a design array to tibble.

Description Usage Arguments Value Examples

View source: R/mnl_model_functions.R

Description

This function allows the user to convert a 3-dimensional design array into a tibble, which helps for readability and to plot.

Usage

1

Arguments

des_array

must be a 3-dimensional design array of dimension (k, J, S) where k is the number of variables, J the number of alternatives in each choice set and S is the number of choice sets.

names

Names of the (k+1) columns. If NULL, then the names of the columns are c(paste0("c", 1:k), "choice_set").

Value

Returns a tibble with (k+1) columns where the first k columns are the variables and the (k+1)-th column is the choice set.

Examples

1
2
3
design_array_to_dataframe(mnl_create_random_initial_design(q = 3, J = 2, S = 4)

design_array_to_dataframe(mnl_create_random_initial_design(q = 3, J = 2, S = 4), names = c("v1", "v2", "v3", "cs"))

mariobecerra/opdesmixr documentation built on Aug. 13, 2021, 9:44 p.m.