From caa26fcc1fb6b27d30b2343277856f119373da21 Mon Sep 17 00:00:00 2001 From: Julian Sagebiel <julian.sagebiel@idiv.de> Date: Sun, 15 Dec 2024 22:24:50 +0100 Subject: [PATCH] added a second way to transform utility beta coefficients --- R/sim_choice.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/sim_choice.R b/R/sim_choice.R index 7701952..a131f85 100644 --- a/R/sim_choice.R +++ b/R/sim_choice.R @@ -14,7 +14,7 @@ #' @examples \dontrun{ simchoice(designfile="somefile", no_sim=10, respondents=330, #' mnl_U,ut=u[[1]] ,destype="ngene")} #' -sim_choice <- function(designfile, no_sim=10, respondents=330,ut ,destype=destype, bcoefficients, decisiongroups=c(0,1), manipulations = list() , estimate, chunks=1) { +sim_choice <- function(designfile, no_sim=10, respondents=330,ut ,destype=destype, bcoefficients, decisiongroups=c(0,1), manipulations = list() , estimate, chunks=1, utility_transform_type = "simple") { @@ -29,7 +29,8 @@ sim_choice <- function(designfile, no_sim=10, respondents=330,ut ,destype=destyp transform_util2 <- function() { mnl_U <-paste(purrr::map_chr(ut[[1]],as.character,keep.source.attr = TRUE),collapse = "",";") %>% - stringr::str_replace_all( c( "priors\\[\"" = "" , "\"\\]" = "" , "~" = "=", "\\." = "_" , "V_"="U_")) + stringr::str_replace_all( c( "priors\\[\"" = "" , "\"\\]" = "" , "~" = "=", "\\." = "_" , "V_"="U_")) %>% + stringr::str_replace_all(setNames(paste0("@", names(bcoefficients)), names(bcoefficients))) } -- GitLab