From 3eecbb819a59a4bb95865bdf917301c0b0b71188 Mon Sep 17 00:00:00 2001
From: dj44vuri <julian.sagebiel@idiv.de>
Date: Fri, 24 Nov 2023 20:38:13 +0100
Subject: [PATCH] working again after errors

---
 Projects/ValuGaps/parameters_valugaps.R | 5 +----
 functions.R                             | 9 ++-------
 simulationcore_purrr.R                  | 2 +-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/Projects/ValuGaps/parameters_valugaps.R b/Projects/ValuGaps/parameters_valugaps.R
index 3136816..5ad0969 100644
--- a/Projects/ValuGaps/parameters_valugaps.R
+++ b/Projects/ValuGaps/parameters_valugaps.R
@@ -118,10 +118,7 @@ u<-list(
   v2 =V.2~ basc + bb * alt2.protected +  bb2 * alt2.protectedsq + bc * alt2.HNV + bc2 * alt2.HNVsq + bp * alt2.p ,
   v3 =V.3~        bb * alt3.protected +  bb2 * alt3.protectedsq + bc * alt3.HNV + bc2 * alt3.HNVsq )
 
-# u<-list(
-# v1 =V.1~ basc + bb*alt1.b+ bc * alt1.c + bp * alt1.p , 
-# v2 =V.2~ basc + bb*alt2.b+ bc * alt2.c + bp * alt2.p ,
-# v3 =V.3~ 0)
+
 
 
 ## this function will be called before the data is simulated
diff --git a/functions.R b/functions.R
index ac0a691..9302e8d 100644
--- a/functions.R
+++ b/functions.R
@@ -42,7 +42,7 @@ sim_choice <- function(designfile, no_sim=10, respondents=330, mnl_U,utils=u ) {
 
   
   simulate_choices <- function(data=datadet) {  #the part in dataset that needs to be repeated in each run
-cat("does sou_gis exist")
+cat("does sou_gis exist: ")
    print( exists("sou_gis"))
    # browser()    
  
@@ -60,22 +60,17 @@ cat("does sou_gis exist")
 
     
     
-    print("DANGER")
+
 
     print(exists("final_set"))
     
     if(exists("final_set")) data = left_join(data,final_set, by = "ID")     
     
       data <-  data %>% 
-       # rename(ID="RID") %>% 
       group_by(ID) %>% 
-
-         #rename(ID ="RID") %>%
-        #rename_with(~ stringr::str_replace(.,pattern = "\\.","_"), everything()) %>% 
       mutate(!!! manipulations ,
              map_dfc(utils,by_formula)) %>%    #our functions to create utility variables. They need to be entered as a formula list as an argument
       rename_with(~ stringr::str_replace(.,pattern = "\\.","_"), everything()) %>% 
-               
         mutate(across(.cols=n,.fns = ~ rgumbel(setpp,loc=0, scale=1), .names = "{'e'}_{n}" ), 
          across(starts_with("V_"), .names = "{'U'}_{n}") + across(starts_with("e_")) ) %>% ungroup() %>% 
          mutate(CHOICE=max.col(.[,grep("U_",names(.))])
diff --git a/simulationcore_purrr.R b/simulationcore_purrr.R
index a64f057..fc9bb5b 100644
--- a/simulationcore_purrr.R
+++ b/simulationcore_purrr.R
@@ -15,7 +15,7 @@ source(params$file)
 
 designfile<-list.files(designpath,full.names = T)
 designname <- str_remove_all(list.files(designpath,full.names = F),
-                             "(.ngd|_)")  ## Make sure it designnames to not contain file ending and "_", as the may cause issues when replace
+                             "(.ngd|_)")  ## Make sure designnames to not contain file ending and "_", as the may cause issues when replace
 
 
 #plan(multisession, workers = 8)
-- 
GitLab