From a05c5e708cfb4d742b920c7c358a54a9add9fec9 Mon Sep 17 00:00:00 2001 From: dj44vuri <julian.sagebiel@idiv.de> Date: Sun, 10 Dec 2023 23:10:54 +0100 Subject: [PATCH] with final changes on feedadd project --- Projects/feedadditives/parameters_feedadd.R | 58 ++++++++++++------- .../feedadditives/parameters_feedadd_heur.R | 46 +++++++++++++++ generatemd.R | 2 +- 3 files changed, 84 insertions(+), 22 deletions(-) create mode 100644 Projects/feedadditives/parameters_feedadd_heur.R diff --git a/Projects/feedadditives/parameters_feedadd.R b/Projects/feedadditives/parameters_feedadd.R index bb96143..c28ef26 100644 --- a/Projects/feedadditives/parameters_feedadd.R +++ b/Projects/feedadditives/parameters_feedadd.R @@ -2,35 +2,51 @@ designpath<- "Projects/feedadditives/Designs/" -notes <- "This design consists of different heuristics. One group did not attend the methan attribute, another group only decided based on the payment" +#notes <- "This design consists of different heuristics. One group did not attend the methan attribute, another group only decided based on the payment" +notes <- "No Heuristics, price logarithmized after recoded to original level. methane continious" -resps =3600 # number of respondents -nosim=2 # number of simulations to run (about 500 is minimum) +resps =240 # number of respondents +nosim=500 # number of simulations to run (about 500 is minimum) #betacoefficients should not include "-" basc = 0.2 -bcow = 0.3 -badv = 0.3 -bvet = 0.3 -bfar = 0.3 -bmet = 0.3 +bcow = 0.2 +badv = 0.2 +bvet = 0.2 +bfar = 0.2 +bmet = 0.1 bbon = 0.3 -bbon2 = 1.9 +bcowXvet =0.1 + + +manipulations = list(alt1.bon= expr(alt1.bon*5), + alt2.bon= expr(alt2.bon*5), + alt1.lnbon = expr(if_else(alt1.bon==0,0,log(alt1.bon))), + alt2.lnbon = expr(if_else(alt2.bon==0,0,log(alt2.bon))) + ) + + + + + -decisiongroups=c(0,0.6,0.8,1) #place your utility functions here 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) , - 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) + v1 =V.1 ~ bcow*alt1.cow + badv * alt1.adv + bvet * alt1.vet + bfar * alt1.far + bmet*alt1.met + bbon * alt1.lnbon + bcowXvet*alt1.cow*alt1.vet, + v2 =V.2 ~ bcow*alt2.cow + badv * alt2.adv + bvet * alt2.vet + bfar * alt2.far + bmet*alt2.met + bbon * alt2.lnbon + bcowXvet*alt2.cow*alt2.vet, + v3 =V.3 ~ basc) ) + + + +## logBonus + + +beta_ln = 0.3 +bon <- c(1,5,10,15,20,25,30,35) +lnbon<-log(bon) +U=beta_ln*lnbon +plot(bon,U, type = "l") + diff --git a/Projects/feedadditives/parameters_feedadd_heur.R b/Projects/feedadditives/parameters_feedadd_heur.R new file mode 100644 index 0000000..7a727b8 --- /dev/null +++ b/Projects/feedadditives/parameters_feedadd_heur.R @@ -0,0 +1,46 @@ + + +designpath<- "Projects/feedadditives/Designs/" + +#notes <- "This design consists of different heuristics. One group did not attend the methan attribute, another group only decided based on the payment" + +notes <- "Three heuristics" + +resps =300 # number of respondents +nosim=2 # number of simulations to run (about 500 is minimum) + +#betacoefficients should not include "-" +basc = 0.2 +bcow = 0.3 +badv = 0.3 +bvet = 0.3 +bfar = 0.3 +bmet = 0.3 +bbon = 0.3 +bbon2 = 1.9 +basc2 =2 + +decisiongroups=c(0,0.3,0.6,0.8,1) + +#place your utility functions here +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) + , + 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), + + u4 = list(v1 =V.1 ~ basc2 + 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) + + + +) diff --git a/generatemd.R b/generatemd.R index 32ab29f..d75b58b 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$"),"_twoheur_n3600.html"), + file,"parameters_|.R$"),"_alldesN240.html"), params = list(file=file) ) -- GitLab