From 075ea82f180833dc74bec99ccaeee6d054aaa1a0 Mon Sep 17 00:00:00 2001
From: dj44vuri <julian.sagebiel@idiv.de>
Date: Mon, 27 Nov 2023 13:35:56 +0100
Subject: [PATCH] small modifications on feed additives

---
 Projects/feedadditives/parameters_feedadd.R | 23 +++++++++++++++------
 functions.R                                 |  2 +-
 generatemd.R                                |  2 +-
 project.Rproj                               | 13 ------------
 simulation_output.rmd                       | 10 +++++++--
 5 files changed, 27 insertions(+), 23 deletions(-)
 delete mode 100644 project.Rproj

diff --git a/Projects/feedadditives/parameters_feedadd.R b/Projects/feedadditives/parameters_feedadd.R
index 33b0ae5..bb96143 100644
--- a/Projects/feedadditives/parameters_feedadd.R
+++ b/Projects/feedadditives/parameters_feedadd.R
@@ -2,8 +2,11 @@
 
 designpath<- "Projects/feedadditives/Designs/"
 
-resps =360  # number of respondents
-nosim=500 # number of simulations to run (about 500 is minimum)
+notes <- "This design consists of different heuristics. One group did not attend the methan attribute, another group only decided based on the payment"
+
+
+resps =3600  # number of respondents
+nosim=2 # number of simulations to run (about 500 is minimum)
 
 #betacoefficients should not include "-"
 basc = 0.2
@@ -13,13 +16,21 @@ bvet = 0.3
 bfar = 0.3
 bmet = 0.3
 bbon = 0.3
+bbon2 = 1.9
 
-
+decisiongroups=c(0,0.6,0.8,1)
 
 #place your utility functions here
-u<- list(u1= 
-  list(
+u<- list(u1= list(
   v1 =V.1 ~  bcow*alt1.cow + badv * alt1.adv + bvet * alt1.vet + bfar * alt1.far + bmet*alt1.met + bbon * alt1.bon,
   v2 =V.2 ~  bcow*alt2.cow + badv * alt2.adv + bvet * alt2.vet + bfar * alt2.far + bmet*alt2.met + bbon * alt2.bon,
-  v3 =V.3 ~ basc)
+  v3 =V.3 ~ basc) ,
+  u2 = list(
+    v1 =V.1 ~  bcow*alt1.cow + badv * alt1.adv + bvet * alt1.vet + bfar * alt1.far + bbon * alt1.bon,
+    v2 =V.2 ~  bcow*alt2.cow + badv * alt2.adv + bvet * alt2.vet + bfar * alt2.far + bbon * alt2.bon,
+    v3 =V.3 ~ basc),
+  u3 = list(
+    v1 =V.1 ~  bbon2 * alt1.bon,
+    v2 =V.2 ~  bbon2 * alt2.bon,
+    v3 =V.3 ~ basc)
 )
diff --git a/functions.R b/functions.R
index 0f2ce8c..3ed3146 100644
--- a/functions.R
+++ b/functions.R
@@ -126,7 +126,7 @@ print(head(data))
     return(model)   
     
   }
-  
+   
   designs_all <- list() 
   
   design <- read_delim(designfile,delim = "\t",
diff --git a/generatemd.R b/generatemd.R
index a03acb8..32ab29f 100644
--- a/generatemd.R
+++ b/generatemd.R
@@ -8,7 +8,7 @@ rm(list=ls())
 rmarkdown::render("simulation_output.rmd",
                   output_file = paste0(
                     stringr::str_remove_all(
-                      file,"parameters_|.R$"),"_noheur.html"),
+                      file,"parameters_|.R$"),"_twoheur_n3600.html"),
                   params = list(file=file)
                   )
 
diff --git a/project.Rproj b/project.Rproj
deleted file mode 100644
index 8e3c2eb..0000000
--- a/project.Rproj
+++ /dev/null
@@ -1,13 +0,0 @@
-Version: 1.0
-
-RestoreWorkspace: Default
-SaveWorkspace: Default
-AlwaysSaveHistory: Default
-
-EnableCodeIndexing: Yes
-UseSpacesForTab: Yes
-NumSpacesForTab: 2
-Encoding: UTF-8
-
-RnwWeave: Sweave
-LaTeX: pdfLaTeX
diff --git a/simulation_output.rmd b/simulation_output.rmd
index f6e9be2..301b9a5 100644
--- a/simulation_output.rmd
+++ b/simulation_output.rmd
@@ -1,7 +1,7 @@
 ---
 title: "Simulation experimental design"
 author: ""
-date: "2023-01-05"
+date: "`r format(Sys.time(), '%Y-%m-%d %H:%M:%S')`"
 params:
   file: "Projects/SE_DRIVE/parameters_SE_DRIVE.R"
 format:
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(echo = TRUE)
 
 ```{r run_code, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
 
-source("simulationcore_purrr.R" ,echo = TRUE)
+source("simulationcore_purrr.R" ,echo = TRUE, local = knitr::knit_global() )
          
 # retrieve the values of the objects starting with "b" using mget()
 # b_values <- mget(ls(pattern = "^b"))
@@ -65,6 +65,12 @@ designs_all <- readRDS("output/330_5000runs_4designs_mixl.RDS")
 # Statistics and power
 
 
+
+```{r}
+cat(notes)
+```
+
+
 Here you see the statistics of your parameters for the `r nosim` runs.
 
 ```{r}
-- 
GitLab